?
Solved

Creating an ODBC Data Source Automatically

Posted on 2003-02-25
6
Medium Priority
?
190 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
  • 2
  • 2
5 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses
Course of the Month9 days, 7 hours left to enroll

621 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