aspose file tools*
The moose likes Websphere and the fly likes exception when using WAS connection pool Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "exception when using WAS connection pool" Watch "exception when using WAS connection pool" New topic
Author

exception when using WAS connection pool

Jian Yi
Ranch Hand

Joined: Feb 01, 2002
Posts: 127
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

Joined: Jul 11, 2002
Posts: 219
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...


Best Regards,<br />Nagendra Prasad.
Jian Yi
Ranch Hand

Joined: Feb 01, 2002
Posts: 127
Thanks a lot!!! It's working!!! wow~~~
Jian Yi
Ranch Hand

Joined: Feb 01, 2002
Posts: 127
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

Joined: Jul 18, 2003
Posts: 22
I think DataSource handling is Websphere's job in this case ...
Bhupesh
Nagendra Prasad
Ranch Hand

Joined: Jul 11, 2002
Posts: 219
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!
 
 
subject: exception when using WAS connection pool