Making an ODBC connection through System DSN set up under Windows ODBC Data Source Administrator?

Posted on 2011-10-25
Last Modified: 2012-05-12
'm trying to make an ODBC connection in Java through Windows ODBC Manager. I have managed to read the registry to get a listing of System DSNs and once a selection is made by the user I read the "HostMachine" parameter in the registry associated with the selected SystemDSN and from there I want to make that ODBC connection. I have tried the DriverManager getConnection method but it doesn't seem to work! Any ideas PLZ??!

Please note that I want to access the servers through their associated IP addresses and less likely urls, hence (HostMachine)!

Also each of these System DSNs are associated with a driver that would need to be used to connect its related data source!
Question by:snajalm
    LVL 86

    Expert Comment

    You probably need to make the connections through registry writes. I would examine the registry at each step, as you move from finding candidates to actually making the connection *manually*
    LVL 86

    Expert Comment

    Check out the Windows docs too. Perhaps the following might be of help:

    Accepted Solution

    I used JDBC-ODBC driver and included the values retrieved from registry in the following lines of code!

    String url = "jdbc:odbc:" + address + ";user=" + username + ";password=" + password;

    Author Closing Comment

    It finally got solved!

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    classnotfoundexception 3 29
    instanceof  operator in java 26 57
    JKS to store upstart data 2 53
    JAVA part two 5 18
    After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
    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…
    This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
    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 …

    755 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

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now