May 11, 2006 #1 jetec Technical User May 2, 2006 17 US how can I utilized a Data source from a java bean? Or do i need to redifine my connection within the class? Thanks JE
how can I utilized a Data source from a java bean? Or do i need to redifine my connection within the class? Thanks JE
May 11, 2006 1 #2 sedj Programmer Aug 6, 2002 5,610 You just use JNDI (javax.naming package) : // Obtain a JNDI javax.naming.Context object Context ctx = new InitialContext(); // Retrieve a DataSource object using JNDI DataSource ds = (DataSource)ctx.lookup("java:comp/env/myDSName"); -------------------------------------------------- Free Java/J2EE Database Connection Pooling Software http://www.primrose.org.uk Upvote 0 Downvote
You just use JNDI (javax.naming package) : // Obtain a JNDI javax.naming.Context object Context ctx = new InitialContext(); // Retrieve a DataSource object using JNDI DataSource ds = (DataSource)ctx.lookup("java:comp/env/myDSName"); -------------------------------------------------- Free Java/J2EE Database Connection Pooling Software http://www.primrose.org.uk
May 18, 2006 Thread starter #3 jetec Technical User May 2, 2006 17 US Thanks sedj! I did not know I could actually do that, i wasn't sure if it was tomcat specific code. As you can tell, i'm new to jsp/java,tomcat. Thanks! JE Upvote 0 Downvote
Thanks sedj! I did not know I could actually do that, i wasn't sure if it was tomcat specific code. As you can tell, i'm new to jsp/java,tomcat. Thanks! JE