Re: JDBC connection failure

From: "Robert B(dot) Easter" <reaster(at)comptechnews(dot)com>
To: Jeff Duffy <jduffy(at)greatbridge(dot)com>, Culley Harrelson <culleyharrelson(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: JDBC connection failure
Date: 2001-01-28 02:42:42
Message-ID: 0101272142420Z.08820@comptechnews
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Here is a little example I played with that worked fine:

<%@ page info="Example JSP pre-compiled"
import="java.io.*,java.sql.*,java.text.*" %>
<html>
<head>
<title>Java-Test: hello</title>
<body>

<%!
Connection db;
Statement st;
ResultSet rs;
%>

<TABLE BORDER=1>
<TR><TH>uname</TH><TH>email</TH></TR>

<%
Class.forName("org.postgresql.Driver");
db = DriverManager.getConnection("jdbc:postgresql:databasename",
"username", "password");
st = db.createStatement();
rs = st.executeQuery("SELECT * FROM users");
while(rs.next()) {
%>
<TR><TD><%= rs.getString("uname") %></TD><TD><%= rs.getString("email")
%></TD></TR>
<%
}
%>

</TABLE>
</body>
</html>

<%
rs.close();
st.close();
db.close();
%>

reaster(at)comptechnews:~/web/java-test$ echo $CLASSPATH
.:/usr/local/lib/java/postgresql.jar

On Saturday 27 January 2001 12:06, Jeff Duffy wrote:
> On Sat, 27 Jan 2001, Culley Harrelson wrote:
> > Hi,
> >
> > I'm pulling my hair out trying to establish a jdbc
> > connection to postgresql. The error I recieve is:
> >
> > unable to load class postgresql.Driver
>
> The documentation had a typo. The driver class is org.postgresql.Driver
> (see the devel docs).

--
-------- Robert B. Easter reaster(at)comptechnews(dot)com ---------
-- CompTechNews Message Board http://www.comptechnews.com/ --
-- CompTechServ Tech Services http://www.comptechserv.com/ --
---------- http://www.comptechnews.com/~reaster/ ------------

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alan Turner 2001-01-28 05:25:27 Transactions inside plpgsql?
Previous Message Robert B. Easter 2001-01-28 02:05:27 Re: simple function syntax