Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> can oracle 10g support jdbc 2.0 update XXX method

can oracle 10g support jdbc 2.0 update XXX method

From: <db2group88_at_yahoo.com>
Date: 20 Oct 2004 11:31:11 -0700
Message-ID: <111e249e.0410201031.4aa9dbc7@posting.google.com>


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:" +

stmt.getResultSetConcurrency());         
				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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US