Skip site navigation (1) Skip section navigation (2)

JDBC driver not found error: Windows XP / JDK1.6.06 / PG8.2.9

From: "Chandra ASGI Tech" <chandraasgi(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: JDBC driver not found error: Windows XP / JDK1.6.06 / PG8.2.9
Date: 2008-07-01 13:28:55
Message-ID: fbf9dcc60807010628m51d7ede2lb3b4ac0732593726@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
I have PostgreSQL 8.2.9 on Windows XP, with JDK 1.6.0_06.   Have got the
postgresql-8.2-508.jdbc4.jar  jdbc driver in /lib/ext of the Java folder.

HAve set both the PATH and CLASSPATH aporpriately

My Java code for testing is:

import java.sql.*;

class postgreSQLTest
 {

public static void main (java.lang.String[] args) throws Exception {

try{

Class.forName("org.postgresql.Driver");

Connection con =
DriverManager.getConnection("jdbc:Postgresql://localhost:5432/postgres","postgres","1234");

Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select * from country");

while(rs.next())

{

System.out.println(rs.getString(1)+"<br>");

}

}catch(Exception e){

System.out.println(e);

}

}

}



But I get the error
Exception in thread "main" java.lang.NoClassDefFoundError: postgreSQLTest

Any help? Thanks in advance.


- ChandraASGI

Responses

pgsql-jdbc by date

Next:From: Dave CramerDate: 2008-07-01 14:33:08
Subject: Re: JDBC driver not found error: Windows XP / JDK1.6.06 / PG8.2.9
Previous:From: cap20Date: 2008-06-30 20:17:00
Subject: Re: insert data into partitioned tables via Java application

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group