JDBC Structure
Basically an application talks JDBC API to the JDBC manager. At
this point there is a bridge which links the application with the database.
|
JDBC API
| Bridge
app <---------> JDBC | <--------->
ODBC <--------> DBMS Driver <------> DBMS
Manager
|
Manager
|
|
So in our model...
The app is the client, JDBC API and manager is the middleware and everything
else, thereafter, is the backend.
All that we (the application) need is a set of services to be provided
- these are provided using the API and interrogating the JDBC Manager.
The Services are...
-
JDBC Driver manager
-
Register apps
-
Control connectivity
-
Driver info
-
Logging
-
Timing
-
Data types
-
Storage/conversion of SQL datatypes
-
Generic Interfaces:
-
Access data in database
-
High-level DBMS interaction
-
Database info (metadata)\
-
DBMS driver interaction
-
Prepared SQL calls
-
Query Results
-
Exceptions
The JDBC API
Classes
DriverManager
This class is used to load a JDBC driver and establish it as an available
driver. Services available:
-
registerDriver - deregisterDriver
-
getConnection
-
getDriver, getDrivers
-
setLoginTimeout - getLoginTimeout
-
getLogStream - setLogStream, println
DriverPropertyInfo
This class is for obtaining and setting properties for a loaded JDBC
driver - main use is debugging.
Numeric
This special fixed-point, high precision number class is used to store
the SQL data types NUMERIC and DECIMAL.
-
add, divide, integerDivide, multiply,
remainder, subtract
-
equals, greaterThan, greaterThanOrEquals,
lessThan
-
createFrom - ByteArray, IntegerArray,
RadixString, Scaled,
-
double, floatValue, intValue, longValue,
modExp, modInverse
-
getScale, getScaled, setRounding,
setScale, shiftLef, shiftRight, significantBits
-
isProbablePrime, hashCode, pi, pow, random,
toString, sqrt
Time and TimeStamp
The class Time is the an SQL-JDBC data conversion class.
Types
This class contains the SQL data types as constants
Interfaces
CallableStatement
This is the primary interface to access stored procedures on a database.
-
getBoolean, getByte, getBytes, getDouble,
getFloat, getInt, getLong, getShort
-
getDate, getNumeric, getObject, getTime,
getTimeStamp, wasNull
-
registerOutParameter
Connection
This is the high-level class used to interact with a database.
-
clearWarning
-
isClosed, isReadOnly, setReadOnly
-
close, commit
-
creatStatement
-
getAutoCommit, getAutoClose, setAutoClose,
setAutoCommit
-
getCatalog, getMetaData, setCatalog
-
nativeSQL
-
prepareCall, prepareStatement
-
rollBack, transactionIsolation
DatabaseMetaData
This class contains useful information about the open connection to
the database.
-
allProceduresAreCallable
-
allTablesAreSelectable
-
datadefinitionCausesTransactionCommit
-
doesMaxRowsizeIncludeBlobs
-
getXXXXXXXX
Driver
The JDBC driver implements this interface.
-
acceptsURL
-
connect
-
getMajorVersion
-
getMinorVersion
-
DriverPropertyInfo
-
jdbcCompliant
PreparedStatement
This set of methods set the parameter at the paramIndex location in
the prepared query to the specified paramType object.
-
ClearParmeters
-
execute, executeQuery, executeUpdate
-
setAsciiStream, setBinaryStream, setUnicodeStream
-
setBoolean, setNumeric, setObject,
-
setByte, setBytes
-
setDate, setTime, setTimeStamp
-
setDouble, setFloat, setInt, setLong,
setShort
-
setNull
ResultSet
The results of a query are stored in this object, which is returned
when the respective query execute method is run for the statement,
preparedStatement and CallableStatement methods.
-
clearWarning, getWarning
-
close, next
-
findColumn
-
ResultSetMetaData
-
InputStream
-
boolean
-
getByte, getBytes, getDouble, getFloat,
getInt, getLong, getNumeric, getObject, getShort getString
-
getCursor
-
getDate, getTime, getTimestamp
-
wasNull
ResultSetMetaData
This method allows access to information about query’s results, but
not the results themselves.
-
cancel
-
clearWarning, getWarnings
-
close
-
execute, executeQuery, executeUpdate
-
getMaxFieldSize, getMaxRows, setMaxFieldSize,
setMaxRows
-
getMoreResults, getResultSet
-
getQueryTimeout
-
getUpdateCount
-
setCursorName
-
setEscapeProcessing
Exceptions
-
DataTruncation
-
SQLException
-
SQLWarning
Last Updated: 3rdSeptember 1997 by Mark
Baker