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] Updated: (DERBY-4076) rowset.insertRow() does not working
Date Thu, 26 Feb 2009 23:53:01 GMT

     [ https://issues.apache.org/jira/browse/DERBY-4076?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

jaoued zahraoui updated DERBY-4076:
-----------------------------------

         Description: 
creating table with this SQL request : 
CREATE table APP.ADDRESS (
    ID          INTEGER NOT NULL 
                PRIMARY KEY GENERATED ALWAYS AS IDENTITY 
                (START WITH 1, INCREMENT BY 1),
    LASTNAME    VARCHAR(30), 
    FIRSTNAME   VARCHAR(30),
    MIDDLENAME  VARCHAR(30),
    PHONE       VARCHAR(20),
    EMAIL       VARCHAR(30), 
    ADDRESS1    VARCHAR(30),
    ADDRESS2    VARCHAR(30),
    CITY        VARCHAR(30),
    STATE       VARCHAR(30),
    POSTALCODE  VARCHAR(20),
    COUNTRY     VARCHAR(30) )




trying this to run 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)

DerbyRowSetInsertRow.java:49 represent : res.insertRow();



  was:

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)

DerbyRowSetInsertRow.java:49 represent : res.insertRow();



    Derby Categories: [Embedded/Client difference, High Value Fix]  (was: [High Value Fix,
Embedded/Client difference])

> 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
>
>
> creating table with this SQL request : 
> CREATE table APP.ADDRESS (
>     ID          INTEGER NOT NULL 
>                 PRIMARY KEY GENERATED ALWAYS AS IDENTITY 
>                 (START WITH 1, INCREMENT BY 1),
>     LASTNAME    VARCHAR(30), 
>     FIRSTNAME   VARCHAR(30),
>     MIDDLENAME  VARCHAR(30),
>     PHONE       VARCHAR(20),
>     EMAIL       VARCHAR(30), 
>     ADDRESS1    VARCHAR(30),
>     ADDRESS2    VARCHAR(30),
>     CITY        VARCHAR(30),
>     STATE       VARCHAR(30),
>     POSTALCODE  VARCHAR(20),
>     COUNTRY     VARCHAR(30) )
> trying this to run 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)
> DerbyRowSetInsertRow.java:49 represent : res.insertRow();

-- 
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