This content has been marked as final.
Show 4 replies
-
1. Re: using others DBMS in jboss
wdfink Jul 4, 2006 5:31 AM (in response to greenday_ra)What kind of Exception?
During deploy or when you use it?
In which EJB do you use the DB-Connection? Session or Entity?
Wolf -
2. Re: using others DBMS in jboss
greenday_ra Jul 4, 2006 6:23 AM (in response to greenday_ra)Thank you fro your reply.
i got exception in runtime when i try to use my ejb.
but about ejb. i use BMP. i know that there is a jbosscmp-jdbc file for setting datasource in CMP but how about BMP.
i try to add these setting in ejb-jar.xml but it was useless... :-(
...
<resource-ref>
<res-ref-name>jdbc/myjndi</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
thakns -
3. Re: using others DBMS in jboss
wdfink Jul 4, 2006 7:24 AM (in response to greenday_ra)When you use BMP you have to create your own connection like :
public class MyEntity implements EntityBean { private Connection getConnection() { Context ctx=new InitialContext(); DataSource ds=(DataSource)ctx.lookup("java:/myEntityConnection"); return(ds.getConnection(); } pubic void ejbStore() throws EJBException { Connection con=null; try { con=getConnection(); ... your Code }finnaly{ if(con!=null) { con.close(); } } }
This code should work, I test it a long time ago ;-)
I use CMP 2.x, it's easier to implement and the performance is fortunately the same as BMP.
Wolf -
4. Re: using others DBMS in jboss
greenday_ra Jul 4, 2006 8:06 AM (in response to greenday_ra)Yes, its work, :-)
Thank you so much.
i have a error in my connection code.DataSource ds=(DataSource)ctx.lookup("java:comp/env/jdbc/myjndi"); changed to DataSource ds=(DataSource)ctx.lookup("java:/myjndi");
Thank you again.