Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

exception when using WAS connection pool

 
Jian Yi
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got this error when I tried to use Websphere connection pool.
java.sql.SQLException: Message file 'oracle.jdbc.dbaccess.Messages' is missing.
Did anybody get that? How do I fix it?
My code to use websphere connection pool is:
try {
java.util.Properties parms = new java.util.Properties();
parms.setProperty(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
javax.naming.Context ctx = new javax.naming.InitialContext(parms);
// look up the desired data source
DataSource ds = (javax.sql.DataSource) ctx.lookup("jdbc/VWDB_DS");
Connection con = ds.getConnection();
} catch (Exception ex) {
System.out.println(ex);
}
 
Nagendra Prasad
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jenny,
Looks like you are getting an SQL Exception and the code is not able to access the message file to tell you what the exception is.
This could be a problem with the way the JDBC Driver is installed.
Could you check that this file is available in the JDBC Driver zip file... If u are using Oracle, I presume u would have classes12.zip somewhere in your path...
 
Jian Yi
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot!!! It's working!!! wow~~~
 
Jian Yi
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Prasad,
Shall I close the DataSource and Context at the end? I know I need to close the connection. But not sure about those two.
Thanks,
Jenny
 
Bhupesh Kokate
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think DataSource handling is Websphere's job in this case ...
Bhupesh
 
Nagendra Prasad
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jenny,
Sorry was not tracking this post for some time.. you might have had all your queries resolved by now.. but a pointer all the same:
the datasource is generally initialised the first time anything is needed
from the system.
Then we use it to obtain the connections we need.
We close the connections etc once we are done with the 'SQL' bit in the
code.
typically this is the logic used: (Please not this is sytactically incomplete)

So... you dont do anything to the datasource or the initial context. You limit your activities to the connections!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic