Re: Problem connection to an Oracle Database ??

From: Greg Forestieri <gforestieri9_at_yahoo.com>
Date: 7 Aug 2003 10:58:52 -0700
Message-ID: <6a8cdd95.0308070958.6e23cb4f_at_posting.google.com>


nelson.broat_at_mail.cuny.edu (Nelson Broat) wrote in message news:<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

Hate to be a smart_at_ss but you missed the model railroading and French cooking forums. ;) Received on Thu Aug 07 2003 - 19:58:52 CEST

Original text of this message