JDBC connection failure

Поиск
Список
Период
Сортировка
Искать

JDBC connection failure

От:
Culley Harrelson <culleyharrelson@yahoo.com>
Дата:
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

От:
Jeff Duffy <jduffy@greatbridge.com>
Дата:
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

От:
"Robert B. Easter" <reaster@comptechnews.com>
Дата:
Here is a little example I played with that worked fine:

<%@ page info="Example JSP pre-compiled" 
import="java.io.*,java.sql.*,java.text.*" %>


Java-Test: hello

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

 
<%
        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()) {
%>

<%
        }
%>
 
unameemail
<%= rs.getString("uname") %><%= rs.getString("email") %>
<% 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/ ------------
FAQ