Accessing a File DSN from Java
ODBC data sources are a collection of settings that enable an ODBC driver to connect to a database. On Windows, they are configured using a GUI (ODBC Data Source Administrator) and stored in the Registry. When ODBC was first released on Windows, data sources were stored in a text file, and to provide backwards compatibility for applications that relied on a file-based data source, Microsoft provided File Data Sources. As the name implies, File Data Sources are text files that contain one ODBC data source. They are stored in a user's My Documents folder and have the file extension ".dsn". For example MyFileDSN.dsn.
Easysoft's JDBC-ODBC Bridge product enables a Java application to connect to an ODBC data source. Normally, the JDBC-ODBC Bridge connects to a registry-based data source or it's passed a connection string (which contains a series of ODBC attribute value pairs). However, a customer who needed Java access to an ODBC backend on a legacy system recently contacted us regarding the JDBC-ODBC bridge and File DSNs.
These steps describe how to access a File DSN from Java by using the JDBC-ODBC Bridge.
- Download the Easysoft JDBC-ODBC Bridge. (Registration required.)
- Install and license the Easysoft JDBC-ODBC Bridge on the machine where you created the File Data Source.
For installation instructions, see the Easysoft JDBC-ODBC Bridge documentation.
- Add the JDBC-ODBC Bridge client, EJOB.jar, to your Java application's store of third party JAR files / copy EJOB.jar to a folder that's on the application's internal CLASSPATH / add the EJOB.jar folder to the Java CLASSPATH.
EJOB.jar is installed in the following location on the machine where you install the Easysoft JDBC-ODBC Bridge:
The default location for <easysoft_install> is
<drive>:\Program Files (x86)\Easysoft Limited\Easysoft JDBC-ODBC Bridge.
- In your JDBC URL, use this syntax to connect to a FILE DSN: