• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Database Connection Fails

 
Michael Scott
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When the code below runs, the connect() method fails with an SQLSTATE of 08004 and the following error occurs:
com.ibm.ivj.eab.dab.DAException:
NO_SUITABLE_DRIVER Unable to load DAMessages
ResourceBundle.COM.ibm.db2.jdbc.app.DB2Driver
I've verified that the username and password are correct and that the following packages are imported:
import java.sql.*;
import com.ibm.ivj.eab.dab.*;
import COM.ibm.db2.jdbc.app.*;
I'd appreciate any ideas on why the connection fails. Thanks.
_______________________________________________
private com.ibm.ivj.eab.dab.DatastoreJDBC getCRDatastore() {
return crDatastore;
}
public void connectCurrentDatastore() throws com.ibm.ivj.eab.dab.DAException {
getCRDatastore().setDriver("COM.ibm.db2.jdbc.app.DB2Driver");
String serverURL = new String("jdbc b2:tsoca");
getCRDatastore().setURL(serverURL);
java.util.Properties userInfo = new java.util.Properties();
String username = new String("myUsername");
pw = "myPW";
userInfo.put("user", username.toString());
userInfo.put("password", pw);
getCRDatastore().setProperties(userInfo);
try {
getCRDatastore().connect(); // <=== ERROR
} catch (com.ibm.ivj.eab.dab.DAException x) {
try {
if (x.getSQLException().getSQLState().equals("08004"))
:
< code continues >
 
Murali Nanchala
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check if COM.ibm.db2.jdbc.app.* is in your classpath. Since you are essentially doing a type code in using , it will not throw any compiler errors if you are missing the library.
[ May 20, 2003: Message edited by: Murali Nanchala ]
 
Michael Scott
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure that I understand your response. I have verified that COM.ibm.db2.jdbc.app.* is in the classpath but the error still occurs.
 
Michael Scott
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I should clarify that I'm trying to run my applet in an IDE called VisualAge. The class of the applet is in the same directory as the DB2 classes. I have one further question though. I've read a number of forum entries suggesting that some JDBC connection problems can be resolved by running the usejdbc2.bat file in the java12 directory after first shutting down all DB2 services. Is it possible that this might resolve the connection problem that I've described? I'm reluctant to run usejdbc2.bat simply because I can now establish a database connection through DB2 and do not want to lose this capability. Any suggestions?
Thanks very much.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic