Problem connection to an Oracle Database ??
Date: 6 Aug 2003 08:56:11 -0700
Message-ID: <32159d9d.0308060756.218fa22e_at_posting.google.com>
Hi, I could use some advice. I'm not sure if this is simply a matter of improperly displaying results that have been returned, or one of not properly connecting to the database. What follows is a jsp I threw together to pull data from a table and display it dynamically within my I.E. browser.
Did I include all the neccessary Classpaths? When the first classpath was included with all of the rest on my second IMPORT statement, I kept receiving "could not compile" error messages. So I put it in its own IMPORT statement.
Am I issuing the appropriate getConnection method? Thanks for any and all advice. Appreciate it. Here is the jsp:
<%_at_ page import="com.epicentric.jdbc.*"%>
<%_at_ page import="java.util.*,
java.text.*, java.io.*, java.net.URL,
com.epicentric.common.*,
java.sql.*"
%>
<%_at_ include file="/include/common.jsp"%>
<%_at_taglib uri="epi-tags" prefix="epi_html" %> <%_at_taglib uri="module-tags" prefix="mod" %> <epi_html:controllerURL /> <epi_html:checkTicket />
<%
//instantiate variables
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
try {
//Load the JDBC driver
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
//Get the connection getConnection("oracle driver", "userID",
"password")
con = DriverManager.getConnection("jdbc:oracle:thin:_at_dns_name:portnumber:oracle_instancename","userid","password");
stmt = con.createStatement();
//sql statements: create, update, query
rs = stmt.executeQuery("SELECT * FROM DB.DB_RESOURCE WHERE
DB.DB_RESOURCE.CODE = '**'");
while (rs.next())
System.out.println(rs.getString(1));
rs.close();
stmt.close();
con.close();
}
catch(Exception ex) {
System.out.println("Error " + ex.toString());
}
%>
Nelson Received on Wed Aug 06 2003 - 17:56:11 CEST