wood burning stoves 2.0*
The moose likes JDBC and the fly likes getConnection error??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "getConnection error???" Watch "getConnection error???" New topic
Author

getConnection error???

cenk kizildag
Greenhorn

Joined: May 18, 2007
Posts: 16
Hi,

I m using DB2 and RAD 7.0. Here is my stack:
*** Starting the server ***
************ Start Display Current Environment ************
WebSphere Platform 5.1 [BASE 5.1.1.12 cf120637.02] [JDK 1.4.2 cn1420-20040626] running with process name localhost\localhost\server1 and process id 5184
Host Operating System is Windows XP, version 5.1
Java version = J2RE 1.4.2 IBM Windows 32 build cn142-20060824 (SR6) (JIT enabled: jitc), Java Compiler = jitc, Java VM name = Classic VM
was.install.root = C:/Program Files/IBM/SDP70/runtimes/base_v51
user.install.root = C:/Program Files/IBM/SDP70/runtimes/base_v51
Java Home = C:\Program Files\IBM\SDP70\runtimes\base_v51\java\jre
ws.ext.dirs = C:/Program Files/IBM/SDP70/runtimes/base_v51/java/lib;C:/Program Files/IBM/SDP70/runtimes/base_v51/classes;C:/Program Files/IBM/SDP70/runtimes/base_v51/classes;C:/Program Files/IBM/SDP70/runtimes/base_v51/lib;C:/Program Files/IBM/SDP70/runtimes/base_v51/lib/ext;C:/Program Files/IBM/SDP70/runtimes/base_v51/web/help;C:/Program Files/IBM/SDP70/runtimes/base_v51/deploytool/itp/plugins/com.ibm.etools.ejbdeploy/runtime
Classpath = C:/Program Files/IBM/SDP70/runtimes/base_v51/properties;C:/Program Files/IBM/SDP70/runtimes/base_v51/properties;C:/Program Files/IBM/SDP70/runtimes/base_v51/lib/bootstrap.jar;C:/Program Files/IBM/SDP70/runtimes/base_v51/lib/j2ee.jar;C:/Program Files/IBM/SDP70/runtimes/base_v51/lib/lmproxy.jar;C:/Program Files/IBM/SDP70/runtimes/base_v51/lib/urlprotocols.jar;C:/Program Files/IBM/SDP70Shared/plugins/com.ibm.etools.websphere.tools.v51_6.1.1.v200611161118/wteServers.jar;C:/Program Files/IBM/SDP70Shared/plugins/com.ibm.ws.ast.st.core_6.1.1.v200611161118/stcore.jar;file:C:/Program Files/IBM/SDP70Shared/plugins/com.ibm.ws.ast.st.core.util_6.1.1.v200611161118.jar!/stcoreUtil.jar
Java Library path = C:\Program Files\IBM\SDP70\runtimes\base_v51\bin;C:\Program Files\IBM\SDP70\runtimes\base_v51\java/bin;C:\Program Files\IBM\SDP70\runtimes\base_v51\java/jre/bin;C:\Program Files\IBM\SDP70\jdk\jre\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\PROGRA~1\IBM\SQLLIB\BIN;C:\PROGRA~1\IBM\SQLLIB\FUNCTION;C:\PROGRA~1\IBM\SQLLIB\SAMPLES\REPL;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Common Files\Ahead\Lib
************* End Display Current Environment *************
[28.08.2007 12:15:57:578 EEST] 3d02b654 ManagerAdmin I TRAS0017I: The startup trace state is *=all=disabled.
[28.08.2007 12:15:58:062 EEST] 3d02b654 AdminInitiali A ADMN0015I: AdminService initialized
[28.08.2007 12:15:58:531 EEST] 3d02b654 Configuration A SECJ0215I: Successfully set JAAS login provider configuration class to com.ibm.ws.security.auth.login.Configuration.
[28.08.2007 12:15:58:578 EEST] 3d02b654 SecurityDM I SECJ0231I: The Security component's FFDC Diagnostic Module com.ibm.ws.security.core.SecurityDM registered successfully: true.
[28.08.2007 12:15:58:703 EEST] 3d02b654 SecurityCompo I SECJ0309I: Java 2 Security is disabled.
[28.08.2007 12:15:58:703 EEST] 3d02b654 SecurityCompo I SECJ0212I: WCCM JAAS configuration information successfully pushed to login provider class.
[28.08.2007 12:15:58:719 EEST] 3d02b654 SecurityCompo I SECJ0240I: Security service initialization completed successfully
[28.08.2007 12:15:58:719 EEST] 3d02b654 JMSRegistrati A MSGS0602I: WebSphere Embedded Messaging Client only has been installed
[28.08.2007 12:16:01:031 EEST] 3d02b654 CacheServiceI I DYNA0048I: WebSphere Dynamic Cache initialized successfully.
[28.08.2007 12:16:01:922 EEST] 3d02b654 JMXSoapAdapte A ADMC0013I: SOAP connector available at port 8880
[28.08.2007 12:16:01:938 EEST] 3d02b654 SecurityCompo I SECJ0243I: Security service started successfully
[28.08.2007 12:16:01:938 EEST] 3d02b654 SecurityCompo I SECJ0210I: Security enabled false
[28.08.2007 12:16:02:594 EEST] 3d02b654 ApplicationMg A WSVR0200I: Starting application: IBMUTC
[28.08.2007 12:16:03:625 EEST] 3d02b654 WebContainer A SRVE0161I: IBM WebSphere Application Server - Web Container. Copyright IBM Corp. 1998-2002
[28.08.2007 12:16:03:625 EEST] 3d02b654 WebContainer A SRVE0162I: Servlet Specification Level: 2.3
[28.08.2007 12:16:03:625 EEST] 3d02b654 WebContainer A SRVE0163I: Supported JSP Specification Level: 1.2
[28.08.2007 12:16:03:688 EEST] 3d02b654 WebContainer A SRVE0169I: Loading Web Module: Universal Test Client.
[28.08.2007 12:16:03:875 EEST] 3d02b654 WebGroup I SRVE0180I: [Universal Test Client] [/UTC] [Servlet.LOG]: JSP 1.2 Processor: init
[28.08.2007 12:16:03:906 EEST] 3d02b654 WebGroup I SRVE0180I: [Universal Test Client] [/UTC] [Servlet.LOG]: SimpleFileServlet: init
[28.08.2007 12:16:03:938 EEST] 3d02b654 ApplicationMg A WSVR0221I: Application started: IBMUTC
[28.08.2007 12:16:03:938 EEST] 3d02b654 ApplicationMg A WSVR0200I: Starting application: registrationEAR
[28.08.2007 12:16:03:984 EEST] 3d02b654 WebContainer A SRVE0169I: Loading Web Module: registration.
[28.08.2007 12:16:04:109 EEST] 3d02b654 WebGroup I SRVE0180I: [registration] [/registration] [Servlet.LOG]: JSP 1.2 Processor: init
[28.08.2007 12:16:04:438 EEST] 3d02b654 WebGroup I SRVE0180I: [registration] [/registration] [Servlet.LOG]: SimpleFileServlet: init
[28.08.2007 12:16:04:438 EEST] 3d02b654 WebGroup I SRVE0180I: [registration] [/registration] [Servlet.LOG]: InvokerServlet: init
[28.08.2007 12:16:04:469 EEST] 3d02b654 WebGroup I SRVE0180I: [registration] [/registration] [Servlet.LOG]: action: init
[28.08.2007 12:16:04:484 EEST] 3d02b654 PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
[28.08.2007 12:16:04:484 EEST] 3d02b654 PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
[28.08.2007 12:16:04:906 EEST] 3d02b654 PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='registration.resources.ApplicationResources', returnNull=true
[28.08.2007 12:16:04:906 EEST] 3d02b654 ApplicationMg A WSVR0221I: Application started: registrationEAR
[28.08.2007 12:16:04:938 EEST] 3d02b654 HttpTransport A SRVE0171I: Transport http is listening on port 9.080.
[28.08.2007 12:16:07:125 EEST] 3d02b654 HttpTransport A SRVE0171I: Transport https is listening on port 9.443.
[28.08.2007 12:16:07:141 EEST] 3d02b654 RMIConnectorC A ADMC0026I: RMI Connector available at port 2809
[28.08.2007 12:16:07:188 EEST] 3d02b654 WsServer A WSVR0001I: Server server1 open for e-business
[28.08.2007 12:16:11:984 EEST] 6527f655 WebGroup I SRVE0180I: [registration] [/registration] [Servlet.LOG]: /index.jsp: init
[28.08.2007 12:16:12:000 EEST] 6527f655 PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
[28.08.2007 12:16:12:156 EEST] 6527f655 PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
[28.08.2007 12:16:12:219 EEST] 6527f655 PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
[28.08.2007 12:16:12:266 EEST] 6527f655 PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
[28.08.2007 12:16:12:266 EEST] 6527f655 PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
[28.08.2007 12:16:12:281 EEST] 6527f655 PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
[28.08.2007 12:17:07:953 EEST] 6527f655 SystemErr R user:admin
[28.08.2007 12:17:07:953 EEST] 6527f655 SystemErr R pass:admin
[28.08.2007 12:17:08:000 EEST] 6527f655 SystemErr R Could not connect to database.
COM.ibm.db2.jdbc.app.DB2Driver
[28.08.2007 12:17:08:188 EEST] 6527f655 WebGroup I SRVE0180I: [registration] [/registration] [Servlet.LOG]: /manageusers.jsp: init
[28.08.2007 12:17:08:203 EEST] 6527f655 PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.taglib.logic.LocalStrings', returnNull=true


