This content has been marked as final.
Show 3 replies
-
1. Re: Getting the connection url from the *-ds.xml file
tulsidas May 27, 2011 9:04 AM (in response to mcasperson)If you are using Hibernate as the JPA provider you can use
@In EntityManager em; Session sess = (Session) em.getDelegate(); Connection conn = sess.connection(); DatabaseMetaData dbmd = conn.getMetaData(); String url = dbmd.getUrl();
Or any other useful method in the DatabaseMetaData class
-
2. Re: Getting the connection url from the *-ds.xml file
mcasperson May 29, 2011 11:45 PM (in response to mcasperson)Turns out calling Session.connection throws an exception. But the following works:
final Session sess = (Session) entityManager.getDelegate();
sess.doWork(new Work()
{
public void execute(Connection connection)
throws SQLException
{
final DatabaseMetaData dbmd = connection.getMetaData();
final String url = dbmd.getURL();
}
}
); -
3. Re: Getting the connection url from the *-ds.xml file
felipebutcher Sep 18, 2011 11:42 PM (in response to mcasperson)andres quijano. that worked for me.
seam 2.2.2
jboss 4.3.2