db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "jaoued zahraoui (JIRA)" <j...@apache.org>
Subject [jira] Created: (DERBY-4076) rowset.insertRow() does not working
Date Thu, 26 Feb 2009 23:49:02 GMT
rowset.insertRow() does not working
-----------------------------------

                 Key: DERBY-4076
                 URL: https://issues.apache.org/jira/browse/DERBY-4076
             Project: Derby
          Issue Type: Bug
          Components: JDBC
    Affects Versions: 10.4.2.0
         Environment: windows 32b eclipse ganymede 
            Reporter: jaoued zahraoui
            Priority: Critical
             Fix For: 10.4.2.1



trying this code : 
	public static void main(String[] args) {
		CachedRowSetImpl res = null;
		try {
			res = new CachedRowSetImpl();
			res.setCommand(RequestLoader.strGetListEntries);
			res.setTableName("ADDRESS");
			res.setType(ResultSet.TYPE_FORWARD_ONLY);
			res.setConcurrency(ResultSet.CONCUR_UPDATABLE);
			Connection conn = Dbconnect.getInstance().getDbConnection();
			res.execute(conn);
			
			

			// Check ResultSet's updatability
			if (res.getConcurrency() == ResultSet.CONCUR_READ_ONLY) {
				System.out.println("ResultSet non-updatable.");
			} else {
				System.out.println("ResultSet updatable.");
			}

			// Move the cursor to the insert row
			res.moveToInsertRow();

			// Set the new first name and last name
			// System.out.println("ID : " + rs.getInt("ID"));
			res.updateString("LASTNAME", "aaaaa");
			res.updateString("FIRSTNAME", "aaaaa");
			res.updateString("MIDDLENAME", "aaaaa");
			res.updateString("PHONE", "aaaaa");
			res.updateString("EMAIL", "aaaaa");
			res.updateString("ADDRESS1", "aaaaa");
			res.updateString("ADDRESS2", "aaaaa");
			res.updateString("CITY", "aaaaa");
			res.updateString("STATE", "aaaaa");
			res.updateString("POSTALCODE", "aaaaa");
			res.updateString("COUNTRY", "aaaaa");

			// Store the insert into database
			res.insertRow();

			// Move the curesor back to the current row
			res.moveToCurrentRow();

			System.out.println("Row inserted ok.");

			// Close ResultSet and Statement
			res.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

resuting in :


ResultSet updatable.
java.sql.SQLException: Échec de l'insertion de ligne
	at com.sun.rowset.CachedRowSetImpl.insertRow(Unknown Source)
	at fr.free.zahraoui.test.database.DerbyRowSetInsertRow.main(DerbyRowSetInsertRow.java:49)


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message