and here is my code below;

...
String driverClass = ResourceManager.getString("database.driver");
String dbUrl = ResourceManager.getString("database.url");
String dbUser = ResourceManager.getString("database.user");
String dbPassword = ResourceManager.getString("database.password");
try{
Class.forName(driverClass).newInstance();
con = DriverManager.getConnection(dbUrl,dbUser,dbPassword);
}catch(Exception exp){
System.err.println("Could not connect to database.\n" +exp.getMessage());
}
...
Herman Schelti
Ranch Hand

Joined: Jul 17, 2006
Posts: 387
What's the class of your exception: try exp.getClass()

Herman
cenk kizildag
Greenhorn

Joined: May 18, 2007
Posts: 16
*** Starting the server ***
************ Start Display Current Environment ************
WebSphere Platform 5.1 [BASE 5.1.1.12 cf120637.02] [JDK 1.4.2 cn1420-20040626] running with process name localhost\localhost\server1 and process id 5828
Host Operating System is Windows XP, version 5.1
Java version = J2RE 1.4.2 IBM Windows 32 build cn142-20060824 (SR6) (JIT enabled: jitc), Java Compiler = jitc, Java VM name = Classic VM
was.install.root = C:/Program Files/IBM/SDP70/runtimes/base_v51
user.install.root = C:/Program Files/IBM/SDP70/runtimes/base_v51
Java Home = C:\Program Files\IBM\SDP70\runtimes\base_v51\java\jre
ws.ext.dirs = C:/Program Files/IBM/SDP70/runtimes/base_v51/java/lib;C:/Program Files/IBM/SDP70/runtimes/base_v51/classes;C:/Program Files/IBM/SDP70/runtimes/base_v51/classes;C:/Program Files/IBM/SDP70/runtimes/base_v51/lib;C:/Program Files/IBM/SDP70/runtimes/base_v51/lib/ext;C:/Program Files/IBM/SDP70/runtimes/base_v51/web/help;C:/Program Files/IBM/SDP70/runtimes/base_v51/deploytool/itp/plugins/com.ibm.etools.ejbdeploy/runtime
Classpath = C:/Program Files/IBM/SDP70/runtimes/base_v51/properties;C:/Program Files/IBM/SDP70/runtimes/base_v51/properties;C:/Program Files/IBM/SDP70/runtimes/base_v51/lib/bootstrap.jar;C:/Program Files/IBM/SDP70/runtimes/base_v51/lib/j2ee.jar;C:/Program Files/IBM/SDP70/runtimes/base_v51/lib/lmproxy.jar;C:/Program Files/IBM/SDP70/runtimes/base_v51/lib/urlprotocols.jar;C:/Program Files/IBM/SDP70Shared/plugins/com.ibm.etools.websphere.tools.v51_6.1.1.v200611161118/wteServers.jar;C:/Program Files/IBM/SDP70Shared/plugins/com.ibm.ws.ast.st.core_6.1.1.v200611161118/stcore.jar;file:C:/Program Files/IBM/SDP70Shared/plugins/com.ibm.ws.ast.st.core.util_6.1.1.v200611161118.jar!/stcoreUtil.jar
Java Library path = C:\Program Files\IBM\SDP70\runtimes\base_v51\bin;C:\Program Files\IBM\SDP70\runtimes\base_v51\java/bin;C:\Program Files\IBM\SDP70\runtimes\base_v51\java/jre/bin;C:\Program Files\IBM\SDP70\jdk\jre\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\PROGRA~1\IBM\SQLLIB\BIN;C:\PROGRA~1\IBM\SQLLIB\FUNCTION;C:\PROGRA~1\IBM\SQLLIB\SAMPLES\REPL;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Common Files\Ahead\Lib
************* End Display Current Environment *************
[28.08.2007 13:00:04:797 EEST] 3ab2f37f ManagerAdmin I TRAS0017I: The startup trace state is *=all=disabled.
[28.08.2007 13:00:05:141 EEST] 3ab2f37f AdminInitiali A ADMN0015I: AdminService initialized
[28.08.2007 13:00:05:688 EEST] 3ab2f37f Configuration A SECJ0215I: Successfully set JAAS login provider configuration class to com.ibm.ws.security.auth.login.Configuration.
[28.08.2007 13:00:05:734 EEST] 3ab2f37f SecurityDM I SECJ0231I: The Security component's FFDC Diagnostic Module com.ibm.ws.security.core.SecurityDM registered successfully: true.
[28.08.2007 13:00:05:938 EEST] 3ab2f37f SecurityCompo I SECJ0309I: Java 2 Security is disabled.
[28.08.2007 13:00:05:938 EEST] 3ab2f37f SecurityCompo I SECJ0212I: WCCM JAAS configuration information successfully pushed to login provider class.
[28.08.2007 13:00:05:953 EEST] 3ab2f37f SecurityCompo I SECJ0240I: Security service initialization completed successfully
[28.08.2007 13:00:05:953 EEST] 3ab2f37f JMSRegistrati A MSGS0602I: WebSphere Embedded Messaging Client only has been installed
[28.08.2007 13:00:08:234 EEST] 3ab2f37f CacheServiceI I DYNA0048I: WebSphere Dynamic Cache initialized successfully.
[28.08.2007 13:00:09:125 EEST] 3ab2f37f JMXSoapAdapte A ADMC0013I: SOAP connector available at port 8880
[28.08.2007 13:00:09:141 EEST] 3ab2f37f SecurityCompo I SECJ0243I: Security service started successfully
[28.08.2007 13:00:09:141 EEST] 3ab2f37f SecurityCompo I SECJ0210I: Security enabled false
[28.08.2007 13:00:09:547 EEST] 3ab2f37f ApplicationMg A WSVR0200I: Starting application: IBMUTC
[28.08.2007 13:00:09:984 EEST] 3ab2f37f WebContainer A SRVE0161I: IBM WebSphere Application Server - Web Container. Copyright IBM Corp. 1998-2002
[28.08.2007 13:00:10:078 EEST] 3ab2f37f WebContainer A SRVE0162I: Servlet Specification Level: 2.3
[28.08.2007 13:00:10:078 EEST] 3ab2f37f WebContainer A SRVE0163I: Supported JSP Specification Level: 1.2
[28.08.2007 13:00:10:203 EEST] 3ab2f37f WebContainer A SRVE0169I: Loading Web Module: Universal Test Client.
[28.08.2007 13:00:10:609 EEST] 3ab2f37f WebGroup I SRVE0180I: [Universal Test Client] [/UTC] [Servlet.LOG]: JSP 1.2 Processor: init
[28.08.2007 13:00:10:734 EEST] 3ab2f37f WebGroup I SRVE0180I: [Universal Test Client] [/UTC] [Servlet.LOG]: SimpleFileServlet: init
[28.08.2007 13:00:10:766 EEST] 3ab2f37f ApplicationMg A WSVR0221I: Application started: IBMUTC
[28.08.2007 13:00:10:766 EEST] 3ab2f37f ApplicationMg A WSVR0200I: Starting application: registrationEAR
[28.08.2007 13:00:10:812 EEST] 3ab2f37f WebContainer A SRVE0169I: Loading Web Module: registration.
[28.08.2007 13:00:10:953 EEST] 3ab2f37f WebGroup I SRVE0180I: [registration] [/registration] [Servlet.LOG]: JSP 1.2 Processor: init
[28.08.2007 13:00:11:219 EEST] 3ab2f37f WebGroup I SRVE0180I: [registration] [/registration] [Servlet.LOG]: SimpleFileServlet: init
[28.08.2007 13:00:11:219 EEST] 3ab2f37f WebGroup I SRVE0180I: [registration] [/registration] [Servlet.LOG]: InvokerServlet: init
[28.08.2007 13:00:11:266 EEST] 3ab2f37f WebGroup I SRVE0180I: [registration] [/registration] [Servlet.LOG]: action: init
[28.08.2007 13:00:11:297 EEST] 3ab2f37f PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
[28.08.2007 13:00:11:297 EEST] 3ab2f37f PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
[28.08.2007 13:00:11:703 EEST] 3ab2f37f PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='registration.resources.ApplicationResources', returnNull=true
[28.08.2007 13:00:11:703 EEST] 3ab2f37f ApplicationMg A WSVR0221I: Application started: registrationEAR
[28.08.2007 13:00:11:734 EEST] 3ab2f37f HttpTransport A SRVE0171I: Transport http is listening on port 9.080.
[28.08.2007 13:00:13:984 EEST] 3ab2f37f HttpTransport A SRVE0171I: Transport https is listening on port 9.443.
[28.08.2007 13:00:14:078 EEST] 3ab2f37f RMIConnectorC A ADMC0026I: RMI Connector available at port 2809
[28.08.2007 13:00:14:125 EEST] 3ab2f37f WsServer A WSVR0001I: Server server1 open for e-business
[28.08.2007 13:00:16:453 EEST] 6262b37e WebGroup I SRVE0180I: [registration] [/registration] [Servlet.LOG]: /index.jsp: init
[28.08.2007 13:00:16:453 EEST] 6262b37e PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
[28.08.2007 13:00:16:500 EEST] 6262b37e PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
[28.08.2007 13:00:16:500 EEST] 6262b37e PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
[28.08.2007 13:00:16:625 EEST] 6262b37e PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
[28.08.2007 13:00:16:641 EEST] 6262b37e PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
[28.08.2007 13:00:16:641 EEST] 6262b37e PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
[28.08.2007 13:00:27:047 EEST] 6262b37e SystemErr R user:admin
[28.08.2007 13:00:27:047 EEST] 6262b37e SystemErr R pass:admin
[28.08.2007 13:00:27:078 EEST] 6262b37e SystemErr R Could not connect to database.
class java.lang.ClassNotFoundException
[28.08.2007 13:00:27:312 EEST] 6262b37e WebGroup I SRVE0180I: [registration] [/registration] [Servlet.LOG]: /manageusers.jsp: init
[28.08.2007 13:00:27:312 EEST] 6262b37e PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.taglib.logic.LocalStrings', returnNull=true
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

