ODBCJDBCODBCVBVCJDBCJava¾DriverManager¾DriverManager.registerDriver(newsun.jdbc.odbc.JdbcOdbcDriver());¾DriverManager.registerDriver(neworacle.jdbc.driver.OracleDriver());Class.forName(sun.jdbc.odbc.JdbcOdbcDriver);Class.forName(oracle.jdbc.driver.OracleDriver);JDBCURLjdbc:subprotocol:subname¾¾¾jdbc:mysql://ip/databaseorg.gjt.mm.mysql.DriverMySQLjdbc:oracle:thin:@[ip]:[port]:[sid]oracle.jdbc.driver.OracleDriverOraclethinDriverjdbc:odbc:[odbcsource]sun.jdbc.odbc.JdbcOdbcDriverJDBC-ODBCURLstaticConnectionconn=DriverManager.getConnection(URL,login_name,login_password);staticConnectionconn=DriverManager.getConnection(URL);StatementSQLDBMSStatementStatementstmt=conn.createStatement();Statement¾executeUpdate()INSERT,UPDATE,DELETEintstmt.executeUpdate(query);¾executeQuery()SELECTResultSetstmt.executeQuery(query);ResultSetResultSetrsstmt.executeQuery(query);ResultSetSQLgetXXX¾getInt()¾getString()while(rs.next()){System.out.print(rs.getInt(id));……}0idname112233445Statement¾stmt.close();Connection¾conn.close();:¾StatementcreateStatement()¾PreparedStatementprepareStatement(Stringsql)¾commit()¾rollback()¾close()SQLStatement¾Statement¾PreparedStatement•Statement¾CallableStatement•PreparedStatementinterfaceStatementinterfacePreparedStatementinterfaceCallableStatementStatement¾ResultSetexecuteQuery()•ResultSet¾intexecuteUpdate()•StatementConnectionconn=DriverManager.getConnection(“jdbc:odbc:accessdb“,“admin”,“admin”);Statementstmt=conn.createStatement();ResultSetrst=stmt.executeQuery(select*fromsometable);PreparedStatementConnectionconn=DriverManager.getConnection(“jdbc:odbc:accessdb“,“admin”,“admin”);PreparedStatementpstmt=conn.prepareStatement(insertintouser_infoValues(???????));pstmt.setString(1,hellking);pstmt.setInt(2,20);pstmt.setBoolean(3,true);pstmt.executeUpdate();createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);ibmResultSetone-time-throughforward-onlyResultSetTYPE_FORWARD_ONLYTYPE_SCROLL_INSENSITIVETYPE_SCROLL_SENSITIVETYPE_SCROLL_INSENSITIVEResultSetResultSetResultSetResultSetCONCUR_READ_ONLYResultSetCONCUR_UPDATABLEResultSetCREATEPROCEDUREmyProc1@noint,@namevarchar(10)outputASselect@name=namefrompersonwhereoid=@noGODbJdbcdj=newDbJdbc();Connectionconn=dj.getConnection();try{//CallableStatementcs=conn.prepareCall({callmyProc1(?,?)});cs.setInt(1,1);//cs.registerOutParameter(2,Types.VARCHAR);//cs.execute();StringstrName=cs.getString(2);//System.out.println(+strName);dj.closeConnection(conn);}catch(SQLExceptione){e.printStackTrace();}Statementstatm=conn.createStatement();ResultSetrs=statm.executeQuery(select*fromperson);ResultSetMetaDatarmeta=rs.getMetaData();//intnumColumns=rmeta.getColumnCount();////for(inti=1;i=numColumns;i++){if(inumColumns)System.out.print(rmeta.getColumnName(i)+|);elseSystem.out.println(rmeta.getColumnName(i));}//while(rs.next()){for(inti=1;i=numColumns;i++){//System.out.print(+rs.getInt(1)+|);System.out.print(rs.getString(i)+|);//System.out.println(rs.getString(3));}}ResultSet.next()¾getString()varcharchar¾getFloat()Float¾getDouble()DoublePrecision¾getDate()Date¾getBoolean()Boolean¾getObject()SQL¾getBlob()Blob()¾getClob()Clob()publicStringgetString(intcolumnlndex)throwsSQLExceptionpublicStringgetString(StringcolumnName)throwsSQLExceptionResultSet......ResultSetrst=stmt.executeQuery(Select*fromUser_Info);while(rst.next()){System.out.println(rst.getString(userName));System.out.println(rst.getDate(regDate));System.out.println(rst.getString(4));System.out.println(rst.getInt(age));}......importjava.sql.*;Class.forName(sun.jdbc.odbc.JdbcOdbcDriver);Connectionconn=DriverManager.getConnection(jdbc:odbc:jdbc_odbc);StatementStatementstmt=conn.createStatement();ResultSetrs=stmt.executeQuery(SELECTid,nameFROMstudent);while(rs.next()){......}Stamtementstmt.close();conn.close();jdbccommit()rollbackjava.sql.Connectionjdbccommit()rollback()jdbcsetAutoCommit(false)commit()commit()rollback()try{conn=DriverManager.getConnection(jdbc:oracle:thin:@host:1521:SID,username,userpwd;conn.setAutoCommit(false);//stmt=conn.createStatement();stmt.executeUpdate(“altertable…”);//1stmt.executeUpdate(“insertintotable…”);//2conn