File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JBoss/WildFly and the fly likes How to configure Datasource in JBOSS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "How to configure Datasource in JBOSS" Watch "How to configure Datasource in JBOSS" New topic

How to configure Datasource in JBOSS

Rajani kanth Anupoju

Joined: Feb 26, 2004
Posts: 1
I am getting "datasource not bound" exception.Please help me to solve this.I have given the following details:

My datasource connection name is OracleDS.I have put that xml in server/default/deploy folder as oracle-ds.xml and classes12.jar folder.

In web.xml,i have included the following:

<description>DB Connection</description>

In jboss-web.xml,

I have put the spring jars and jar files in the lib folder of WEB-INF

In a jsp file when i try to access like this
String sql = "select * from emp";

Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
ResultSetMetaData rsm = null;
Properties env = new Properties();

Context ctx = new InitialContext(env);
DataSource datasource= (DataSource) ctx.lookup("java:/OracleDS");
Connection con=datasource.getConnection();
stmt = conn.createStatement( );
rs = stmt.executeQuery(sql);
rsm = rs.getMetaData( );
int colCount = rsm.getColumnCount( );

I am getting error as follows,
javax.naming.NameNotFoundException: OracleDS not bound
org.jnp.server.NamingServer.getObject(NamingServer .java:505)
org.jnp.server.NamingServer.lookup(NamingServer.ja va:278)
javax.naming.InitialContext.lookup(InitialContext. java:347)
org.apache.jsp.one_jsp._jspService(org.apache.jsp. one_jsp:66)
javax.servlet.http.HttpServlet.service(HttpServlet .java:810)
org.apache.jasper.servlet.JspServletWrapper.servic e(
org.apache.jasper.servlet.JspServlet.serviceJspFil e(
javax.servlet.http.HttpServlet.service(HttpServlet .java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doF ilter(

Please help me to solve this..........
Pauline McNamara

Joined: Jan 19, 2001
Posts: 4012
Oops, looks like this didn't land in the right forum. Moving it over to the JBoss forum...
I agree. Here's the link:
subject: How to configure Datasource in JBOSS
It's not a secret anymore!