[jboss-user] [Beginners Corner] - Re: How to connect to an extern Oracle Database?

PeterJ do-not-reply at jboss.com
Mon Nov 20 10:59:09 EST 2006


Unfortunately, the exception stack trace gives no clue as to the root cause (there is usually as "caused by" stack trace following geneic exception such as "servlet threw exception".

Regardless of that, I think that a different approach would be better.  Try this. Create a *-ds.xml file that describes your data source. So all of the information you have regarding the driver name and connection would go there.  Then change your code to do:

InitialContext ic = new InitialContext();
DataSource ds = (DataSource)ic.lookup("java:ds-jndi-name");
Connection conn = ds.getConnection();

where ds-jndi-name is the value of < jndi-name > in the *-ds.xml file.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3987326#3987326

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3987326



More information about the jboss-user mailing list