Hello Andre,

Tuesday, May 21, 2002, 3:47:57 PM, you wrote:

AS> Hi,

AS>   How I can access a database from a connection ?
AS>   Looking at the j2ee connector spec I can find the
AS> first steps to do this connection are :

AS>       Context initctx = new InitialContext();

javax.sql.DataSource datasource = (DataSource)initctx.lookup("java:/DefaultDS");
java.sql.Connection dbConnection = datasource.getConnection();

That's it. Enjoy!

alex

AS>       ConnectionFactory cfx = (ConnectionFactory)
AS> initctx.lookup("java:/DefaultDS");
AS>       javax.resource.cci.Connection cx =
AS> cfx.getConnection();


AS>   Ok. But how I can use this cx variable to get a
AS> java.sql.Connection to then make my database calls ?

AS>       java.sql.Connection con = ???;
AS>       Statement st = con.createStatement();
AS>       java.sql.ResultSet rs = st.executeQuery("SELECT
AS> * from employee");
AS>       while (rs.next()) {
AS>         ...
AS>       }
AS>       st.close();
AS>       con.close();
AS>       cx.close();

AS>   TIA.

AS>   Andre S.

AS> __________________________________________________
AS> Do You Yahoo!?
AS> LAUNCH - Your Yahoo! Music Experience
AS> http://launch.yahoo.com

AS> _______________________________________________________________

AS> Don't miss the 2002 Sprint PCS Application Developer's Conference
AS> August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm

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

-- 
Best regards,
 Alex Loubyansky



_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm

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

Reply via email to