Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

query datasource with jndi

 
Anonymous
Ranch Hand
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
Hi guys,
I hope you can help me. i installed a datasource to a sybase database. When I start the jboss server (v. 3.0.6)I
get the following message:
2003-05-08 10:39:54,861 INFO [org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.contentBoxDS] Bound connection factory for resource adapter 'JBoss LocalTransaction JDBC Wrapper' to JNDI name 'java:/contentBoxDS'

When i try now to query this datasource via the following code from a servlet in the same vm:
DataSource ds = null;
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,resource.getString(INITIAL_CONTEXT));
p.put(Context.PROVIDER_URL,resource.getString(PROVIDER_URL));
p.put(Context.URL_PKG_PREFIXES,resource.getString(URL_PKG_PREFIXES));
p.put("jnp.socketFactory",resource.getString(SOCKET_FACTORY));
p.put("jnp.timeout",resource.getString(TIMEOUT));
p.put("jnp.sotimeout",resource.getString(SOTIMEOUT));
try{
Context ctx = new InitialContext(p);
ds = (DataSource)ctx.lookup("java:/contentBoxDS");
}catch(Exception e){
...
}

i get the message:

javax.naming.NameNotFoundException: contentBoxDS not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)

do you have any idea ?

Thx in advance
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic