This content has been marked as final.
Show 5 replies
-
1. Re: How can I test if a Datasource is correctly installed
weston.price Oct 13, 2007 1:08 PM (in response to zazzaz)Easiest way is to write some code to use it.
Installation issues will generally show up as errors in the log, but being that by default DS pools are not pre-filled, connectivity errors will generally not show up until the first time you attempt to use the datasource. -
2. Re: How can I test if a Datasource is correctly installed
zazzaz Oct 13, 2007 1:20 PM (in response to zazzaz)Such as?
-
3. Re: How can I test if a Datasource is correctly installed
vickyk Oct 13, 2007 1:31 PM (in response to zazzaz)"ZazzaZ" wrote:
Such as?
You can use set prefill tag to true in the ds-xml file configuration .
But the catch would be that the testing results will be in the logs and you will have to see the logs if the ds configuration is appropriate .
Alternatively you can create a MBean which will create the connection , have a look at this link
http://jira.jboss.com/jira/browse/JBAS-1466 -
4. Re: How can I test if a Datasource is correctly installed
weston.price Oct 13, 2007 1:32 PM (in response to zazzaz)Such as?
Psuedo code in Servlet or EJBInitialContext ctx = null; DataSource ds = null; Connection c = null; try { ctx = new InitialContext(); ds = ctx.lookup("JNDINAME OF DATASOURCE HERE"); c = ds.getConnection(); }catch(SQLException e) { System.out.println(e.getMessage()); } finally { if(c != null) c.close(); if(ctx != null) ctx.close(); }
There are plenty of other examples out there as well. I recommend the J2EE tutorial as a place to start if the above concepts are not familiar to you. -
5. Re: How can I test if a Datasource is correctly installed
zazzaz Oct 13, 2007 3:17 PM (in response to zazzaz)Thanks to all!