Received: from out1.ibm.net (out1.ibm.net [165.87.194.252]) by hub.org (8.8.8/8.7.5) with ESMTP id PAA00427 for ; Fri, 3 Jul 1998 15:08:21 -0400 (EDT) Received: from linux-serv (slip-32-100-132-69.fl.us.ibm.net [32.100.132.69]) by out1.ibm.net (8.8.5/8.6.9) with SMTP id TAA38132; Fri, 3 Jul 1998 19:07:45 GMT From: llestat Reply-To: llestat@ibm.net To: Jeffrey Napolitano Subject: Re: [INTERFACES] JDBC and DriverManager Date: Fri, 3 Jul 1998 15:05:44 -0400 X-Mailer: KMail [version 0.6.5] Content-Type: text/plain Cc: pgsql-interfaces@postgreSQL.org MIME-Version: 1.0 Message-Id: <98070315083700.00261@linux-serv> Content-Transfer-Encoding: 8bit Go ahead and pass it a user name and password I had a similar problem where all JDBC programs would refuse to connect even though the Database was not password protected just use yur admin name and anything for the password. - Richard On Thu, 02 Jul 1998, Jeffrey Napolitano wrote: >Okay...the below code compiles fine, but when it runs, it throws the >SQLException at the DriverManager line (as you can see, everything below >is commented out). There is indeed a datasource "bugs", and PostgreSQL >is running on the local machine. There is no password needed to access >the database, and I can access "bugs" interactively with psql. Am I not >importing a package...? > >I need help...am lost to why it throws the SQLException. > >------------------------------------------------------------ >import java.util.*; >import java.io.*; >import java.sql.*; > >public class HopeSprings { > public static void main(String[] args) { > String url = "jdbc:postgresql:bugs"; > Connection con; > String createString; > createString = "create table STUFF " + "(NAME >varchar(30), " + "IDNUMBER int)"; > Statement stmt; > > try { > Class.forName("postgresql.Driver"); > } > catch(ClassNotFoundException except) { > System.out.println("ClassNotFound: didn't >work"); > } > > try { > con = DriverManager.getConnection(url); > //stmt = con.createStatement(); > //stmt.executeUpdate(createString); > //stmt.close(); > //con.close(); > } > catch(SQLException sqlexcept) { > System.out.println("The SQL Exception was >thrown"); > } > } //End of main in JDBC_Connection class >} //End of JDBC_Connection class bracket