commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 14267] - DBCP doesn't work on Tomcat 4.1.12 and Oracle JDBC driver
Date Wed, 06 Nov 2002 16:07:10 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14267>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14267

DBCP doesn't work on Tomcat 4.1.12 and Oracle JDBC driver





------- Additional Comments From troy.campano@libertymutual.com  2002-11-06 16:07 -------
Here's the code:

thank you!


<%@ page contentType="text/html; charset=iso-8859-1" language="java" 
import="java.sql.*,javax.sql.*,oracle.jdbc.pool.*,javax.naming.*,java.io.*" %>

<%
Connection conn = null;
try
{
//******************************************************************************
*******************
// Request Connection from Connection Pool
//******************************************************************************
*******************
Context initContext = new InitialContext();
Context envContext  = (Context)initContext.lookup("java:/comp/env");
DataSource ds = (DataSource)envContext.lookup("jdbc/DronePool");
conn = ds.getConnection();

//******************************************************************************
*******************



String sSQL = "SELECT table_name FROM all_tables";
Statement stmt = conn.createStatement();
ResultSet rs   = stmt.executeQuery(sSQL);
while (rs.next())
{
 out.println("the table name is: " + rs.getString("table_name") + "<br />");
}
rs.close();
stmt.close();
rs = null;
stmt = null;



}
catch(SQLException e)
{
 throw new SQLException(e.getMessage());
}

  finally 
  {
    if (conn != null) 
	{
      try 
	  {
        conn.close();
      } 
	  catch (SQLException e) 
	  {
          // Nothing coherent to do here.
          // Pray nothing else goes wrong.
          e.printStackTrace();
      }
	}
  }
%>

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message