> I am running JRun under Netscape Enterprise server in a Windows NT4.0
> environment.  I have an access database that I am attempting to connect to
> for testing purposes before sending the application to our production
> servers which are running Oracle.  I can run the jsp once and it will
> retrieve the information from the database and display it on the browser.
> When I hit refresh, the good Dr. comes and shuts down the javaw.exe and I
> get a connector Proxy error and have to restart JRun.
>
> I am new to both Java and jsp, so please try not to laugh too hard when
> viewing my code below.  I would appreciate any helpful tips or suggestions
> regarding this problem.
>
> TIA
>
> Jeff Steiner
>
> <%@ page language="java" %>
> <%@ page import="java.sql.*" %>
> <%@ page import="java.io.*" %>
>
> <html>
> <body bgcolor="#ffffff">
> <br /><br />
> <%
>     // Set default Connection and sql variables
>     Connection dbCon;
>       String sql;
>
>       // Create the sql statement used to query the database.
>       sql = "SELECT Content,DateModified,Active,ID FROM HotTopics";
>
>       // Try to make a connection with the database through jdbc/odbc
>     try {
>         // Name the driver and then the datasource
>       Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
>       dbCon = DriverManager.getConnection("jdbc:odbc:DealerServices");
>
>         // Try to execute the query from above
>         try {
>           // Create the statement and recordset
>           Statement s = dbCon.createStatement();
>               ResultSet rs = s.executeQuery(sql);
>
>               // Thisis a while loop that will iterate through the
>               // return and display everything to the user.
>               while (rs.next()) {
> %>
> <%= rs.getString("Content") %>
> <%
>         }
>               }
>               // This catch is used if the sql query was bad when it
> executed.
>           catch (SQLException e) {
>                 //Catch SQL Exceptions here
>               }
>     }
>       // This catch is done if you cannot connect to thedatabase.
>     catch (ClassNotFoundException e) {
>       //Catch error here
>     }
>       // This catch is done if the sql is bad.
>       // Might be redundant.
>     catch (SQLException e) {
>       //Catch SQL Error here
>     }
>  %>
>
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to