Home > Archive > MS Access database support > April 2006 > odbc









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author odbc
Rysiek

2006-04-05, 9:35 am

Hi.
I've got a "base.mdb" secured with "system.mdw". There's also a
password set on "base.mdb" . After configuration ODBC driver ( system
DSN ), supplying user and his pass too, when I try to connect do it I
receive error "Invalid password". What I'm doing wrong ? Is it related
to pass which is for "base.mdb" ? Regards.
Rick
Anthony England

2006-04-05, 9:35 am

"Rysiek" <rickneo_@neostrada.pl> wrote in message
news:20060405135300.27299268@vector.linux.vnet...
> Hi.
> I've got a "base.mdb" secured with "system.mdw". There's also a
> password set on "base.mdb" . After configuration ODBC driver ( system
> DSN ), supplying user and his pass too, when I try to connect do it I
> receive error "Invalid password". What I'm doing wrong ? Is it related
> to pass which is for "base.mdb" ? Regards.
> Rick



A database password is a very basic form of security. If you have set up
security with an mdw file, then there is no point adding a database
password. It just complicates other things unnecessarily - so just remove
it.
Creating a dsn with odbc is not normally required either.

What are you trying to do?


Rysiek

2006-04-05, 9:35 am


>
> A database password is a very basic form of security. If you have
> set up security with an mdw file, then there is no point adding a
> database password. It just complicates other things unnecessarily -
> so just remove it.

I can't remove it. I'm writing an application which is to get some data
from existing access database. I have no admin privileges on it, so I
can't do anything with it. I've got only user, password and database
password

> Creating a dsn with odbc is not normally required either.
>
> What are you trying to do?


My app it's some php scripts, and afaik only with ODBC I can connect do
*.mdb

Anthony England

2006-04-05, 9:35 am

"Rysiek" <rickneo_@neostrada.pl> wrote in message
news:20060405142957.0e454637@vector.linux.vnet...
>
> I can't remove it. I'm writing an application which is to get some data
> from existing access database. I have no admin privileges on it, so I
> can't do anything with it. I've got only user, password and database
> password
>
>
> My app it's some php scripts, and afaik only with ODBC I can connect do
> *.mdb



I'm afraid I don't know anything about php. Is this running on Windows? If
so, you should be able to use an ADO connection without needing any dsn
file.
But anyway, did you try removing the database password? (hopefully you
believe me that it should be removed)


Rysiek

2006-04-05, 9:35 am

O
>
>
> I'm afraid I don't know anything about php. Is this running on
> Windows? If so, you should be able to use an ADO connection without
> needing any dsn file.

As I don't know anything about access :) It's all done under
Windows. Anyway it seems not to be a problem with php. When I try for
example to compact database (on system DSN tab there's a option to do
this), I receive the same error.
Hmm, "ADO connection" could you in short describe this ?

> But anyway, did you try removing the database password? (hopefully
> you believe me that it should be removed)

Of course I believe, but I'm not allowed do this. I've got access to
this *.mdb file "as is".

Anthony England

2006-04-05, 9:35 am


"Rysiek" <rickneo_@neostrada.pl> wrote in message
news:20060405153355.65c539ae@vector.linux.vnet...
> O
> As I don't know anything about access :) It's all done under
> Windows. Anyway it seems not to be a problem with php. When I try for
> example to compact database (on system DSN tab there's a option to do
> this), I receive the same error.
> Hmm, "ADO connection" could you in short describe this ?
>
> Of course I believe, but I'm not allowed do this. I've got access to
> this *.mdb file "as is".



Dobrze.
If you are running Windows, you can create a plain text file with note pad
and cut and paste the code below. Change the username, passwords and file
locations, then close and save the file as TestMe.vbs and then run it by
double-clicking it.

This will verify that you really do have the right details. Once you have
done this test, you can move on to changing the code to do some useful work
with the database - such as reading or updating the data.



' **** Code Starts *******
Option Explicit

If TestDb()=0 Then
MsgBox "I can connect"
Else
MsgBox "I cannot connect"
End If


Function TestDb()

On Error Resume Next

Dim cnn
Dim strConn
Dim strSQL
Dim lngReturn

lngReturn=1

strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\MyFolder\D
atabase.mdb;" & _
"Jet OLEDB:System Database=C:\MyFolder
\Workgroup.mdw;" & _
"User Id=MyLoginName;Passw
ord=MyPassword;" & _
"Jet OLEDB:Database Password=DatabasePas
sword;"

Set cnn = CreateObject("ADODB.Connection")

cnn.Open strConn

If Not cnn Is Nothing Then
If cnn.State > 0 Then
lngReturn=0
cnn.Close
End If
Set cnn = Nothing
End If

End Function
' **** Code Ends *******


Anthony England

2006-04-05, 11:36 am

I left out the last very important line in the function!!
Just before the End Function, you need TestDb=lngReturn
For clarity, the text is now:



' **** Code Starts *******
Option Explicit

If TestDb()=0 Then
MsgBox "I can connect"
Else
MsgBox "I cannot connect"
End If


Function TestDb()

On Error Resume Next

Dim cnn
Dim strConn
Dim strSQL
Dim lngReturn

lngReturn=1

strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\MyFolder\D
atabase.mdb;" & _
"Jet OLEDB:System Database=C:\MyFolder
\Workgroup.mdw;" & _
"User Id=MyLoginName;Passw
ord=MyPassword;" & _
"Jet OLEDB:Database Password=DatabasePas
sword;"

Set cnn = CreateObject("ADODB.Connection")

cnn.Open strConn

If Not cnn Is Nothing Then
If cnn.State > 0 Then
lngReturn=0
cnn.Close
End If
Set cnn = Nothing
End If

TestDb=lngReturn

End Function
' **** Code Ends *******


Rysiek

2006-04-06, 11:34 am

O
>
>
> Dobrze.

:)

> If you are running Windows, you can create a plain text file with
> note pad and cut and paste the code below. Change the username,
> passwords and file locations, then close and save the file as
> TestMe.vbs and then run it by double-clicking it.
>
> This will verify that you really do have the right details. Once you
> have done this test, you can move on to changing the code to do some
> useful work with the database - such as reading or updating the data.
>


Thank you for your support. I'll be able to test it on Saturday.
Rick

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com