Reputation: 21
I'm trying to connect to a DB2 database using JDBC. Therefore I downloaded the DB2 driver db2jcc.jar
and added the path to the classpath while compiling and running my application (I'm not using an IDE).
The following is the source of my Test-Application:
import java.sql.*;
public class TestApp {
public static void main(String[] args){
try {
Class.forName("com.ibm.db2.jcc.DB2Driver");
}
catch (Exception e) {
System.out.println(e);
}
}
}
Does anybody know, where my problem is?
Upvotes: 0
Views: 2019
Reputation: 10959
Try compiling:
'javac -cp ".;(path)/db2jcc.jar;(path)/db2jcc_license_cu.jar" TestApp.java'
Then running
'java -cp ".;(path)/db2jcc.jar;(path)/db2jcc_license_cu.jar" TestApp'
You only need quotes if spaces in the file/path names also.
Upvotes: 1