﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-探索与发现-随笔分类-jdbc</title><link>http://www.blogjava.net/zhaijianhui/category/11309.html</link><description>研究java技术</description><language>zh-cn</language><lastBuildDate>Wed, 28 Feb 2007 20:13:49 GMT</lastBuildDate><pubDate>Wed, 28 Feb 2007 20:13:49 GMT</pubDate><ttl>60</ttl><item><title>jdbc3.0自动增长类型取值方案</title><link>http://www.blogjava.net/zhaijianhui/archive/2006/05/19/46952.html</link><dc:creator>蜘蛛</dc:creator><author>蜘蛛</author><pubDate>Fri, 19 May 2006 00:33:00 GMT</pubDate><guid>http://www.blogjava.net/zhaijianhui/archive/2006/05/19/46952.html</guid><wfw:comment>http://www.blogjava.net/zhaijianhui/comments/46952.html</wfw:comment><comments>http://www.blogjava.net/zhaijianhui/archive/2006/05/19/46952.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/zhaijianhui/comments/commentRss/46952.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/zhaijianhui/services/trackbacks/46952.html</trackback:ping><description><![CDATA[ MySQL Connector/J下载地址<br />http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-3.1.12.zip/<br />主要新增功能是:<br />The driver now also supports "streaming" result sets, which allows users to retrieve large numbers of rows without using a large memory buffer. With newly added large-packet protocol support, the driver can send rows and BLOBs up to 2 gigabytes in size.
<p>New features from the JDBC-3.0 API in the latest production version of MySQL Connector/J include <code>getGeneratedKeys</code> which allows users to retrieve auto-increment fields in a non-database-specific way. Auto-increment fields now work with object-relational mapping tools, as well as Enterprise Java Beans (EJB) servers with Container Managed Persistence (CMP) that support JDBC-3.0.</p><p>The development version is being refactored to support new features in conjunction with version 4.1 of the MySQL database server, including server-side prepared statements and improved handling of multiple simultaneous character sets, including Unicode in the UCS2 and UTF8 encodings.</p>Retrieval of Auto Generated Keys:<br />主要针对自动增长类型的数据取值的问题：<br />比如我们插入一条数据：<br />像原来jdbc2.0时我们这样干的：<br /><pre>Int rowcount = stmt.executeUpdate (
"insert into LocalGeniusList (name) values ('Karen')"); // insert row
</pre><pre>// now get the disk address – rowid – for the newly inserted row
ResultSet rs = stmt.executeQuery (

"select rowid from LocalGeniusList where name = 'Karen'");
jdbc3.0时我们可以在插入一条记录时同时得到行数，<br />还可以访问到自动增长的数据如：<br /><pre>Int rowcount = stmt.executeUpdate (
</pre><pre>"insert into LocalGeniusList (name) values ('Karen'),
Statement.RETURN_GENERATED_KEYS); // insert row AND return key
</pre><pre>ResultSet rs = stmt.getGeneratedKeys (); // key is automatically available<br />而有些数据库不支持自动增长类型的数据，jdbc3.0也给出相应的支持:<br />// insert the row and specify that you want the employee ID returned as the key
Int rowcount = stmt.executeUpdate (
"insert into LocalGeniusList (name) values ('Karen'),
"employeeID");
<pre>ResultSet rs = stmt.getGeneratedKeys (); // Karen's employeeID value is now available
要想了解更多的jdbc3.0可以参考下面的网站:<br /><a href="http://www.datadirect.com/developer/jdbc/topics/jdbc30/index.ssp">http://www.datadirect.com/developer/jdbc/topics/jdbc30/index.ssp</a><br /><a href="http://www-128.ibm.com/developerworks/java/library/j-jdbcnew/">http://www-128.ibm.com/developerworks/java/library/j-jdbcnew/</a><br /><a href="http://www.onjava.com/pub/a/onjava/synd/2001/08/21/jdbc.html?page=3">http://www.onjava.com/pub/a/onjava/synd/2001/08/21/jdbc.html?page=3</a><br />jdbc4.0参考网站<br /><a href="http://www.theserverside.com/news/thread.tss?thread_id=34465">http://www.theserverside.com/news/thread.tss?thread_id=34465</a><br /><a href="http://weblogs.java.net/blog/lancea/archive/2006/05/jdbc_40_sqlxml.html">http://weblogs.java.net/blog/lancea/archive/2006/05/jdbc_40_sqlxml.html</a><br /><a href="http://java.sys-con.com/read/111252.htm">http://java.sys-con.com/read/111252.htm</a><br />下载jdbc4.0规范<br /><a href="http://192.18.108.135/ECom/EComTicketServlet/BEGIN747810F695946413098EEF45230B1F12/-2147483648/1488530847/1/686798/686786/1488530847/2ts+/westCoastFSEND/jdbc-4.0-pr-spec-oth-JSpec/jdbc-4.0-pr-spec-oth-JSpec:2/jdbc4.0-pd-spec.pdf">http://192.18.108.135/ECom/EComTicketServlet/BEGIN747810F695946413098EEF45230B1F12/-2147483648/1488530847/1/686798/686786/1488530847/2ts+/westCoastFSEND/jdbc-4.0-pr-spec-oth-JSpec/jdbc-4.0-pr-spec-oth-JSpec:2/jdbc4.0-pd-spec.pdf</a></pre></pre></pre><img src ="http://www.blogjava.net/zhaijianhui/aggbug/46952.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/zhaijianhui/" target="_blank">蜘蛛</a> 2006-05-19 08:33 <a href="http://www.blogjava.net/zhaijianhui/archive/2006/05/19/46952.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>