Sign in to follow this  
Followers 0
not-me

How to Connect to MDB database with password

13 posts in this topic

How i can connect to MDB Access database protected by password?

by using SQLite.au3

Thanks

Share this post


Link to post
Share on other sites



How i can connect to MDB Access database protected by password?

by using SQLite.au3

Thanks

Hi,

I think you could connect using syntax as in my "Accesscom.au3" udf, found via the link in my signature.

There are some examples of usage of SQL commands there.

Not Sqlite.au3, as that is to use Sqlite as the database, not access mdb file?..

Best, Randall

Share this post


Link to post
Share on other sites

where can i find the file "Accesscom.au3"

?

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

vollyman: yes i know tha password

randallc: i found the following

$newMdb = ObjCreate("ADOX.Catalog")
$newMdb.Create ("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $s_dbname & ';')
;$newMdb.Create ("Driver={Microsoft Access Driver (*.mdb)};Dbq="&$s_dbname&';UID=' & $USRName & ';PWD=' & $PWD)

i can use it without password but i dont know how to use the syntex when there is a password!

i hope u can give me an example not a syntex.

Thanks

Edited by not-me

Share this post


Link to post
Share on other sites

vollyman: yes i know tha password

randallc: i found the following

$newMdb = ObjCreate("ADOX.Catalog")
$newMdb.Create ("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $s_dbname & ';')
;$newMdb.Create ("Driver={Microsoft Access Driver (*.mdb)};Dbq="&$s_dbname&';UID=' & $USRName & ';PWD=' & $PWD)

i can use it without password but i dont know how to use the syntex when there is a password!

i hope u can give me an example not a syntex.

Thanks

$USRName ="Usernamehere"
$PWD="passwordHere"
_AccessConnectConn ($s_dbname, $o_Con, 0,"UserNameHere","PasswordHere")oÝ÷ Ù«­¢+Ù%ÀÌØí¥}½5Q¡¸ÀÌØí½}½
½¸¹=Á¸ ÅÕ½ÐíÉ¥ÙÈõí5¥É½Í½ÐÍÌÉ¥ÙÈ ¨¹µ¥ôíÄôÅÕ½ÐìµÀìÀÌØíÍ}¹µµÀìÌäìíU%ôÌäìµÀìÀÌØíUMI9µµÀìÌäìíA]ôÌäìµÀìÀÌØíA]oÝ÷ Ù«­¢+ØÀÌØí¹Ý5¹
ÉÑ ÅÕ½ÐíÉ¥ÙÈõí5¥É½Í½ÐÍÌÉ¥ÙÈ ¨¹µ¥ôíÄôÅÕ½ÐìµÀìÀÌØíÍ}¹µµÀìÌäìíU%ôÌäìµÀìÀÌØíUMI9µµÀìÌäìíA]ôÌäìµÀìÀÌØíA]¤
Is this what you need?

Share this post


Link to post
Share on other sites

Dear randallc

thank you for helping me , i know i tired you but i still have a problem.

i hope that u can give an example with the following parameter:

database location: c:\test.mdb

user: admin

password: notme

how to connect to this database and insert a record($var1,$var2) into the table (products) in the fields (productid,productname)

where $var1= anything , $var2=anything

i hope that u give a full example include any #include

thank you alot

Share this post


Link to post
Share on other sites

i knew how to insert a record ($var1,$var2) into the table.

but i dont know how to connect to databse with password ;)

any help plz

Share this post


Link to post
Share on other sites

any answer plz

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Hi, Sorry;

I was away; and I mis-led you; I have only been able to use the passwords here for reading pre-existing Access mdb files which have passwords; I have never tried to get the creating and writing working; the microsoft site suggests it is possible with ADOX, but I am not sure how; maybe pm Zedna or Stumpii or LOULOU?..

Best, Randall

Edited by randallc

Share this post


Link to post
Share on other sites

I have only been able to use the passwords here for reading pre-existing Access mdb files which have passwords

Best, Randall

Hi, randallc

thank you for ur answer. That is what i want, access pre-existing access mdb file with password.

assume that the file already exist (c:\test.mdb) and have a password: notme

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Hi, randallc

thank you for ur answer. That is what i want, access pre-existing access mdb file with password.

assume that the file already exist (c:\test.mdb) and have a password: notme

OK; seriously, I don't believe you will be able to change any data; though!

Here is example script, and mdb with password attached as example; please destroy after use!

change your poassword names and user name and database name;

;AccessExamplePassword2.au3 0_28
#include"AccessCOM.au3"
Local $o_Con, $o_Con2, $o_Rs
#include "_ArrayView2D1D.au3"
global  $s_Tablename = "tblDailyLog",$s_dbname=FileGetShortName(@ScriptDir&"\HistoryLogDB.mdb")
;CONNECT========================================================
$o_Con = ObjCreate("ADODB.Connection")
$o_Con.Open("Driver={Microsoft Access Driver (*.mdb)};Dbq="&$s_dbname&';UID=admin;PWD=deltec')
;;DISPLAY1========================================================
$query = "SELECT * FROM " & $s_Tablename & " IN '" & $s_dbname & "'"; &" IN "&$s_dbname; & " WHERE " & $Fieldname0 & " = 'OPEN'"
$ar_Rows = _RecordSearch ($s_dbname, $query, $o_Con)
;~ _ArrayViewQueryTable($ar_Rows,$query)
_ArrayView2D1D ($ar_Rows, $query & "$s_Tablename Array", 1)
;~ _ArrayViewText($ar_Rows,$query,1,1,1,0,800,600,-1,-1);,$Displayindex=1, $ZeroRowAsHeader=0);COPY to different table, same DB========================================================
_AccessCloseConn ($o_Con)

Randall

EDIT - example zip removed; please PM me if needed; running out of attachment space (again!)

Edited by randallc

Share this post


Link to post
Share on other sites

Thank you Randall,it works now with me after i saw ur example.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0