How can I find out the names of the ODBC data sources available through the JDBC-ODBC driver?

John Zukowski

There is no Pure Java mechanism to get this information. If you don't mind locking yourself into the Microsoft VM, the following program demonstrates:

import com.ms.wfc.app.*;
public class ODBCSource {
  public static void main(String args[]) {
    RegistryKey regKey =
      Registry.CURRENT_USER.getSubKey
        ("SoftwareODBCODBC.INIODBC Data Sources");
    if (regKey != null) {
      String dsn[] = regKey.getValueNames();
      for(int i = 0;  i < dsn.length; i++) { 
        System.out.println(dsn[i]);
      }
    }
  }
}
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact