[jboss-user] [Datasource Configuration] New message: "Re: How to configure Oracle with my application in jboss 5.0"
Anand Kumar
do-not-reply at jboss.com
Thu Feb 11 23:52:12 EST 2010
User development,
A new message was posted in the thread "How to configure Oracle with my application in jboss 5.0":
http://community.jboss.org/message/525957#525957
Author : Anand Kumar
Profile : http://community.jboss.org/people/akstifr
Message:
--------------------------------------------------------------
Thank you once again for your reply
As you said, developed a test jsp to access the database and it is working fine.
code for test.jsp is given here
<%@page contentType="text/html"
import="java.util.*,javax.naming.*,javax.sql.DataSource,java.sql.*"
%>
<%
DataSource ds = null;
Connection con = null;
PreparedStatement pr = null;
InitialContext ic;
try {
ic = new InitialContext();
ds = (DataSource)ic.lookup( "java:OracleDS" );
con = ds.getConnection();
pr = con.prepareStatement("select role_name from roles");
ResultSet rs = pr.executeQuery();
out.println("Loading the data from Database.........");
while (rs.next()) {
out.println("<br> " +rs.getString("role_name") );
}
out.println("Closing the data from Database.........");
rs.close();
pr.close();
}catch(Exception e){
out.println("Exception thrown " +e);
}finally{
if(con != null){
con.close();
}
} %>
But still my application is unable to make the connection to the database...
Now what shall i do to make it run??
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/525957#525957
More information about the jboss-user
mailing list