Connection to a MSDE Database using the DAO SDK 3.50 ( In VC++ ) 
Author Message
 Connection to a MSDE Database using the DAO SDK 3.50 ( In VC++ )

Hello everyone.

I am attempting to access an MSDE database using the DAO Sdk. I AM NOT USING
THE DAO MFC CLASSES. I am using the SDK, version 3.50.

In the SDK,  it is possible to access an ODBC database, as well as a JET
database.

I have installed MSDE, and the SQL server 7 management tools.

The database is named Avantron2, and I have named the Data Source MSDE_DATA

When I use the wizards in VC to create a database project, I am able to view
the database using that data source and that database name.

In a small test project, I first open the Engine using the following code :

CdbDBEngine engine ( FALSE, TRUE, NULL, "sa", NULL, dbUseODBC );

I then tried both with a new workspace and without a workspace created in
the following method :

CdbWorkspace ws = engine.CreateWorkspace ( "MyTest", "sa", "", dbUseODBC);

I then call the OpenDatabase function, from ws or from engine

The following calls generate a "ODBC Call Failed" exception

CdbDatabase db = ws.OpenDatabase ( "MSDE_DATA", 0,
false,"ODBC;DATABASE=Avantron2;UID=sa;PWD=;DSN=MSDE_DATA;");
CdbDatabase db = ws.OpenDatabase ( "Avantron2", 0,
false,"ODBC;DATABASE=Avantron2;UID=sa;PWD=;DSN=MSDE_DATA;");
CdbDatabase db = ws.OpenDatabase ( "", 0,
false,"ODBC;DATABASE=Avantron2;UID=sa;PWD=;DSN=MSDE_DATA;");

CdbDatabase db = ws.OpenDatabase ( "MSDE_DATA", 0,
false,"ODBC;DATABASE=Avantron2;UID=sa;PWD=;DSN=MSDE_DATA;");
CdbDatabase db = ws.OpenDatabase ( "Avantron2", 0,
false,"ODBC;DATABASE=Avantron2;UID=sa;PWD=;DSN=MSDE_DATA;");
CdbDatabase db = ws.OpenDatabase ( "", 0,
false,"ODBC;DATABASE=Avantron2;UID=sa;PWD=;DSN=MSDE_DATA;");

The following calls generate a "Invalid Argument" exception

CdbDatabase db = ws.OpenDatabase ( "", dbDriverPrompt, false,"ODBC;");
CdbDatabase db = ws.OpenDatabase ( "MSDE_DATA", dbDriverPrompt,
false,"ODBC;");

What I am doing wrong ? Is there ANY place with more documentation ?

Is the problem in using the SDK or with ODBC ?

Thank you in advance

--
Martin-Pierre Frenette
Software designer and developper
Windows Software R&D group
Avantron Technologies Inc.

1-800-297-9726 ext 229
1-514-725-6652 ext 229



Mon, 03 Mar 2003 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. change size of a field in acces database using DAO 3.5 with VC ++5

2. Moving from JET to SQL Server / MSDE using DAO sdk

3. DAO 3.60 crashes app that works fine with DAO 3.50

4. Creating MSDE database using ADO/ADOX with VC++

5. DAO SDK 3.5 with MSVC 4.2

6. Multi-threaded DAO(3.5) SDK and UNICODE problems

7. CdbException and the DAO SDK 3.5

8. DAO SDK 3.5

9. DAO SDK 3.5

10. Restructuring a Microsoft Access database using VC++ 5 and DAO

11. Newlines in Memo fields using DAO 3.5

12. DAO 3.5 VC++ ODBC Connect Failure

 

 
Powered by phpBB® Forum Software