Connecting to DB2 using JDBC

You will need the JDBC Type 4 driver, and the License File. These files should be in the same directory that your executable Java program is in, or else in your classpath.

If you are using a modern version of Java (1.4, possibly 1.3) you need to grant permission for the Java Runtime Environment (JRE) to allow TCP/IP socket connections.
Copy the following line into your java.policy file:

grant {permission java.net.SocketPermission "*", "connect, resolve";};

You can download a java.policy file here that is set up correctly.

Under Windows, the java.policy file is normally found in 2 places:

  • c:\program files\java\j2re1.4.x\lib\security (used by web browsers)
  • [java install directory]\jre\lib\security (used by command line)

    back