• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to configure Datasource in JBOSS  RSS feed

Rajani kanth Anupoju
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.getBinding(NamingServe r.java:491)
org.jnp.server.NamingServer.getBinding(NamingServe r.java:499)
org.jnp.server.NamingServer.getObject(NamingServer .java:505)
org.jnp.server.NamingServer.lookup(NamingServer.ja va:278)
org.jnp.interfaces.NamingContext.lookup(NamingCont ext.java:610)
org.jnp.interfaces.NamingContext.lookup(NamingCont ext.java:572)
javax.naming.InitialContext.lookup(InitialContext. java:347)
org.apache.jsp.one_jsp._jspService(org.apache.jsp. one_jsp:66)
org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet .java:810)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet .java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doF ilter(ReplyHeaderFilter.java:81)

Please help me to solve this..........
Pauline McNamara
Posts: 4012
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops, looks like this didn't land in the right forum. Moving it over to the JBoss forum...
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!