Skip site navigation (1) Skip section navigation (2)

JDBC Newbie Question

From: "John McLaughlin" <johnm(at)oei(dot)com>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: JDBC Newbie Question
Date: 2001-10-19 02:46:46
Message-ID: 3bcf93e8_1@news.nwlink.com (view raw or flat)
Thread:
Lists: pgsql-interfaces
I am doing some first tinkering with JDBC and PostgreSQL and I am stumped on
something.

I have a simple Java program that queries a table on the PostgreSQL
workstation successfully.  I can iterate through the rows and display them.
However, when I try to update a value, like using:
    ResultSet rs;
    ...
    rs.updateInt("columnName", newIntVal);

The rs.updateInt() seems to succeed (no exceptions thrown), but the database
never gets changed.  I am using JBuilder 4, and I *can* make changes to the
DB using the Data Explorer tool.  So, the jdbc driver appears to be working.

FYI, my connection logic starts as follows:
    ...
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");  // load database
interface
    conn = DriverManager.getConnection("jdbc:odbc:postgresql", "myusername",
"mypassword");
    stmt =
conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATA
BLE);
    res = stmt.executeQuery("SELECT * FROM customer FOR UPDATE");
    ...

Any ideas?

--
John McLaughlin
_______________________
johnm(at)oei(dot)com



pgsql-interfaces by date

Next:From: Antonio Sergio de Mello e SouzaDate: 2001-10-19 23:10:45
Subject: ECPG segmentation fault
Previous:From: heroDate: 2001-10-17 06:00:43
Subject: pgaccess select chinese Big5 data error

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group