Someone else provided you with jcml entries.  Here is some code to go with
it:

   Connection connection = ((DataSource)new
InitialContext().lookup("java:comp/env/jdbc/OracleDB")).getConnection();
   Statement stmt = connection.createStatement();
   ResultSet rs = stmt.executeQuery("SELECT sysdate from dual");
   if (rs.next())
      {
       result = rs.getString(1);
      } // end if
         rs.close();
         stmt.close();
   connection.close();

   return result;


----- Original Message -----
From: "Chris Dole" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 27, 2001 1:47 AM
Subject: [JBoss-user] Code to get connection from connection pool


> Hello,
>
> I'm writing a stateless session bean and need to get a connection to my
> connection pool. Does anyone have a code snippet for how to do this?
> Specifically, what is the URL to use in the call to either or both of:
>
> DriverManager.getConnection("jdbc:xxx:yyy:MyPoolName")
>
> or to:
>
> DataSource ds = (DataSource)(new
> InitialContext()).lookup("java:xxx/yyy/zzz/MyPoolName")
>
> Is any one of the above preferable over the other? I know that DataSource
> is newer...
>
> Any help much appreciated!
>
> Thanks,
> Chris
>
>
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-user
>


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to