I'm working in a project based on struts where we use Websphere 5.1 Application Server, with DB2 v9.0 as database server. We are trying to use Datasource via JNDI, but we can't get it working properly.
I've defined a new DB2 JDBC Provider in the server configuration file, and a DataSource that uses it with the following parameters:
In this code, everything seems to work, but I've never received the message "Connection OK", neither the stack trace of any exception, and the servlet that uses it throws this error: [ServletException in ublica/menu.jsp] null'
Anybody has an idea of what can happen to this code, or the server? I'm need this problem sorted shortly, or I'll kill myself
Hi, Following things you can check for- 1) Have you tested the whether the datasource is working fine using the "test connection" option in Administration console ? 2) Secondly if you are writing this code as a server side program which is going to run on the websphere server machine then just do the new InitialContext(). That would be sufficient. 3)
// I also tried with "java:comp/env/TestDataSource"
, I think you should be using "java:comp/env/jdbc/TestDataSource" instead provided that your <res-ref-name> element in <resource-ref> has value "jdbc/TestDataSource". hope this helps Amit