d***@uniandes.edu.co
2007-10-04 20:03:03 UTC
I´m trying to connect a java based program with DB2 but have been unable to do so. DB2 is installed on a virtual machine.
The facts:
- Java program is on Eclipse
- Eclipse is on my host computer which is a windows xp machine
- DB2 is installed on a Linux (Red Hat) Virtual Machine inside my windows xp machine
- Virtual Machine has IP address 192.168.152.128
- I have a DB created in the virtual machine, the DB´s name is PHONEDB
- The instance owner is inst00 and the password is passw0rd
- I´ve installed the runtime client on my windows machine with the same version and same fix pack as the DB2 thats installed in my virtual machine
- I´ve configured the environment variables correctly on my windows machine
- I added the corresponding jdbc type 2 (db2java.jar) in the windows environment variables and in eclipse as a library in the java build path
- I´m able to ping the Virtual Machine, connect to it and catalog the PHONEDB data base
- I can access the DB from my windows machine through CLP. I can run queries against it with no problems.
What I´m unable to do is make my java program connect to the DB.
Code:
// load the DB2 Driver
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver"); //This works
// establish a connection to DB2
String url = jdbc:db2://192.168.152.128:50000/PHONEDB:user=inst00;password=passw0rd";
Connection conexion = DriverManager.getConnection(url);
The error I keep getting is this one:
java.sql.SQLException: No suitable driver found for jdbc:db2://192.168.152.128:50000/PHONEDB:user=inst00;password=passw0rd
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at conexion.Connect.main(Connect.java:19)
What I think I have to do but haven´t been able:
- Try using port 6789 with DB2 but I don´t know how to enable this port for listening
- Writing the string in some other strange way that I haven´t been able to do so
Thanks in advance
The facts:
- Java program is on Eclipse
- Eclipse is on my host computer which is a windows xp machine
- DB2 is installed on a Linux (Red Hat) Virtual Machine inside my windows xp machine
- Virtual Machine has IP address 192.168.152.128
- I have a DB created in the virtual machine, the DB´s name is PHONEDB
- The instance owner is inst00 and the password is passw0rd
- I´ve installed the runtime client on my windows machine with the same version and same fix pack as the DB2 thats installed in my virtual machine
- I´ve configured the environment variables correctly on my windows machine
- I added the corresponding jdbc type 2 (db2java.jar) in the windows environment variables and in eclipse as a library in the java build path
- I´m able to ping the Virtual Machine, connect to it and catalog the PHONEDB data base
- I can access the DB from my windows machine through CLP. I can run queries against it with no problems.
What I´m unable to do is make my java program connect to the DB.
Code:
// load the DB2 Driver
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver"); //This works
// establish a connection to DB2
String url = jdbc:db2://192.168.152.128:50000/PHONEDB:user=inst00;password=passw0rd";
Connection conexion = DriverManager.getConnection(url);
The error I keep getting is this one:
java.sql.SQLException: No suitable driver found for jdbc:db2://192.168.152.128:50000/PHONEDB:user=inst00;password=passw0rd
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at conexion.Connect.main(Connect.java:19)
What I think I have to do but haven´t been able:
- Try using port 6789 with DB2 but I don´t know how to enable this port for listening
- Writing the string in some other strange way that I haven´t been able to do so
Thanks in advance