Creating an ODBC Data Source Automatically

Posted on 2003-02-25
Medium Priority
Last Modified: 2012-08-13
I would like to know how to have a program automatically create an ODBC Data Source.  Normally I go into Administrative Tools in the Control Panel (Windows) and do it manually by giving it a driver, a name, and browsing to the database I want to connect to, but I need a way to have it done automatically.  Any help would be most appreciated.
Question by:sre22
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 86

Expert Comment

ID: 8019429
Not possible without Windows-specific Java or JNI. Also *perhaps* possible with Java Windows registry library.

Author Comment

ID: 8019973
What do you mean by "Windows-specific Java or JNI".  Does it mean that you can only do it if the program is going to be run in a Windows environment?  If so, then that is fine.  The only OS that will run the program will be Windows.  And what about the Java Windows registry library?  Can you elaborate a little more on what it is and how to use it?  Thanks.
LVL 86

Accepted Solution

CEHJ earned 240 total points
ID: 8020516
No it means that you'd have to use special libraries to create an ODBC Data Source.

Have a look at





Expert Comment

ID: 8030263
Hey sre22, nice name :))  
Don't know if this will work for you, but it is possible to connect to a DB without an ODBC Data Source.  You can just create a connection on the fly.  It is a little slower this way, but works just the same:

Connection con;

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

    Statement stat = con.createStatement();

Author Comment

ID: 8030288
Thanks!!  I never even thought of doing it that way.  I tested the speed and it is a little slower over a LAN, but not too bad for my purposes.

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
This video teaches viewers about errors in exception handling.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month8 days, 14 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question