Thread

  1. jdbc + postgres

    Przemyslaw Bak <przemol@st3.makro.com.pl> — 1998-10-20T15:27:54Z

    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
    
    
    
  2. Re: [GENERAL] jdbc + postgres

    Peter Mount <peter@retep.org.uk> — 1998-10-20T20:40:42Z

    On Tue, 20 Oct 1998, Przemyslaw Bak wrote:
    > While running I have message:
    > 
    > Loading driver ...
    > Connecting ...
    > SQLState:null
    > Message:Connection failed: java.net.ConnectException: Connection refused
    
    This seems to be the most common problem ;-)
    
    You are not running the backend with the -i arg, which turns on tcp/ip.
    
    Check the FAQ.
    
    Peter
    
    -- 
           Peter T Mount peter@retep.org.uk
          Main Homepage: http://www.retep.org.uk
    PostgreSQL JDBC Faq: http://www.retep.org.uk/postgres
     Java PDF Generator: http://www.retep.org.uk/pdf
    
    
    
  3. Re: [GENERAL] jdbc + postgres

    Przemyslaw Bak <przemol@st3.makro.com.pl> — 1998-10-21T10:50:14Z

    On Tue, 20 Oct 1998, Peter T Mount wrote:
    
    > > Message:Connection failed: java.net.ConnectException: Connection refused
    > 
    > This seems to be the most common problem ;-)
    > 
    > You are not running the backend with the -i arg, which turns on tcp/ip.
    
    Thank you. Two characters more and everything works great.
    I need to come back to basic school ...
    
    > 
    > Check the FAQ.
    
    Which one: java or postgres ?
    
    
    przemol
    
    
    
  4. Re: [GENERAL] jdbc + postgres

    Peter Mount <peter@retep.org.uk> — 1998-10-22T05:33:27Z

    On Wed, 21 Oct 1998, Przemyslaw Bak wrote:
    
    > On Tue, 20 Oct 1998, Peter T Mount wrote:
    > 
    > > > Message:Connection failed: java.net.ConnectException: Connection refused
    > > 
    > > This seems to be the most common problem ;-)
    > > 
    > > You are not running the backend with the -i arg, which turns on tcp/ip.
    > 
    > Thank you. Two characters more and everything works great.
    > I need to come back to basic school ...
    > 
    > > 
    > > Check the FAQ.
    > 
    > Which one: java or postgres ?
    
    The Postgresql jdbc one...
    
    -- 
           Peter T Mount peter@retep.org.uk
          Main Homepage: http://www.retep.org.uk
    PostgreSQL JDBC Faq: http://www.retep.org.uk/postgres
     Java PDF Generator: http://www.retep.org.uk/pdf