?
Solved

Creating an ODBC Data Source Automatically

Posted on 2003-02-25
6
Medium Priority
?
186 Views
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.
0
Comment
Question by:sre22
[X]
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
6 Comments
 
LVL 86

Expert Comment

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

Author Comment

by:sre22
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.
0
 
LVL 86

Accepted Solution

by:
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

http://support.microsoft.com/default.aspx?scid=kb;EN-US;q184608

and

http://www.gjt.org/servlets/JCVSlet/list/ice/com/ice/jni/registry/doc



0
 
LVL 1

Expert Comment

by:sre23
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;

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

    Statement stat = con.createStatement();
0
 

Author Comment

by:sre22
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.
0

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