Hi
I've already set-up my database xml file and it's working correctly with my entity beans. If I need to get a JDBC Connection from the JBoss pool, what is the proper way to do it ? Currently i'm doing it like this but i dont know if this is the right way to go
Context context = new InitialContext();
ds = (DataSource) context.lookup("java:comp/env/jdbc/MyOwnDS");
Connection con = ds.getConnection();
And how shld i use transactions with the Connection object i've got ? Shld it be like this ?
UserTranaction ut = null;
InitialContext ctx = new InitialContext();
ut = (UserTranaction) ctx.lookup("UserTranaction");
tx.begin()
// Normal JDBC stuff here ??
ds = (DataSource) context.lookup("java:comp/env/jdbc/MyOwnDS");
Connection con = ds.getConnection();
con.prepareStatement();
........
// SQL statments executed, time to commit ?
if (ut.getStatus() == Status.STATUS_ACTIVE)
ut.commit();
Thanks in advance..:)
Shafei