-----------------------------
Please read the FAQ!
<http://java.apache.org/faq/>
-----------------------------

Here is the Sun web page with a JDBC tutorial:
http://developer.java.sun.com/developer/onlineTraining/Database/JDBCShortCou
rse/index.html

It is very straight-forward.  Also, here is a simple servlet I use to check
my JDBC Connection with Oracle:


import javax.servlet.*;
import javax.servlet.http.*;

import java.sql.*;

public class OraSimple extends HttpServlet
{
    public void doGet  ( HttpServletRequest  request,
                         HttpServletResponse response)
    throws ServletException//, IOException
    {
        Connection        con=null;
        Statement         stmt=null;
        ResultSet         result=null;
        ResultSetMetaData meta=null;
        int               columns;
        int               i;

        response.setContentType("text/html");

        try
        {
            Class.forName("oracle.jdbc.driver.OracleDriver");
            con =
DriverManager.getConnection("jdbc:oracle:thin:USERID/PASSWORD@nedemo1:1521:S
SIOR8NT");
            ServletOutputStream sout = null;
            sout = response.getOutputStream();
            sout.println("<HTML><HEAD><title>");
            sout.println("Output");
            sout.println("</title></HEAD><BODY>");

            stmt = con.createStatement();
            result = stmt.executeQuery("SELECT * "+
                                       "FROM   Technicians");
            meta = result.getMetaData();
            columns = meta.getColumnCount();

            while(result.next())
            {
                for (i=1; i<=columns; i++)
                {
                    String col = result.getString(i);
                    sout.print(col+" ");
                }
                sout.println("<br>");
            }
            con.close();

            sout.println("</body></html>");
            sout.close();
        }
        catch (Exception e)
        {
            System.err.println("Error");
            return;
        }

    }
}

-----Original Message-----
From: John Coonrod [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 23, 1999 11:00 PM
To: Java Apache Users
Subject: Example using the Oracle pure java driver?


-----------------------------
Please read the FAQ!
<http://java.apache.org/faq/>
-----------------------------

Could someone point me to a simple example of a servlet using the oracle 
pure java jdbc driver (or, frankly, any db driver).
I keep getting weird compilation errors on something that looks pretty 
simple to me.
Thanks.

John Coonrod, Vice President, The Hunger Project
15 East 26th Street, NY, NY 10010  Fax: 212-532-9785 www.thp.org



--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]


--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to