...or better still just output the stacktrace.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Ah - so it's caused by a ClassNotFoundException. Looks like your driver is not in the classpath, or the "driverClass" value is wrong. Check those.
[ August 28, 2007: Message edited by: Paul Sturrock ]
cenk kizildag
Greenhorn

Joined: May 18, 2007
Posts: 16
here is my applicationresources.properties file;

#database connection properties
database.driver = com.ibm.db2.jdbc.app.DB2Driver
database.url = jdbc:db2:YES
database.user = db2admin
database.password = db2admin


#User operations messages

save.user.null = User is null
retrieve.user.null = User is null
user.notFound = User not found
database.notConnected = Not connected to a database
login.failed = The supplied user name / password does not match
error.generic = An error prevented the operation. Error detail is:<br>{0}
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

I've not used DB2 in an age, but com.ibm.db2.jdbc.app.DB2Driver looks valid. Are you sure this is the value being used? (some debug will help here). Also, is this class in your classpath?
cenk kizildag
Greenhorn

Joined: May 18, 2007
Posts: 16
Hi,

I m new to struts and i dont know how to add driver to classpath?
How can i check this classpath?

any help please
Rama Dev
Greenhorn

Joined: Dec 03, 2004
Posts: 6
I think your driver name is incorrect. This is the reason for class not found
error.

database.driver = com.ibm.db2.jdbc.app.DB2Driver

The above should be: COM.ibm.db2.jdbc.app.DB2Driver
 
Consider Paul's rocket mass heater.
 
subject: getConnection error???
 
Similar Threads
unable to resolve exception
validation issues
WSAD is quitting with error in struts application startup
WSADIE V5.1.1 Debug Problem
Problem starting WTE in WSAD 5.0.1