、
A、JDBC-ODBC Bridge
, ODBC , JDBC-ODBC , ODBC 。
JDK1.1 , sun.jdbc.odbc
Application--->JDBC-ODBC Bridge---->JDBC-ODBC Library--->ODBC Driver-->Database
, JDBC Access
B、JDBC-Native API Bridge
, ( ODBC), JDBC-Native API , Java API , 。
。
Application--->JDBC Driver---->Native Database library---->Database
A 。
C、JDBC-middleware
, middleware, middleware 。
Application--->Jdbc Driver----->java middleware--->JDBC Driver---->Database
, , 。
D、Pure JDBC driver
JDBC , , (middleware), , 。
Application--->Jdbc driver----->database engine--->database
, , Internet 。
、 JDBC
1、DriverManager :
JDBC 。 JDBC , DriverManager , 。
:
A、Class.forName(String driver); //
B、Static Connection getConnection(String url,String user,String password) throws SQLException;
//
C、Static Driver getDriver(String url) throws SQLExcetion;
// DriverManager url
2、Connection
JSP/JAVA 。 。
:
A、Statement createStatement() throws SQLException; // Statement
Statement createStatement(int resultSetType,int resultSetConcurrency) throws SQLException;
// Statement
resultSetType
TYPE_FORWARD_ONLY
TYPE_SCROLL_INSENSITIVE ,
TYPE_SCROLL_SENSITIVE ,
resultSetConcurrency
CONCUR_READ_ONLY
CONCUR_UPDATABLE
JDBC2.0 ,
B、DatabaseMetaData getMetaData() throws SQLException; // DatabaseMetaData
C、PreparedStatement prepareStatement(String sql) throws SQLException;
// PreparedStatement
D、boolean getAutoCommit() throws SQLException // Connection AutoCommit
E、void setAutoCommit(boolean autoCommit) throws SQLException
// Connection AutoCommit
F、void commit() throws SQLException // 、
G、void rollback() throws SQLException // 、
H、void close() throws SQLException // Connection
I、boolean isClosed() throws SQLException // Connection
3、Statement
Statement , SQL , 、
:
A、ResultSet executeQuery(String sql) throws SQLException // SELECT
B、int executeUpdate(String sql) throws SQLException
// INSERTDELETEUPDATE 、 。
C、void close() throws SQLException // Statement
4、PreparedStatement
PreparedStatement Statement PreparedStatement SQL , SQL , PreparedStatement Statement
:
A、ResultSet executeQuery() throws SQLException // SELECT
B、int executeUpdate() throws SQLException
// INSERTDELETEUPDATE 、 。
C、ResultSetMetaData getMetaData() throws SQLException
// ResultSet
D、void setInt(int parameterIndex,int x) throws SQLException
// PreparedStatement IN
E、void setFloat(int parameterIndex,float x) throws SQLException
// PreparedStatement IN
F、void setNull(int parameterIndex,int sqlType) throws SQLException
// NULL PreparedStatement IN
G、void setString(int parameterIndex,String x) throws SQLException
// PreparedStatement IN
H、void setDate(int parameterIndex,Date x) throws SQLException
// PreparedStatement IN
I、void setTime(int parameterIndex,Time x) throws SQLException
// PreparedStatement IN
5、DatabaseMetaData
DatabaseMetaData , 。
:
A、String getDatabaseProductName() throws SQLException //
B、String getDatabaseProductVersion() throws SQLException //
C、String getDriverName() throws SQLException // JDBC
D、String getDriverVersion() throws SQLException // JDBC
E、String getURL() throws SQLException // JDBC URL
F、String getUserName() throws SQLException //
6、ResultSet
。 、 。 (Cursor), , , , 。
:
A、boolean absolute(int row) throws SQLException //
B、void beforeFirst() throws SQLException //
C、void afterLast() throws SQLException //
D、boolean first() throws SQLException //
E、boolean last() throws SQLException //
F、boolean next() throws SQLException //
G、boolean previous() throws SQLException //
H、void deleteRow() throws SQLException //
I、void moveToInsertRow() throws SQLException //
J、void moveToCurrentRow() throws SQLException //
K、void insertRow() throws SQLException //
L、void updateRow() throws SQLException //
M、void update (int columnIndex, x) throws SQLException //
N、int get (int columnIndex) throws SQLException //
O、ResultSetMetaData getMetaData() throws SQLException // ResultSetMetaData
7、ResultSetMetaData
ResultSetMetaData ResultSet , 。
:
A、int getColumnCount() throws SQLException // ResultSet
B、int getColumnDisplaySize() throws SQLException // ResultSet
C、String getColumnName(int column) throws SQLException // ResultSet
D、String getColumnTypeName(int column) throws SQLException // ResultSet
E、String getTableName(int column) throws SQLException // ResultSet
F、boolean isCaseSensitive(int column) throws SQLException // ResultSet
G、boolean isReadOnly(int column) throws SQLException // ResultSet