|
Home > Archive > PostgreSQL JDBC > July 2005 > JdbcRowSet Problem
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
JdbcRowSet Problem
|
|
| Dennis Gesker 2005-07-25, 8:29 pm |
| Hello All:
I seem to be having a strange problem with the JDBC driver. I'm writing
a simple Swing application where a JTable is populated from data in a
postgres database. I'm using a JdbcRowSet. The table populates just fine.
However, I can't seem to update the information in the JTable. Below is
the code added to the JTables tablemodel to update the data.
No error is returned and it appears that all command in this function
are called.
Is anyone else having this kind of problem? Could some point me in the
right direction?
Thanks
Dennis
public void setValueAt(Object value, int rowIndex, int columnIndex){
try {
rowSet.absolute(rowIndex + 1);
rowSet. setObject(columnInde
x + 1, value);
rowSet.updateRow();
fireTableCellUpdated
(rowIndex, columnIndex);
JOptionPane. showMessageDialog(nu
ll, "Got here.");
} catch (SQLException sqle) {
do {
System.err.println("Exception occourred\nMessage: "
+ sqle.getMessage());
System.err.println("SQL state: " + sqle.getSQLState());
System.err.println("Vendor code: " + sqle.getErrorCode());
System.err.println("---------------------------------");
} while ((sqle = sqle.getNextException()) != null);
}
}
| |
| Dennis Gesker 2005-07-25, 8:29 pm |
| Apparently I also needed a rowSet.updateObject statment. I'm working
now. --drg
Dennis Gesker wrote:
> Hello All:
>
> I seem to be having a strange problem with the JDBC driver. I'm
> writing a simple Swing application where a JTable is populated from
> data in a postgres database. I'm using a JdbcRowSet. The table
> populates just fine.
>
> However, I can't seem to update the information in the JTable. Below
> is the code added to the JTables tablemodel to update the data.
>
> No error is returned and it appears that all command in this function
> are called.
>
> Is anyone else having this kind of problem? Could some point me in the
> right direction?
>
> Thanks
> Dennis
>
>
>
>
> public void setValueAt(Object value, int rowIndex, int columnIndex){
> try {
>
> rowSet.absolute(rowIndex + 1);
> rowSet. setObject(columnInde
x + 1, value);
> rowSet.updateRow();
> fireTableCellUpdated
(rowIndex, columnIndex);
> JOptionPane. showMessageDialog(nu
ll, "Got here.");
>
> } catch (SQLException sqle) {
> do {
> System.err.println("Exception occourred\nMessage: "
> + sqle.getMessage());
> System.err.println("SQL state: " + sqle.getSQLState());
> System.err.println("Vendor code: " + sqle.getErrorCode());
> System.err.println("---------------------------------");
> } while ((sqle = sqle.getNextException()) != null);
> }
> }
|
|
|
|
|