Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 1A8429FA1A6 for ; Fri, 29 Dec 2006 03:17:14 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 95152-09 for ; Fri, 29 Dec 2006 03:17:06 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id D34E79FA18F for ; Fri, 29 Dec 2006 03:17:08 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from rs30.luxsci.com (rs30.luxsci.com [65.61.166.69]) by svr4.postgresql.org (Postfix) with ESMTP id 44C355AF02D for ; Fri, 29 Dec 2006 07:17:07 +0000 (GMT) Received: from [192.168.0.67] (narad.vertex.co.in [203.124.128.106] (may be forged)) (authenticated bits=0) by rs30.luxsci.com (8.13.7/8.13.7) with ESMTP id kBT7H2tq010672 for ; Fri, 29 Dec 2006 01:17:03 -0600 Message-ID: <4594C087.6040204@vertex.co.in> Date: Fri, 29 Dec 2006 12:45:19 +0530 From: Danish Siddiqui User-Agent: Thunderbird 1.5.0.9 (X11/20061206) MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Error while trying to connect to postgresql Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/126 X-Sequence-Number: 16358 Hi, Can some one help me out with this problem. Ive been searching around for some help but couldnt find any... Im trying to connect PostgreSQL with Java.. import java.sql.*; class PostgreSQLTest{ public static void main(String[] args){ Class.forName("org.postgresql.Driver"); String url="jdbcostgresql://localhost/postgres"; Connection db = DriverManager.getConnection("url", "postgres", ""); System.out.println("Connection Created"); db.close(); } } # javac PostgreSQLTest.java PostgreSQLTest.java:5: unreported exception java.lang.ClassNotFoundException; must be caught or declared to be thrown Class.forName("org.postgresql.Driver"); ^ PostgreSQLTest.java:7: unreported exception java.sql.SQLException; must be caught or declared to be thrown Connection db = DriverManager.getConnection("url", "postgres", ""); ^ PostgreSQLTest.java:10: unreported exception java.sql.SQLException; must be caught or declared to be thrown db.close(); ^ 3 errors # echo $CLASSPATH :/usr/local/jdk1.6.0/lib/tools.jar:/usr/local/pgsql/share/java/postgresql-8.1-408.jdbc3.jar:/usr/local/jdk1.6.0/lib/:/home/danish/:/home/danish/PostgreSQLTest.java Thanks Danish