Web Trenches

JDBC-ODBC Bridge on Lucee



First, you will need to extract and repackage the appropriate classes and DLL from a Java 1.7 install. This section is adapted from http://bigfatball.blogspot.it/2016/03/how-to-enable-jdbc-odbc-bridge-for-jdk-8.html.

  1. Download a JDK 7 or JRE 7 and install it.
  2. Goto JRE\lib folder and find the rt.jar
  3. Unzip it (if you have WinRAR installed) or you can rename it to rt.zip and unzip it.
  4. Copy sun\jdbc and sun\security\action folders out to a new folder, keep the folder structure. i.e., you should have the folder structure like below:
    • Sun –> Security –> Action
    • Sun –> JDBC
  5. Open a CMD window. Go to the parent folder of Sun folder. Run the command:jar -cvf jdbc.jar sun

    NOTE: You may need the full path to jar.exe in here. Example: “c:\Program Files\Java\jdk1.7.x\bin\jar.exe” -cvf jdbc.jar sun

  6. The above command will create a file named jdbc.jar
  7. Copy JDBC.jar to your Lucee lib/ext folder.  This is typically at C:\lucee\jdk\jre\lib\ext.
  8. Copy jdbcodbc.dll from JRE\bin  of your JRE 7 installation to Lucee’s JRE\bin. This is typically at C:\lucee\jdk\jre\bin.
  9. Restart Lucee.

You should now have the classes available to set up an ODBC datasource in Lucee.

  1. Confirm that your ODBC datasource is set up in the Windows ODBC manager.
  2. Go to your Lucee server or web admin.
  3. Select Datasource from the left menu.
  4. Under “Create new datasource”, give it a name and select “Other-JDBC Driver” and click Create.
  5. Add a username of “System” and leave password blank.
  6. For Class, enter “sun.jdbc.odbc.JdbcOdbcDriver”.
  7. For Connect string, enter “jdbc:odbc:<odbc data source name>”. For example, “jdbc:odbc:mydsn”. This must exactly match the ODBC datasource name in Windows.
  8. Click UPDATE.
  9. After submission, you should see an OK next to your new datasource and it is available for use.

DISCLAIMER: I have no idea if this violates any licensing for Java.

One Reply to “JDBC-ODBC Bridge on Lucee”

Leave a Reply

Your email address will not be published. Required fields are marked *