Password protected Access Database 
Author Message
 Password protected Access Database

Hi

I have an application using VC++ 6.0 and ADO. Everything works fine
until I added a password to the database.  Now I can't open a
connection.  I get an error saying
"error opening connection.  The workgroup information file is missing or
is opened exclusively by another user".

The file is not open anywhere else.

Any help would be appreciated.

My code to open the database is.

        CString connectionString="";
        connectionString.Format("Provider=Microsoft.Jet.OLEDB.3.51;Data
Source = password.mdb;");
//      connectionString.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source = %s\\AquaDRUMS.mdb;",pApp->mDatabaseDir);

//      connectionString.Format("Driver={Microsoft Access Driver
(*.mdb)};DBQ=password.mdb;");
        //open a connection to the database
        HRESULT hr;
        try
        {
                hr =mpConnection.CreateInstance(__uuidof(Connection));
                if(SUCCEEDED(hr))
                {
                        hr = mpConnection->Open(
                                        _bstr_t(connectionString),
                                        _bstr_t(L""),
                                        _bstr_t(L"melvin;"),
                                        adModeUnknown);
                        if(SUCCEEDED(hr))
                        {
                                m_isConnectionOpen=TRUE;
                        }
                }
        }
        catch (_com_error &e)
        {
                CString errorString;
                _bstr_t Desc(e.Description());
                TRACE("\nMeaning = %s\n",(LPCTSTR)Desc);
                errorString.Format("Error opening connection. Reason
%s",(LPCTSTR)Desc);
                AfxMessageBox(errorString);
        }



Fri, 21 Mar 2003 03:00:00 GMT  
 Password protected Access Database
The general connection string is:

"DSN=My Database;UID=myname;PWD=mypassword"

Quote:

> Hi

> I have an application using VC++ 6.0 and ADO. Everything works fine
> until I added a password to the database.  Now I can't open a
> connection.  I get an error saying
> "error opening connection.  The workgroup information file is missing or
> is opened exclusively by another user".

> The file is not open anywhere else.

> Any help would be appreciated.

> My code to open the database is.

>         CString connectionString="";
>         connectionString.Format("Provider=Microsoft.Jet.OLEDB.3.51;Data
> Source = password.mdb;");
> //      connectionString.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data
> Source = %s\\AquaDRUMS.mdb;",pApp->mDatabaseDir);

> //      connectionString.Format("Driver={Microsoft Access Driver
> (*.mdb)};DBQ=password.mdb;");
>         //open a connection to the database
>         HRESULT hr;
>         try
>         {
>                 hr =mpConnection.CreateInstance(__uuidof(Connection));
>                 if(SUCCEEDED(hr))
>                 {
>                         hr = mpConnection->Open(
>                                         _bstr_t(connectionString),
>                                         _bstr_t(L""),
>                                         _bstr_t(L"melvin;"),
>                                         adModeUnknown);
>                         if(SUCCEEDED(hr))
>                         {
>                                 m_isConnectionOpen=TRUE;
>                         }
>                 }
>         }
>         catch (_com_error &e)
>         {
>                 CString errorString;
>                 _bstr_t Desc(e.Description());
>                 TRACE("\nMeaning = %s\n",(LPCTSTR)Desc);
>                 errorString.Format("Error opening connection. Reason
> %s",(LPCTSTR)Desc);
>                 AfxMessageBox(errorString);
>         }



Wed, 26 Mar 2003 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Open a password-protected Access database

2. Error compacting a password-protected Access database

3. SQLConfigDataSource and password protected ACCESS database

4. Password Protected DataBase

5. Password protected DataBase

6. Open a password protected DataBase

7. How to compact a password protected database with Visual C++ using ODBC

8. DAO password protected database and class wizard

9. open password protected DAO Database

10. How to compact a password protected database with Visual C++ using ODBC

11. Password protected database (DAO)

12. Open a password protected Database

 

 
Powered by phpBB® Forum Software