Microsoft KB Archive/296091

= PRB: MFC AppWizard Does Not Show Oracle Synonyms with Microsoft ODBC Driver =

Article ID: 296091

Article Last Modified on 1/23/2004

-

APPLIES TO


 * Microsoft Visual C++ .NET 2002 Standard Edition
 * Microsoft Visual C++ .NET 2003 Standard Edition
 * Microsoft Visual C++ 4.2 Professional Edition
 * Microsoft Visual C++ 5.0 Standard Edition
 * Microsoft Visual C++ 6.0 Service Pack 5
 * Microsoft Data Access Components 1.5
 * Microsoft Data Access Components 2.0
 * Microsoft Data Access Components 2.1
 * Microsoft Data Access Components 2.5
 * Microsoft Data Access Components 2.6

-



This article was previously published under Q296091



SYMPTOMS
When you create a Visual C++ Microsoft Foundation Classes (MFC) AppWizard EXE or DLL with database support, if you select an Oracle data source name (DSN) that is associated with the Microsoft ODBC Driver for Oracle, AppWizard doesn't list the local and public Oracle synonyms in the Select Database Tables window.



RESOLUTION
You can work around this problem in the following ways:
 * You can create and use Oracle views instead of Oracle synonyms.
 * If you are using Visual C++, you can use the Microsoft OLE DB Provider for Oracle, instead of the Microsoft ODBC Driver for Oracle, to obtain local synonyms and tables associated with public synonyms.

Note The workaround that uses the Microsoft OLE DB Provider for Oracle does not apply to Microsoft Visual C++ .NET 2002 or to Microsoft Visual C++ .NET 2003.

For examples of these workarounds, see the &quot;More Information&quot; section.



STATUS
This behavior is by design.



MORE INFORMATION
Unlike Microsoft Access and the MFC AppWizard with the Microsoft OLEDB Provider for Oracle, the MFC AppWizard connecting to an Oracle database using the Microsoft ODBC Driver for Oracle doesn't list local (created in the current schema) and public synonyms.

Visual C++ versions 6.0 and earlier
  Create a table in schema &quot;SCOTT&quot;: CREATE TABLE scott_test(col1 INT)   Create a public synonym on this table and give everyone &quot;SELECT&quot; permission: CREATE PUBLIC SYNONYM scott_test_syn FOR scott_test Grant SELECT on scott_test_syn TO PUBLIC  Start Visual C++. On the File menu, click New. Click the Projects tab, select MFC AppWizard (exe), type the project name, and then click OK. Accept the defaults and then click Next. Select Database view without file support or Database view with file support, and then click the Data Source button.</li> Select an Oracle ODBC DSN associated with the Microsoft ODBC Drvier for Oracle and click OK.</li> Enter the user name (schema other than SCOTT to perform this test) and password. Click OK.</li> In the Select Database Tables window, the public synonym &quot;scott_test_syn&quot; is not listed.</li></ol>

Visual C++ .NET
<ol>  Create a table in schema &quot;SCOTT&quot;: CREATE TABLE scott_test(col1 INT) </li>  Create a public synonym on this table and give everyone &quot;SELECT&quot; permission: CREATE PUBLIC SYNONYM scott_test_syn FOR scott_test Grant SELECT on scott_test_syn TO PUBLIC </li> Start Visual Studio .NET. On the File menu, point to New, and then click Project.</li> Under Project Types, choose Visual C++ Projects, and then select MFC Application under Templates.</li> Give the project a name and then click OK. The MFC Application Wizard starts.</li> Click Database Support, and then select either Database view without file support or Database view with file support. If you choose Database view without file support, you receive the following message:

Selecting a database view without file support forces your project to use the Single Document Interface.

To keep this setting, click Yes. If you click No, the setting defaults to Database view with file support.

</li> Under Client Type, select ODBC, and then click Datasource.</li> Select an Oracle ODBC DSN that is associated with the Microsoft ODBC Drvier for Oracle, and then click OK.</li> Type the user name (schema other than SCOTT to perform this test) and password. Click OK.</li> In the Select Data Object window, the public synonym &quot;scott_test_syn&quot; is not listed.</li></ol>

Using these examples, you can work around the problem in the following ways: <ul> If you select the Microsoft OLE DB Provider for Oracle (instead of the Microsoft ODBC Driver for Oracle), the MFC App Wizard will list &quot;scott_test&quot;, which is the table associated with the public synonym &quot;scott_test_syn&quot;.</li>  You can also create a view on the table asssociated with the public synonym in the schema you want to connect to using MFC AppWizard: CREATE VIEW scott_test_view AS SELECT * FROM SCOTT.scott_test; You will then see &quot;scott_test_view&quot; in the list of tables. </li></ul>

Additional query words: MFC AppWizard Oracle PUBLIC SYNONYM VIEW ODBC

Keywords: kboracle kbprb kbdriver KB296091

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.