Re: Read transactions don't work on 7.0.x db's - Mailing list pgsql-jdbc

From Dave Cramer
Subject Re: Read transactions don't work on 7.0.x db's
Date
Msg-id 00c101c131c2$e6c08e40$8201a8c0@inspiron
Whole thread Raw
In response to Read transactions don't work on 7.0.x db's  ("Dave Cramer" <Dave@micro-automation.net>)
Responses Re: Read transactions don't work on 7.0.x db's Disregard my other patch
List pgsql-jdbc
Here's a patch to fix the problem below

Dave

-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Dave Cramer
Sent: August 30, 2001 8:51 PM
To: pgsql-jdbc@postgresql.org
Subject: [JDBC] Read transactions don't work on 7.0.x db's


The following code fails on a 7.0 db, but works on a 7.1 db

It works fine with the 7.0 jar, but not with the latest code

I had a quick look and everything looks ok. I am going to keep looking
but I thought I would throw this out and see if anyone knows what is
going on

Dave

package test;
import java.sql.*;
/**
 * Title:
 * Description:
 * Copyright:    Copyright (c) 2001
 * Company:
 * @author
 * @version 1.0
 */

public class TransactionSelect {

  public TransactionSelect()
  {
  }
  public static Connection getConnection( String url, String user,
String password)
  {
    try {
      Class.forName("org.postgresql.Driver");
      return java.sql.DriverManager.getConnection(url,user,password);
    } catch(ClassNotFoundException ex) {
      ex.printStackTrace(System.out);
    } catch(SQLException ex) {
      ex.printStackTrace(System.out);
    }
    return null;
  }

  public static void main(String[] args)
  {

    try{
      Connection con =
getConnection("jdbc:postgresql://192.168.1.1/davec","davec","");
      if (con == null){
        throw new RuntimeException("no Connection");
      }
      con.setAutoCommit(false);
      PreparedStatement pstmt = con.prepareStatement("select * from
categories" );
      ResultSet rs = pstmt.executeQuery();
      con.commit();
      con.close();
    }catch (SQLException ex){
      ex.printStackTrace(System.out);
    }
  }
}


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster


Attachment

pgsql-jdbc by date:

Previous
From: Tony Grant
Date:
Subject: Re: Re: ? (question mark) characters
Next
From: Gunnar Rønning
Date:
Subject: Re: Dúvida