pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeffrey Napolitano <jnapoli@setech.com>
To: pgsql-interfaces@postgresql.org
Subject: JDBC and DriverManager
Date: Thu, 02 Jul 1998 14:57:08 -0400
Message-ID: <359BD804.6D60872F@setech.com> (raw)

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



view thread (3+ messages)  latest in thread

Message-ID: <359BD804.6D60872F@setech.com>
Permalink:  ../359BD804.6D60872F@setech.com/
Also on:    postgresql.org/message-id/359BD804.6D60872F@setech.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: jnapoli@setech.com
  Subject: Re: JDBC and DriverManager
  In-Reply-To: <359BD804.6D60872F@setech.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox