Export (0) Print
Expand All

Connecting to a Jet Repository Database

SQL Server 2000

  New Information - SQL Server 2000 SP3.

If you choose to use a Microsoft® Jet database, you can create it programmatically using the IRepository Create method. If you do not specify a complete path, the repository engine uses the default path. For more information, see Default Repository Databases.

You can create a new database using the syntax provided in the following example. Notice that the first statement creates a repository session.

Use the following code to connect to a Jet database in Microsoft Visual C++®:

m_pIRepos->Create(CCOMVariant(DBQ="MyDB.mdb"), CCOMVariant("MyUserID"), CCOMVariant("MyPassword"), 0, &m_pIRootObj)

Use the following code to connect to a Jet database in Microsoft Visual Basic®:

DIM m_pIRepos as New Repository

Security Note  Repository databases using the Jet engine and containing sensitive information should be secured with a user name and password.

To connect to a Jet repository database, use the DBQ keyword to specify the path to the database file. The DBQ keyword must be the first keyword in the connection string, if it is present. If the DBQ keyword is not present, the connection string is assumed to contain only a database path specification. In this case, the repository will add the DBQ keyword to the front of the ODBC connection string before passing it on to the database server. If the Jet database file specified by the DBQ keyword does not exist, the repository engine will create it.

m_pIRepos->Open(CCOMVariant(DBQ="MyDB.mdb"), CCOMVariant("MyUserID"), CCOMVariant("MyPassword"), 0, &m_pIRootObj))

See Also

Connecting to a SQL Server Repository Database

Default Repository Databases

© 2014 Microsoft