This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin for Android App Development and have Peter Sommerhoff on-line!
See this thread for details.
Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

jdbc simple connection pool problem  RSS feed

 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone, trying to do a simple connection pooling example. This is my code and the error message I get. I am using visual age, and running websphere test environment in it. Also, if it means something I am using running my app with struts as the controller.......
in init method of servlet that gets executed while websphere it starting up, i say -->
org.gjt.mm.mysql.jdbc2.optional.MysqlDataSource ds = new org.gjt.mm.mysql.jdbc2.optional.MysqlDataSource();
ds.setUser(dbLogin);
ds.setPassword(dbPassword);
ds.setServerName(dbServer);
ds.setDatabaseName("docserver");
ds.setUrl(dbUrl);
ds.setPortNumber(8080);
try {
Context ctx = new InitialContext();
ctx.bind("jdbc/docserverDB", ds);
} catch (NamingException nme) {
nme.printStackTrace();
}
it throws the following exception on the line ..new InitialContext();
javax.naming.ConfigurationException: URLToObjectFacility.badProtocoldocserver:1099
So I added the following lines in.
Hashtable hash = new Hashtable();
hash.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.ejs.ns.jndi.CNInitialContextFactory");
and then changed the line saying new InitialContext(hash);
I then still got the same exception.
Can anyone please shed some light as to what I'm doing wrong.
All I want is to be able to use the connection pooling part of jdbc 2.0 (or 3.0) using mySql driver in my webapp.
Thanks for your replies
Darryl
 
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Soryy but I have no idea. I am using connection pooling, but using the class that I downloaded in www.javaexchange.com (DBConnectionBroket). it is really easy..
hope it helps..
 
Squanch that. And squanch this tiny ad:
Programmatically Create PDF Using Free Spire.PDF with Java
https://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!