connect to MS Access without dsn
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   dattu_peri
Posted On:   Tuesday, October 21, 2003 10:51 AM

Please use html tags to format code blocks. Hi every one I was trying to connect to the access database using jdbc. I have created a dsn for the database and used it in the code. But i wanted to connect to the database without using the dsn i.e i should be able to give the database file name in my connection string. I am using jdbcodbc bridge driver to connect to the database. Please let me know what i should give as parameters in the DriverManager.getConnection() method.for you information i dont have any username and password for the database. Thanks, Peri    More>>


Please use html tags to format code blocks.



Hi every one I was trying to connect to the access
database using jdbc. I have created a dsn for the database

and used it in the code. But i wanted to connect to the
database without using the dsn i.e i should be able to give the database file name in my connection string.



I am using jdbcodbc bridge driver to connect to the database.

Please let me know what i should give as parameters in the DriverManager.getConnection() method.for you information i dont have any username and password for the database.




Thanks,
Peri

   <<Less

Re: connect to MS Access without dsn

Posted By:   Mariano_Pedrosa  
Posted On:   Wednesday, January 14, 2004 06:32 AM

You can do the following:

try{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

con = DriverManager.getConnection( "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)}; DBQ=database_file_name.mdb","","");

where says database_file_name.mdb yo must put the complete
url of the .mdb file including the file name.

About | Sitemap | Contact