1 / 11

Java / Web aandachtgebieden

Java / Web aandachtgebieden. JDBC 4.0 Preview. JDBC 4.0 in 10 minutes. What is JDBC Why JDBC 4.0 New in JDBC 4.0 Q and maybe A. JDBC 4.0 in 10 minutes. What is JDBC? The JDBCTM API provides programmatic access to relational data from the JavaTM programming language.

abel
Download Presentation

Java / Web aandachtgebieden

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Java / Web aandachtgebieden JDBC 4.0 Preview

  2. JDBC 4.0 in 10 minutes • What is JDBC • Why JDBC 4.0 • New in JDBC 4.0 • Q and maybe A

  3. JDBC 4.0 in 10 minutes What is JDBC? The JDBCTM API provides programmatic access to relational data from the JavaTM programming language. Using the JDBC API, applications written in the Java programming language can execute SQL statements, retrieve results, and propagate changes back to an underlying data source. The JDBC API can also be used to interact with multiple data sources in a distributed, heterogenous environment. The JDBC API is based on the X/Open SQL CLI, which is also the basis for ODBC. JDBC provides a natural and easy-to-use mapping from the Java programming language to the abstractions and concepts defined in the X/Open CLI and SQL standards. Since its introduction in January 1997, the JDBC API has become widely accepted and implemented. The flexibility of the API allows for a broad range of implementations. Duh! We already knew that.

  4. JDBC 4.0 in 10 minutes • Why JDBC 4.0 ? • It’s new, In fact it does not exit yet. • Expected in Java 6 in 2006 • JDBC is one of the few Java API’s I played with. • It’s one of the most important things for an Oracle/Java developer

  5. JDBC 4.0 in 10 minutes • What’s New! • SQLXML support • Connection management • Enhanced SQLExceptions • Ease of use • Annotations • ROWID data type • Automatic driver loading • Enhanced BLOB and CLOB support • Wrapper Pattern • National Character set Conversion support

  6. JDBC 4.0 in 10 minutes • SQLXML support Code sample 1 Just put the result in a string to process further. SQLXML xmlVal= rs.getSQLXML(1); String xmlstr = xmlVal.getString(); Code sample 2 Put the content of SQLXML in an object. javax.xml.stream.XMLStreamReader

  7. JDBC 4.0 in 10 minutes SQLXML xmlVal= rs.getSQLXML(1); XMLStreamReader aReader = xmlVal.createStreamReader(); while(aReader.hasNext()) { // parse the next event for (int event = reader.next(); event != XMLStreamConstants.END_DOCUMENT; event = reader.next()) { switch (event) { case XMLStreamConstants.START_ELEMENT: // process the element … break; } }

  8. JDBC 4.0 in 10 minutes • Connection management Connection Added setCientInfo() Added getClientInfo() Added isValid() PreparedStatement Added setPoolable() Added isPoolable() (default TRUE)

  9. JDBC 4.0 in 10 minutes • Enhanced SQLExceptions • Added SQLNonTransientException • SQLSyntaxErrorException • SQLInvalidAuthorizationSpecException • SQLIntegrityConstraintViolationException • SQLDataException • SQLNonTransientConnectionException • Added SQLTransientException Error might not occur when statement is re-executed. • SQLTimeoutException • SQLTransactionRollbackException • SQLTransientConnectionException

  10. JDBC 4.0 in 10 minutes Questions

  11. JDBC 4.0 in 10 minutes Sources. JDBC 4.0 API Specification - Early Draft Release 2 Available on http://java.sun.com And http://java.sys-con.com/read/111252.htm

More Related