jdbc + postgres

Przemyslaw Bak <przemol@st3.makro.com.pl>

From: Przemyslaw Bak <przemol@st3.makro.com.pl>
To: pgsql-general@postgresql.org
Date: 1998-10-20T15:27:54Z
Lists: pgsql-general
Hello,

I have following program:

-----------------------  CUT  ------------------------
import java.net.URL;
import java.sql.*;

....

	String url = "jdbc:postgresql://localhost/store3";
	//String url = "jdbc:postgresql:store3";
	Connection db;
	Statement st;

TillInfo () {
	try {
		System.err.println ( "Loading driver ..." );
		Class.forName ("postgresql.Driver");
	} catch (java.lang.ClassNotFoundException e) {
		System.err.print ("ClassNotFoundException:");
		System.err.println (e.getMessage());
	}

	try {
		System.err.println ( "Connecting ..." );
		db = DriverManager.getConnection (url,"przemol","przemol");
		System.err.println ( "Preparing statement ..." );
		st = db.createStatement ();
		System.err.println ( "Executing query ..." );
		ResultSet rs = st.executeQuery (query);
		if (rs != null) {
			....
		}
		st.close ();
		db.close ();
	} catch (SQLException ex) {
		System.err.println ( "SQLState:" + ex.getSQLState() );
		System.err.println ( "Message:" + ex.getMessage() );
		System.err.println ( "Vendor:" + ex.getErrorCode() );
	}
}

------------------ CUT ------------------

While running I have message:

Loading driver ...
Connecting ...
SQLState:null
Message:Connection failed: java.net.ConnectException: Connection refused
Vendor:0
Exception occurred during event dispatching:
java.lang.ArithmeticException: / by zero
	at PanelChart.paint(PanelChart.java:11)
	at java.awt.Component.dispatchEventImpl(Component.java:1401)
	at java.awt.Component.dispatchEvent(Component.java:1382)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:63)


Could you tell me whats wrong with my program ?
Do I have to change sources ? If so can you tell me how ?
I use jdbc driver from postgres 6.3.2 sources and jdk 1.1.3.
Of course postgres is running :))


przemol