Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> can oracle 10g support jdbc 2.0 update XXX method
hi, we are using oracle 10g database server and use jdbc standard to
access the application ,the driver we use is ojdbc14.jar. according to
doc, we can use resultset.updateXXX() methods to update the data in
the columns you want to change, so here is the code set i use to try
to update a row. Auto commit is true, the resultset type is scrollable
sensitive and updatable, but i have the error java.sql.SQLException:
Invalid column type: get_internal_type.
String sqlStr = "SELECT country_id,COUNTRY_NAME, REGION_ID FROM hr.countries order by country_id asc for update"; try { Connection conn = getConnection(); Statement stmt = conn.createStatement( ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = stmt.executeQuery(sqlStr); if (rs.next()) { System.out.print(rs.getString(1)); System.out.print("\t" + rs.getString(2)); System.out.println("\t" + rs.getInt(3)); System.out.println("Concurrency:" +
rs.updateObject(1,"BE"); rs.updateObject(2,"Belgium"); rs.updateObject(3,new Integer (2)); rs.updateRow(); }
HR is schema from sample database
the table ddl is CREATE TABLE "HR"."COUNTRIES" ( "COUNTRY_ID" CHAR(2),
"COUNTRY_NAME" VARCHAR2(40), "REGION_ID" NUMBER, CONSTRAINT
"COUNTRY_C_ID_PK" PRIMARY KEY ("COUNTRY_ID") VALIDATE , CONSTRAINT
"COUNTRY_ID_NN" CHECK ("COUNTRY_ID" IS NOT NULL) VALIDATE , CONSTRAINT
"COUNTR_REG_FK" FOREIGN KEY ("REGION_ID") REFERENCES "HR"."REGIONS"
("REGION_ID") VALIDATE ) ORGANIZATION INDEX TABLESPACE "EXAMPLE"
INITRANS 2 MAXTRANS 255 STORAGE ( INITIAL 64K BUFFER_POOL DEFAULT)
LOGGING
please help
Received on Wed Oct 20 2004 - 13:31:11 CDT
![]() |
![]() |