1 transation
performance it is not easy to say , turn off auto-commiting it will cut down on the number of commits.decreasse the comunication between client and the dbserver and but the db need to hold the locks on multiple statements.
turn on the auto-commits , in case where there may be conflicts with other users, turn on auto-commiting will improve the preformance because no lock need to hode, but it will caused conflicts.
transaction isolation :control the dirty data, saving points is a point in a transation.
SQLWarning warning = stmt.getWarnings(); if (warning != null) { System.out.println("/n---Warning---/n"); while (warning != null) { System.out.println("Message: " + warning.getMessage()); System.out.println("SQLState: " + warning.getSQLState()); System.out.print("Vendor error code: "); System.out.println(warning.getErrorCode()); System.out.println(""); warning = warning.getNextWarning(); } }
2, rows order in result set dose nothing with the db
3, insert row, every rs has it.
4, commit is means using the sql statement ,and insertRow or updateRow is means using the jdbc api.
5, addBatch(sqlstring) executeBatch() return a int array(), its execution order is fixed, support parameterized batch
1, SQL types:
sql date ,time and timestamp , but java only have the date, it can repsents all the sql date types.
data returned from result set mostly is sql types.
udt is corresponding to struct, ref is ref.
the program example :
while (rs.next()) { int storeNo = rs.getInt("STORE_NO"); Struct location = (Struct)rs.getObject("LOCATION"); Object[] locAttrs = location.getAttributes(); Array coffeeTypes = rs.getArray("COF_TYPE"); String[] cofTypes = (String[])coffeeTypes.getArray(); Ref managerRef = rs.getRef("MGR"); PreparedStatement pstmt = con.prepareStatement( "SELECT MANAGER FROM MANAGERS WHERE OID = ?"); pstmt.setRef(1, managerRef); ResultSet rs2 = pstmt.executeQuery(); rs2.next(); Struct manager = (Struct)rs2.getObject("MANAGER"); Object[] manAttrs = manager.getAttributes(); System.out.print(storeNo + " "); System.out.print(locAttrs[0] + " " + locAttrs[1] + " " + locAttrs[2] + ", " + locAttrs[3] + " " + locAttrs[4] + " "); for (int i = 0; i < cofTypes.length; i++) System.out.print(cofTypes[i] + " "); System.out.println(manAttrs[1] + ", " + manAttrs[2]); rs2.close(); pstmt.close(); } rs.close(); stmt.close(); con.close(); } catch(BatchUpdateException b) { System.err.println("-----BatchUpdateException-----"); System.err.println("SQLState: " + b.getSQLState()); System.err.println("Message: " + b.getMessage()); System.err.println("Vendor: " + b.getErrorCode()); System.err.print("Update counts: "); int [] updateCounts = b.getUpdateCounts(); for (int i = 0; i < updateCounts.length; i++) { System.err.print(updateCounts[i] + " "); } System.err.println(""); } catch(SQLException ex) { System.err.println("SQLException: " + ex.getMessage()); System.err.println("SQLState: " + ex.getSQLState()); System.err.println("Message: " + ex.getMessage()); System.err.println("Vendor: " + ex.getErrorCode()); }
2, oracle jdbc driver, after u set up the connecting with oracle server, conn.getCatalog() will return null, and also u can't set the catalog, so u only can see the things which only belong to this user.like the tables, viewes, procedures.this dose make sense.