开发者

Creating ODBC Data source java

开发者 https://www.devze.com 2023-02-22 14:48 出处:网络
I found this video which shows how to connect to access database : http://www.youtube.com/watch?v=ujJ4H9RpC7c

I found this video which shows how to connect to access database :

http://www.youtube.com/watch?v=ujJ4H9RpC7c

My question is : Is it possible to create ODBC datasource progr开发者_JAVA百科amatically ?

or from command line or anything like that?

Thank you


It is not possible to create a windows ODBC DSN programmatically with pure Java. It is possible with C++ and other native approaches.

However, you can connect to an Access MDB file directly (via ODBC) using a JDBC URL of the form:

  • String jdbcUrl = "jdbc:odbc:Driver={MicroSoft Access Driver (*.mdb)};DBQ=c:/path/to/myaccessfile.mdb"

This way you do not need to have predefined DSN. You might also want to review the answers to this question:

  • How can I add a password to this JDBC:ODBC connection string that is trying to connect to an MS Access database


From the command line, you can use an utility named odbcconf.

I guess that if you need to do that programatically, you'll need to use WinAPI somehow.

0

精彩评论

暂无评论...
验证码 换一张
取 消