Wrox Home  
Search P2P Archive for: Go

  Return to Index  

activex_data_objects thread: Opening a Secured Access database using VB and ADO...


Message #1 by "Mark E. Watkins" <markw@l...> on Fri, 10 Aug 2001 14:51:51 -0500

Hi,



Can anyone help me figure out how to open a secured Access database,

using ADO and Visual Basic.  The following shows the ConnectionString

and what I set it to.  My password is correct...so that is not it.



.ConnectionString =3D

"Provider=3DMicrosoft.Jet.OLEDB.4.0;Password=3DMyPassword;User

ID=3DAdmin;" & _

            "Data Source=3D" & GetDBPath





And I tried the following as well...





.ConnectionString =3D

"Provider=3DMicrosoft.Jet.OLEDB.4.0;Password=3DMyPassword;User

ID=3DAdmin;" & _

            "Data Source=3D" & GetDBPath & ";" & _

            "Persist Security Info=3DTrue;" & _

            "Jet OLEDB:System database=3D" & GetMDWPath



The GetDBPath and GetMDWPath are functions to retrieve the paths from

the registry.



- Thanks

Mark





Message #2 by Terrence Joubert <Terrence@v...> on Sat, 11 Aug 2001 08:30:41 +0400
Hi 



FYI: The OLEDB Provider for Microsoft Access is 'Microsoft.Jet.OLEDB.4.0'

Is there a Provider called 3DMicrosoft.Jet.OLEDB.4.0  installed?



If yes, then try this:



Note: objConn - ADO Connection



With objConn

.Provider = "3DMicrosoft.Jet.OLEDB.4.0"

.Open "Server=<servername>;Database=<databasename>", "userid", "password"

End With



Hope this helps.



Terrence





-----Original Message-----

From: Mark E. Watkins [mailto:markw@l...]

Sent: Friday, August 10, 2001 11:52 PM

To: ActiveX_Data_Objects

Subject: [activex_data_objects] Opening a Secured Access database using VB

and ADO...





Hi,



Can anyone help me figure out how to open a secured Access database,

using ADO and Visual Basic.  The following shows the ConnectionString

and what I set it to.  My password is correct...so that is not it.



.ConnectionString =3D

"Provider=3DMicrosoft.Jet.OLEDB.4.0;Password=3DMyPassword;User

ID=3DAdmin;" & _

            "Data Source=3D" & GetDBPath





And I tried the following as well...





.ConnectionString =3D

"Provider=3DMicrosoft.Jet.OLEDB.4.0;Password=3DMyPassword;User

ID=3DAdmin;" & _

            "Data Source=3D" & GetDBPath & ";" & _

            "Persist Security Info=3DTrue;" & _

            "Jet OLEDB:System database=3D" & GetMDWPath



The GetDBPath and GetMDWPath are functions to retrieve the paths from

the registry.



- Thanks

Mark





Message #3 by "Mark E. Watkins" <wattem@h...> on Sat, 11 Aug 2001 10:47:29 -0500
Hi Terrence



That was a typo.  My connectionstring does not have that in it.  If the

database is local, what goes in the Server argument of the Open?



Mark



----- Original Message -----

From: "Terrence Joubert" <Terrence@v...>

To: "ActiveX_Data_Objects" <activex_data_objects@p...>

Sent: Friday, August 10, 2001 11:30 PM

Subject: [activex_data_objects] RE: Opening a Secured Access database usin g

VB and ADO...





> Hi

>

> FYI: The OLEDB Provider for Microsoft Access is 'Microsoft.Jet.OLEDB.4.0'

> Is there a Provider called 3DMicrosoft.Jet.OLEDB.4.0  installed?

>

> If yes, then try this:

>

> Note: objConn - ADO Connection

>

> With objConn

> .Provider = "3DMicrosoft.Jet.OLEDB.4.0"

> .Open "Server=<servername>;Database=<databasename>", "userid", "password"

