tags:

views:

72

answers:

3

I want to write a Java program that automates the work that the ODBC Data Source Administrator does in Windows.

That is, given an ODBC connection name and a path to the database on the hard drive, I want it to create the connection.

I really have no idea where to even begin with this. I looked at this but it said it was for C and I don't think that's very helpful. If anyone could point me in the right direction for this at all, I would appreciate it.

(I realize this question is REALLY vague, but that's all the information I was given.)

+1  A: 

You will want to look into using JDBC.

Jeremy
I've used JDBC, but all my experience with it has either been with a MySQL or SQL database or with a database that has an ODBC connection that I have already set up using the ODBC Data Source Administrator. Can I use it to set up that connection instead of the Data Source Administrator?
Jessica
@Jessica I don't think so. I believe you have to have an ODBC Data Source setup.
Kevin Crowell
A: 

Check out JDBC to ODBC bridge.

Kevin Crowell
A: 

All ODBC configuration is in Windows registry or odbc.ini in Linux (I haven't used ODBC on other platforms). At first you must create such configuration using ODBC manager, then check what was saved in configuration and write program that do the same. If you work with Windows 32 bit, then check registry at HKEY_LOCAL_MACHINE\SOFTWARE\ODBC. Windows 64 bit have different configurations for 32 bit apps and 64 bit apps (just look for odbc.ini string in registry).

I think Java is not the best language to change something in Windows registry, but with Java you can create .reg text file that can be imported by regedit.exe, or you can use other language like Python with win32 extensions (Active Python has it by default).

Michał Niklas