? JDBC?? - PowerPoint PPT Presentation

1 / 15
About This Presentation
Title:

? JDBC??

Description:

Title: Author: wqw Last modified by: lb Created Date: 3/30/2001 12:43:14 AM Document presentation format: Company – PowerPoint PPT presentation

Number of Views:147
Avg rating:3.0/5.0
Slides: 16
Provided by: wqw
Category:
Tags: jdbc | wombat

less

Transcript and Presenter's Notes

Title: ? JDBC??


1
???? JDBC
? JDBC?? ? JDBC???? ? JDBC API ? JDBC???
2
JDBC??
? JDBC???Java Applet????????????? ????API?? ?
JDBC?????????? ??JDBC???,??????SQL??????
JAVA???
3
JDBC????
4
??????????
5
??????????
6
JDBC?ODBC
? ODBC API?C ????,?JAVA?????????? ?
?????????,???ODBC C API ????? JAVA
API? ???JDBC????????JAVA???????
7
JDBC ????
8
JDBC ????
? JDBC-ODBC?(JDBC-ODBC bridge) JDBC???ODBC
?????ODBC???client??? ?????????? ???API??JAVA??
(Native-API partly-Java driver) JDBC?? ?
????Client ?API,???????? ????? ???????JAVA??(J
DBC-Net pure Java driver) JDBC?? ?
?????DBMS?????,??? ??????????????DBMS??? ?????
??JAVA??(Native-protocol pure Java driver)
JDBC?? ???DBMS??????
9
JDBC API ??
?????????? ???SQL?? ?????
10
JDBC API ?
?? JDBC?
Java.sql.Driver java.sql.DriverManager java.sql.Dr
ivePropertyInfo
??????
?????
Java.sql.Connection
java.sql.Statement java.sql.PreparedStatement java
.sql.CallableStatement
SQL??
??
java.sql.ResultSet
??
java.sql.SQLException java.sql.SQLWarning
11
JDBC ???
???????
??
??
??
??
??
????
?????
executeUpdate( )
???
executeQuery( )
???
execute( )
??
getMoreResults( )
getResultsSet( )
12
?????????
  • ? JDBC?DriverManager?????????Driver????
  • ?????java.sql???Driver???,??????
  • ??????Class.forName( )?????????Driver?
  • ?Class.forName(sun.jdbc.odbc.JdbcOdbcDrive
    r),
  • ??JDBC-ODBC??
  • ???DriverManager.getConnection( )????????
  • ??????URL,???????????????
  • ???
  • ????jdbcltsubprotocolgtltsubnamegt
  • ???JDBC-ODBC?????wombat????????
  • Connection con DriverManager.getConnection(jdbc
    odbc
  • wombat,username,password)

13
??SQL??
??????????Statement??,???SQL?? ??????????? /
??SQL????????rs / Statement stmt
con.createStatement( ) ResultSet rs
stmt.executeQuery( SELECT a, b, c FROM
Table1) ?????????????SQL??,???? PreparedStateme
nt ??? ???CallableStatement??????????????
14
?????
????????????????????? ??????????(Cursor)??????????
? SQL?????JAVA??????? ??SQL
???????,???????????? /????? rs/ while
(rs.next( )) int x rs.getInt(a) String s
rs.getString(b) float f
getFloat(c) stmt.close( ) con.close( )
15
JDBC?????
  • ? JDBC????SQL??,??????API?
  • ??JDBC????????
  • JAVA???SQL SQLJ,?JAVA???????
  • ????SQL???
  • ?????????JAVA?,JAVABland?
Write a Comment
User Comments (0)
About PowerShow.com