> End With

>

> Hope this helps.

>

> Terrence

>

>

> 
Message #4 by Terrence Joubert <Terrence@v...> on Sun, 12 Aug 2001 08:34:22 +0400
Hi Mark,



This is very easy. You do not even have to specify a server if it is local.

All you need as the ConnectionString is the path and name of the mdb file.

This example opens a connection to the FoodMart2000 database that comes with



OLAP Services:



Set objConn = Server.CreateObject("ADODB.Connection") 



With objConn

objConn.Provider = "Microsoft.Jet.OLEDB.4.0"

objConn.Open "C:\Program Files\Microsoft Analysis

Services\Samples\FOODMART.mdb", "", "" 

objConn.close

End With 



A much faster connection is through ODBC. Create an ODBC DSN for the 

filename of the database.

All you have to do in ADO to open a connection is this:



Set objConn = Server.CreateObject("ADODB.Connection") 

objConn.Open "FOODMARTDSN", "", "" 

objConn.close



By default ADO searches the available local data sources for the name"

FOODMARTDSN" 

This is the best way to do it if you are going to deploy the application to

different customers.

With ODBC, you are sure that your ADO code will work anywhere the DSN exist

instead of

Relying on a hard coded filepath in your connectionstring.

The only deployment task is to write a routine that registers the ODBC DSN

into the Windows

Registry. 



I do hope that this helps.



Terrence



-----Original Message-----

From: Mark E. Watkins [mailto:wattem@h...]

Sent: Saturday, August 11, 2001 7:47 PM

To: ActiveX_Data_Objects

Subject: [activex_data_objects] RE: Opening a Secured Access database usin g

VB and ADO...



Hi Terrence



That was a typo.  My connectionstring does not have that in it.  If the

database is local, what goes in the Server argument of the Open?



Mark



Message #5 by "Mark E. Watkins" <wattem@h...> on Sun, 12 Aug 2001 14:43:10 -0500
Hi Terrence,



The problem I'm having is that I cannot open a secured database that is

protected with a password.  I issue 'Admin' as the User ID and 'MyPassword'

as the password and it does not open the database.  I get invalid password

and sometimes I get 'Ivalid Account or password'.



- Thanks

Mark



----- Original Message -----

From: "Terrence Joubert" <Terrence@v...>

To: "ActiveX_Data_Objects" <activex_data_objects@p...>

Sent: Saturday, August 11, 2001 11:34 PM

Subject: [activex_data_objects] RE: Opening a Secured Access database usin g

VB and ADO...





> Hi Mark,

>

> This is very easy. You do not even have to specify a server if it is

local.

> All you need as the ConnectionString is the path and name of the mdb file.

> This example opens a connection to the FoodMart2000 database that comes

with

>

> OLAP Services:

>

> Set objConn = Server.CreateObject("ADODB.Connection")

>

> With objConn

> objConn.Provider = "Microsoft.Jet.OLEDB.4.0"

> objConn.Open "C:\Program Files\Microsoft Analysis

> Services\Samples\FOODMART.mdb", "", ""

> objConn.close

> End With

>

> A much faster connection is through ODBC. Create an ODBC DSN for the

> filename of the database.

> All you have to do in ADO to open a connection is this:

>

> Set objConn = Server.CreateObject("ADODB.Connection")

> objConn.Open "FOODMARTDSN", "", ""

> objConn.close

>

> By default ADO searches the available local data sources for the name"

> FOODMARTDSN"

> This is the best way to do it if you are going to deploy the application

to

> different customers.

> With ODBC, you are sure that your ADO code will work anywhere the DSN

exist

> instead of

> Relying on a hard coded filepath in your connectionstring.

> The only deployment task is to write a routine that registers the ODBC DSN

> into the Windows

> Registry.

>

> I do hope that this helps.

>

> Terrence

>

>

  Return to Index