Thread: JDBC connection failure

JDBC connection failure

From
Culley Harrelson
Date:
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

I can however import org.postgresql.util.* without
generating an error through tomcat when I put the
postgresql.jar directly in the /usr/local/tomcat/lib
folder.

Also does it matter what the name of the jar file is?
All the documentation refers to postgresql.jar and the
current download is jdbc7.0-1.2.jar.  I'm assuming it
does not :)

Culley

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices.
http://auctions.yahoo.com/

Re: JDBC connection failure

From
Jeff Duffy
Date:
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).

--
Errors have occurred.
We won't tell you where or why.
Lazy programmers.
        -- Hacking haiku


Re: JDBC connection failure

From
"Robert B. Easter"
Date:
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@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@comptechnews.com ---------
-- CompTechNews Message Board http://www.comptechnews.com/ --
-- CompTechServ Tech Services http://www.comptechserv.com/ --
---------- http://www.comptechnews.com/~reaster/ ------------