<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Hello Seem to be a hardest word &#187; JDBC</title>
	<atom:link href="http://kavax.wordpress.com/category/java-tech/jdbc-java-tech/feed/" rel="self" type="application/rss+xml" />
	<link>http://kavax.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Sun, 22 Jun 2008 12:05:09 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>vi</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='kavax.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/189847eaa2c7096e5cd4dde549f4d5cd?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Hello Seem to be a hardest word &#187; JDBC</title>
		<link>http://kavax.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://kavax.wordpress.com/osd.xml" title="Hello Seem to be a hardest word" />
		<item>
		<title>PreparedStatement.setTimestamp(1,datetime)</title>
		<link>http://kavax.wordpress.com/2008/04/07/preparedstatementsettimestamp1datetime/</link>
		<comments>http://kavax.wordpress.com/2008/04/07/preparedstatementsettimestamp1datetime/#comments</comments>
		<pubDate>Mon, 07 Apr 2008 13:19:53 +0000</pubDate>
		<dc:creator>fate</dc:creator>
				<category><![CDATA[JDBC]]></category>

		<guid isPermaLink="false">http://kavax.wordpress.com/?p=51</guid>
		<description><![CDATA[Trong sqlserver có 1 cột DateTime
Trong java nếu dùng preparedStatement rồi thiết lập giá trị cho tham số cho field dateTime này thì nên dùng setTimestamp method.
Ví dụ:
// xem ky hai dong nay
		java.sql.Timestamp tstamp = new java.sql.Timestamp(00-00-00);
		ps.setTimestamp(5,tstamp.valueOf(&#8220;1986-04-02 00:00:00.0&#8243;));

Toàn bộ sourcecode

//http://www.roseindia.net/jdbc/jdbc-mysql/SetTimetamp.shtml
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.Timestamp;
public class SinhVien
{
	public static void main(String args[])	throws Exception
	{
		Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
		Connection conn = [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kavax.wordpress.com&blog=3270419&post=51&subd=kavax&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Trong sqlserver có 1 cột DateTime</p>
<p>Trong java nếu dùng preparedStatement rồi thiết lập giá trị cho tham số cho field dateTime này thì nên dùng setTimestamp method.</p>
<p>Ví dụ:<br />
// xem ky hai dong nay<br />
		java.sql.Timestamp tstamp = new java.sql.Timestamp(00-00-00);<br />
		ps.setTimestamp(5,tstamp.valueOf(&#8220;1986-04-02 00:00:00.0&#8243;));<br />
<span id="more-51"></span><br />
Toàn bộ sourcecode</p>
<p><code><br />
//http://www.roseindia.net/jdbc/jdbc-mysql/SetTimetamp.shtml</p>
<p>import java.sql.DriverManager;<br />
import java.sql.Connection;<br />
import java.sql.PreparedStatement;<br />
import java.sql.ResultSet;<br />
import java.sql.ResultSetMetaData;<br />
import java.sql.Timestamp;</p>
<p>public class SinhVien<br />
{<br />
	public static void main(String args[])	throws Exception<br />
	{<br />
		Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();<br />
		Connection conn = DriverManager.getConnection("jdbc:odbc:QUANLY_SINHVIEN");<br />
		PreparedStatement ps;</p>
<p>		String sql="insert into tbSV(HoLot,Ten,Nu,DChi,NgSinh,NamVaoHoc,MaLop) ";<br />
		sql+=" values(?,?,?,?,?,?,?)";<br />
		ps = conn.prepareStatement(sql);<br />
		ps.setString(1,"abcxyz");<br />
		ps.setString(2,"jguru");<br />
		ps.setBoolean(3,false);<br />
		ps.setString(4,"Phu Nhuan");</p>
<p>		// xem ky hai dong nay<br />
		Timestamp tstamp = new Timestamp(00-00-00);<br />
		ps.setTimestamp(5,tstamp.valueOf("1986-04-02 00:00:00.0"));</p>
<p>		ps.setInt(6,2004);<br />
		ps.setString(7,"TH04");<br />
		ps.executeUpdate();</p>
<p>		ps = conn.prepareStatement("select * from tbSV");<br />
		ResultSet rs = ps.executeQuery();<br />
		viewTable(rs);</p>
<p>		rs.close();<br />
		ps.close();<br />
		conn.close();<br />
	}</p>
<p>	static void viewTable(ResultSet rs)	throws Exception<br />
	{<br />
		ResultSetMetaData md = rs.getMetaData();<br />
		int n = md.getColumnCount();<br />
		while(rs.next())<br />
		{<br />
			for(int i=1;i&lt;=n;i++)<br />
				System.out.printf("\t %s",rs.getString(i));<br />
			System.out.println();<br />
		}<br />
	}<br />
}<br />
</code></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/kavax.wordpress.com/51/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/kavax.wordpress.com/51/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kavax.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kavax.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kavax.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kavax.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kavax.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kavax.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kavax.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kavax.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kavax.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kavax.wordpress.com/51/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kavax.wordpress.com&blog=3270419&post=51&subd=kavax&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://kavax.wordpress.com/2008/04/07/preparedstatementsettimestamp1datetime/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/348544c759d3cca37771632e0b9b15a7?s=96&#38;d=identicon" medium="image">
			<media:title type="html">sacramental</media:title>
		</media:content>
	</item>
		<item>
		<title>Ánh xạ kiểu dữ liệu giữa SQLSERVER và Java</title>
		<link>http://kavax.wordpress.com/2008/04/01/anh-x%e1%ba%a1-ki%e1%bb%83u-d%e1%bb%af-li%e1%bb%87u-gi%e1%bb%afa-sqlserver-va-java/</link>
		<comments>http://kavax.wordpress.com/2008/04/01/anh-x%e1%ba%a1-ki%e1%bb%83u-d%e1%bb%af-li%e1%bb%87u-gi%e1%bb%afa-sqlserver-va-java/#comments</comments>
		<pubDate>Tue, 01 Apr 2008 14:36:09 +0000</pubDate>
		<dc:creator>fate</dc:creator>
				<category><![CDATA[JDBC]]></category>

		<guid isPermaLink="false">http://kavax.wordpress.com/2008/04/01/anh-x%e1%ba%a1-ki%e1%bb%83u-d%e1%bb%af-li%e1%bb%87u-gi%e1%bb%afa-sqlserver-va-java/</guid>
		<description><![CDATA[	8	 Mapping SQL data types into Java

8.1 	      Constraints
 We need to provide reasonable Java mappings for the common SQL data types. We also need  to make sure that we have enough type information so that we can correctly store and retrieve  parameters and recover results from SQL statements.  [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kavax.wordpress.com&blog=3270419&post=36&subd=kavax&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><h2>	8	 Mapping SQL data types into Java</h2>
<p><a title="1763" name="1763"></a></p>
<h3>8.1 	      Constraints</h3>
<p><a title="1764" name="1764"></a> We need to provide reasonable Java mappings for the common SQL data types. We also need  to make sure that we have enough type information so that we can correctly store and retrieve  parameters and recover results from SQL statements. <a title="6645" name="6645"></a> However, there is no particular reason that the Java data type needs to be exactly isomorphic  to the SQL data type. For example, since Java has no fixed length arrays, we can represent both  fixed length and variable length SQL arrays as variable length Java arrays. We also felt free to  use Java Strings even though they don&#8217;t precisely match any of the SQL CHAR types.</p>
<p><a title="6736" name="6736"></a> Table <a href="http://java.sun.com/j2se/1.3/docs/guide/jdbc/spec/jdbc-spec.frame8.html#27081">2</a> shows the default Java mapping for various common SQL data types. Not all of these  types will necessarily be supported by all databases. The various mappings are described more  fully in the following sections.</p>
<p><span id="more-36"></span></p>
<p><a title="28629" name="28629"></a></p>
<table border="3">
<tr>
<th>SQL type</th>
<th>Java Type</th>
</tr>
<tr>
<td>CHAR</td>
<td>String</td>
</tr>
<tr>
<td>VARCHAR</td>
<td>String</td>
</tr>
<tr>
<td>LONGVARCHAR</td>
<td>String</td>
</tr>
<tr>
<td>NUMERIC</td>
<td>java.math.BigDecimal</td>
</tr>
<tr>
<td>DECIMAL</td>
<td>java.math.BigDecimal</td>
</tr>
<tr>
<td>BIT</td>
<td>boolean</td>
</tr>
<tr>
<td>TINYINT</td>
<td>byte</td>
</tr>
<tr>
<td>SMALLINT</td>
<td>short</td>
</tr>
<tr>
<td>INTEGER</td>
<td>int</td>
</tr>
<tr>
<td>BIGINT</td>
<td>long</td>
</tr>
<tr>
<td>REAL</td>
<td>float</td>
</tr>
<tr>
<td>FLOAT</td>
<td>double</td>
</tr>
<tr>
<td>DOUBLE</td>
<td>double</td>
</tr>
<tr>
<td>BINARY</td>
<td>byte[]</td>
</tr>
<tr>
<td>VARBINARY</td>
<td>byte[]</td>
</tr>
<tr>
<td>LONGVARBINARY</td>
<td>byte[]</td>
</tr>
<tr>
<td>DATE</td>
<td>java.sql.Date</td>
</tr>
<tr>
<td>TIME</td>
<td>java.sql.Time</td>
</tr>
<tr>
<td>TIMESTAMP</td>
<td>java.sql.Timestamp</td>
</tr>
</table>
<table>
<tr>
<td>&nbsp;</td>
</tr>
</table>
<p><a title="28556" name="28556"></a> Similarly table <a href="http://java.sun.com/j2se/1.3/docs/guide/jdbc/spec/jdbc-spec.frame8.html#28688">3</a> shows the reverse mapping from Java types to SQL types.</p>
<table border="3">
<tr>
<th>Java Type</th>
<th>SQL type</th>
</tr>
<tr>
<td>String</td>
<td>VARCHAR or LONGVARCHAR</td>
</tr>
<tr>
<td>java.math.BigDecimal</td>
<td>NUMERIC</td>
</tr>
<tr>
<td>boolean</td>
<td>BIT</td>
</tr>
<tr>
<td>byte</td>
<td>TINYINT</td>
</tr>
<tr>
<td>short</td>
<td>SMALLINT</td>
</tr>
<tr>
<td>int</td>
<td>INTEGER</td>
</tr>
<tr>
<td>long</td>
<td>BIGINT</td>
</tr>
<tr>
<td>float</td>
<td>REAL</td>
</tr>
<tr>
<td>double</td>
<td>DOUBLE</td>
</tr>
<tr>
<td>byte[]</td>
<td>VARBINARY or LONGVARBINARY</td>
</tr>
<tr>
<td>java.sql.Date</td>
<td>DATE</td>
</tr>
<tr>
<td>java.sql.Time</td>
<td>TIME</td>
</tr>
<tr>
<td>java.sql.Timestamp</td>
<td>TIMESTAMP</td>
</tr>
</table>
<table>
<tr>
<td>&nbsp;</td>
</tr>
</table>
<p><a title="27091" name="27091"></a></p>
<p><a title="27092" name="27092"></a></p>
<p><a title="27093" name="27093"></a></p>
<p><a title="11100" name="11100"></a></p>
<h3>8.2 	      Dynamic data access</h3>
<p><a title="16864" name="16864"></a> This chapter focuses on access to results or parameters whose types are known at compile time.  However, some applications, for example generic browsers or query tools, are not compiled  with knowledge of the database schema they will access, so JDBC also provides support for  fully dynamically typed data access. See Section <a href="http://java.sun.com/j2se/1.3/docs/guide/jdbc/spec/jdbc-spec.frame14.html#6552">14.2</a>.  <a title="15953" name="15953"></a></p>
<h3>8.3 	      CHAR, VARCHAR, and LONGVARCHAR</h3>
<p><a title="1216" name="1216"></a> There is no need for Java programmers to distinguish among the three different flavours of  SQL strings CHAR, VARCHAR, and LONGVARCHAR. These can all be expressed identically in Java. It is possible to read and write the SQL correctly without needing to know the  exact data type that was expected. <a title="1638" name="1638"></a> These types could be mapped to either String or char[]. After considerable discussion we decided to use String, as this seemed the more appropriate type for normal use. Note that the Java  String class provides a method for converting a String to a char[] and a constructor for turning  a char[] into a String.</p>
<p><a title="20918" name="20918"></a> For fixed length SQL strings of type CHAR(n), the JDBC drivers will perform appropriate padding with spaces. Thus when a CHAR(n) field is retrieved from the database the resulting  String will always be of length &#8220;n&#8221; and may include some padding spaces at the end. When a  String is sent to a CHAR(n) field, the driver and/or the database will add any necessary padding  spaces to the end of the String to bring it up to length &#8220;n&#8221;.</p>
<p><a title="1645" name="1645"></a> The ResultSet.getString method allocates and returns a new String. This is suitable for retrieving normal data, but the LONGVARCHAR SQL type can be used to store multi-megabyte  strings. We therefore needed to provide a way for Java programmers to retrieve a LONGVARCHAR value in chunks. We handle this by allowing programmers to retrieve a LONGVARCHAR as a Java input stream from which they can subsequently read data in whatever chunks  they prefer. Java streams can be used for either Unicode or Ascii data, so the programmer may  chose to use either getAsciiStream or getUnicodeStream.</p>
<p><a title="1251" name="1251"></a></p>
<h3>8.4 	      DECIMAL and NUMERIC</h3>
<p><a title="1667" name="1667"></a> The SQL DECIMAL and NUMERIC data types are used to express fixed point numbers where  absolute precision is required. They are often used for currency values. <a title="1674" name="1674"></a> These two types can be expressed identically in Java. The most convenient mapping uses the  java.math.BigDecimal extended precision number type provided in JDK1.1</p>
<p><a title="1672" name="1672"></a> We also allow access to DECIMAL and NUMERIC as simple Strings and arrays of chars. Thus  Java programmers can use getString to receive a NUMERIC or DECIMAL result.</p>
<p><a title="8206" name="8206"></a></p>
<h3>8.5 	      BINARY, VARBINARY, and LONGVARBINARY</h3>
<p><a title="1732" name="1732"></a> There is no need for Java programmers to distinguish among the three different flavours of  SQL byte arrays BINARY, VARBINARY, and LONGVARBINARY. These can all be expressed identically as byte arrays in Java. (It is possible to read and write the SQL correctly  without needing to know the exact BINARY data type that was expected.) <a title="1746" name="1746"></a> As with the LONGVARCHAR SQL type, the LONGVARBINARY SQL type can sometimes  be used to return multi-megabyte data values. We therefore allow a LONGVARBINARY value to be retrieved as a Java input stream, from which programmers can subsequently read data  in whatever chunks they prefer.</p>
<p><a title="1758" name="1758"></a></p>
<h3>8.6 	      BIT</h3>
<p><a title="1778" name="1778"></a> The SQL BIT type can be mapped directly to the Java boolean type.  <a title="1779" name="1779"></a></p>
<h3>8.7 	      TINYINT, SMALLINT, INTEGER, and BIGINT</h3>
<p><a title="1780" name="1780"></a> The SQL TINYINT, SMALLINT, INTEGER, and BIGINT types represent 8 bit, 16 bit, 32 bit,  and 64 bit values. These therefore can be mapped to Java&#8217;s byte, short, int, and long data types.  <a title="1759" name="1759"></a></p>
<h3>8.8 	      REAL, FLOAT, and DOUBLE</h3>
<p><a title="50247" name="50247"></a> SQL defines three floating point data types, REAL, FLOAT, and DOUBLE. <a title="50248" name="50248"></a> We map REAL to Java float, and FLOAT and DOUBLE to Java double.</p>
<p><a title="50249" name="50249"></a> REAL is required to support 7 digits of mantissa precision. FLOAT and DOUBLE are required  to support 15 digits of mantissa precision.</p>
<p><a title="1833" name="1833"></a></p>
<h3>8.9 	      DATE, TIME, and TIMESTAMP</h3>
<p><a title="1834" name="1834"></a> SQL defines three time related data types. DATE consists of day, month, and year. TIME consists of hours, minutes and seconds. TIMESTAMP combines DATE and TIME and also adds  in a nanosecond field. <a title="6050" name="6050"></a> There is a standard Java class java.util.Date that provides date and time information. However,  this class doesn&#8217;t perfectly match any of the three SQL types, as it includes both DATE and  TIME information, but lacks the nanosecond granularity required for TIMESTAMP.</p>
<p><a title="6056" name="6056"></a> We therefore define three subclasses of java.util.Date. These are:</p>
<ul><a title="6057" name="6057"></a></p>
<li>java.sql.Date for SQL DATE information
<p><a title="6058" name="6058"></a></li>
<li>java.sql.Time for SQL TIME information
<p><a title="6061" name="6061"></a></li>
<li>java.sql.Timestamp for SQL TIMESTAMP information</li>
</ul>
<p><a title="1840" name="1840"></a> In the case of java.sql.Date the hour, minute, second, and milli-second fields of the java.util.Date base class are set to zero. <a title="6076" name="6076"></a> In the case of java.sql.Time the year, month, and day fields of the java.util.Date base class are  set to 1970, January, and 1, respectively. This is the &#8220;zero&#8221; date in the Java epoch.</p>
<p><a title="6077" name="6077"></a> The java.sql.Timestamp class extends java.util.Date by adding a nanosecond field.</p>
<p>theo nguồn <a href="http://java.sun.com/j2se/1.3/docs/guide/jdbc/spec/jdbc-spec.frame8.html">java.sun.com tutorial</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/kavax.wordpress.com/36/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/kavax.wordpress.com/36/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kavax.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kavax.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kavax.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kavax.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kavax.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kavax.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kavax.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kavax.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kavax.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kavax.wordpress.com/36/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kavax.wordpress.com&blog=3270419&post=36&subd=kavax&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://kavax.wordpress.com/2008/04/01/anh-x%e1%ba%a1-ki%e1%bb%83u-d%e1%bb%af-li%e1%bb%87u-gi%e1%bb%afa-sqlserver-va-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/348544c759d3cca37771632e0b9b15a7?s=96&#38;d=identicon" medium="image">
			<media:title type="html">sacramental</media:title>
		</media:content>
	</item>
		<item>
		<title>Cài đặt &#8211; Cấu hình &#8211; Sử dụng JavaDB (derby)</title>
		<link>http://kavax.wordpress.com/2008/03/30/cai-d%e1%ba%b7t-c%e1%ba%a5u-hinh-s%e1%bb%ad-d%e1%bb%a5ng-javadb-derby/</link>
		<comments>http://kavax.wordpress.com/2008/03/30/cai-d%e1%ba%b7t-c%e1%ba%a5u-hinh-s%e1%bb%ad-d%e1%bb%a5ng-javadb-derby/#comments</comments>
		<pubDate>Sun, 30 Mar 2008 05:27:52 +0000</pubDate>
		<dc:creator>fate</dc:creator>
				<category><![CDATA[JDBC]]></category>

		<guid isPermaLink="false">http://kavax.wordpress.com/2008/03/30/cai-d%e1%ba%b7t-c%e1%ba%a5u-hinh-s%e1%bb%ad-d%e1%bb%a5ng-javadb-derby/</guid>
		<description><![CDATA[http://www.netbeans.org/kb/60/ide/java-db.html
http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javadb/
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kavax.wordpress.com&blog=3270419&post=33&subd=kavax&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://www.netbeans.org/kb/60/ide/java-db.html">http://www.netbeans.org/kb/60/ide/java-db.html</a></p>
<p><a href="http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javadb/">http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javadb/</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/kavax.wordpress.com/33/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/kavax.wordpress.com/33/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kavax.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kavax.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kavax.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kavax.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kavax.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kavax.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kavax.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kavax.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kavax.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kavax.wordpress.com/33/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kavax.wordpress.com&blog=3270419&post=33&subd=kavax&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://kavax.wordpress.com/2008/03/30/cai-d%e1%ba%b7t-c%e1%ba%a5u-hinh-s%e1%bb%ad-d%e1%bb%a5ng-javadb-derby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/348544c759d3cca37771632e0b9b15a7?s=96&#38;d=identicon" medium="image">
			<media:title type="html">sacramental</media:title>
		</media:content>
	</item>
		<item>
		<title>Netbeans Database Application tutorial</title>
		<link>http://kavax.wordpress.com/2008/03/30/netbeans-database-application-tutorial/</link>
		<comments>http://kavax.wordpress.com/2008/03/30/netbeans-database-application-tutorial/#comments</comments>
		<pubDate>Sun, 30 Mar 2008 04:21:21 +0000</pubDate>
		<dc:creator>fate</dc:creator>
				<category><![CDATA[JDBC]]></category>

		<guid isPermaLink="false">http://kavax.wordpress.com/2008/03/30/netbeans-database-application-tutorial/</guid>
		<description><![CDATA[http://www.netbeans.org/kb/60/java/gui-db.html
http://www.netbeans.org/kb/60/java/gui-binding.html
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kavax.wordpress.com&blog=3270419&post=32&subd=kavax&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://www.netbeans.org/kb/60/java/gui-db.html">http://www.netbeans.org/kb/60/java/gui-db.html</a></p>
<p><a href="http://www.netbeans.org/kb/60/java/gui-binding.html">http://www.netbeans.org/kb/60/java/gui-binding.html</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/kavax.wordpress.com/32/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/kavax.wordpress.com/32/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kavax.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kavax.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kavax.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kavax.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kavax.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kavax.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kavax.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kavax.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kavax.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kavax.wordpress.com/32/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kavax.wordpress.com&blog=3270419&post=32&subd=kavax&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://kavax.wordpress.com/2008/03/30/netbeans-database-application-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/348544c759d3cca37771632e0b9b15a7?s=96&#38;d=identicon" medium="image">
			<media:title type="html">sacramental</media:title>
		</media:content>
	</item>
		<item>
		<title>ElegantJ Data Tables JAVABean</title>
		<link>http://kavax.wordpress.com/2008/03/30/elegantj-data-tables-javabean/</link>
		<comments>http://kavax.wordpress.com/2008/03/30/elegantj-data-tables-javabean/#comments</comments>
		<pubDate>Sun, 30 Mar 2008 00:17:01 +0000</pubDate>
		<dc:creator>fate</dc:creator>
				<category><![CDATA[JDBC]]></category>

		<guid isPermaLink="false">http://kavax.wordpress.com/?p=31</guid>
		<description><![CDATA[ElegantJ Data Tables JAVABean



Ready to use Table component that has all you wished to have
Be it a 4 row by 10 column table or a table to represent a database in tabular form, or a spreadsheet solution, you can rely on ElegantJ Data Tables Bean. From AWT Data Table and JFC Data Table, select the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kavax.wordpress.com&blog=3270419&post=31&subd=kavax&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://www.elegantjbeans.com/dwnstart_datatable_bean.htm"><b>ElegantJ Data Tables JAVABean</b></a></p>
<table align="center" border="0" cellpadding="0" cellspacing="0" width="415">
<tr>
<td>
<h1 class="paratext_12"><b>Ready to use Table component that has all you wished to have</b></h1>
<p class="paratext_12">Be it a 4 row by 10 column table or a table to represent a database in tabular form, or a spreadsheet solution, you can rely on ElegantJ Data Tables Bean. From AWT Data Table and JFC Data Table, select the one that suits your need. Both can handle large volume of data. Get the data filled directly from data source. A cell can be edited as a Textbox, Text Area, Checkbox, Combo box, a Button, an icon, Boolean, etc. Manage data with maximum flexibility using Bean&#8217;s formatting, editing, navigating and data handling features. Ready to use Search Panel, functions of insert, add or delete a row as well as column and sorting.</p>
<p><span id="more-31"></span></p>
<p class="paratext_12">ElegantJ Data Tables Bean offers total control over data management through table.</p>
</td>
</tr>
<tr>
<td align="center" height="355"><img src="http://www.elegantjbeans.com/images/datatable_bean_gallery.jpg" alt="Data Aware Table JAVA Bean Collection " height="317" width="368" /></td>
</tr>
<tr>
<td>
<ul class="listtext_bullets">
<li>For small table as well as large tables</li>
<li>AWT and JFC components</li>
<li>Insert, Delete or Change a row</li>
<li>Control editability at row / column or table level</li>
<li>Data access from a database, text or an XML file</li>
<li>Supports JDBC and protocols like FILE, FTP and HTTP for interfacing with data source</li>
<li>Highly flexible and configurable</li>
<li>Page setup and printing features</li>
<li>Ready to use search panel, sort and right-click menu</li>
</ul>
</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td>
<p class="paratext_12"><b>Efficient Data handling</b><br />
Data Access Beans that are shipped with this bean are so powerful and flexible; they can work in most of the limitations imposed by architectural circumstances, security and accessibility constraints on servers. With ElegantJ Data Access Bean, you will be able connect and communicate with any computer through protocols like FILE, JDBC, FTP or HTTP.</p>
<p class="paratext_12"><b>Java™ Library</b><br />
ElegantJBeans is a collection of JavaBeans™ Components developed for Java professionals. Development platform is not a constraint for ElegantJBeans. You can use ElegantJBeans component with J2SE, J2EE, Java applications and Java applets. ElegantJBeans can be imported in all major IDEs &#8211; to use it visually as well as through coding.</p>
<p class="paratext_12"> 					<b>We support YOU, so you support YOUR users.</b><br />
Use our pre-prepared code in your application to speed up your development process. We provide FREE pre-purchase technical support to ensure successful evaluation. We provide total assistance from installing them, importing in all major IDEs and mapping a feature with your requirements. What you have to do is just mail us. We will help you find out if our Beans have a feature that you need. We also provide comprehensive technical documentation so that you can have answers for all your queries on your fingertip.</td>
</tr>
</table>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/kavax.wordpress.com/31/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/kavax.wordpress.com/31/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kavax.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kavax.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kavax.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kavax.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kavax.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kavax.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kavax.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kavax.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kavax.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kavax.wordpress.com/31/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kavax.wordpress.com&blog=3270419&post=31&subd=kavax&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://kavax.wordpress.com/2008/03/30/elegantj-data-tables-javabean/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/348544c759d3cca37771632e0b9b15a7?s=96&#38;d=identicon" medium="image">
			<media:title type="html">sacramental</media:title>
		</media:content>

		<media:content url="http://www.elegantjbeans.com/images/datatable_bean_gallery.jpg" medium="image">
			<media:title type="html">Data Aware Table JAVA Bean Collection </media:title>
		</media:content>
	</item>
		<item>
		<title>Data Table Components in Sun Java(TM) Studio Creator 2</title>
		<link>http://kavax.wordpress.com/2008/03/30/data-table-components-in-sun-javatm-studio-creator-2/</link>
		<comments>http://kavax.wordpress.com/2008/03/30/data-table-components-in-sun-javatm-studio-creator-2/#comments</comments>
		<pubDate>Sun, 30 Mar 2008 00:11:20 +0000</pubDate>
		<dc:creator>fate</dc:creator>
				<category><![CDATA[JDBC]]></category>

		<guid isPermaLink="false">http://kavax.wordpress.com/2008/03/30/data-table-components-in-sun-javatm-studio-creator-2/</guid>
		<description><![CDATA[Background









 Sun Java Studio Creator 2 introduced new &#8220;basic&#8221; components to the Palette, while retaining the JavaServer Faces components the previous version, called &#8220;standard&#8221; components.

This technical tip explains how to bind a database table (that you have dropped on a page in the Java Studio Creator 2 IDE) to a Data Table component, which is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kavax.wordpress.com&blog=3270419&post=30&subd=kavax&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><div><b>Background</b></div>
<div class="contentdivider">
<table class="grey4" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td><img src="http://developers.sun.com/im/a.gif" alt=" " border="0" height="4" width="1" /></td>
</tr>
</table>
</div>
<table border="0" cellpadding="4" cellspacing="0" width="100%">
<tr>
<td valign="top"> Sun Java Studio Creator 2 introduced new &#8220;basic&#8221; components to the Palette, while retaining the JavaServer Faces components the previous version, called &#8220;standard&#8221; components.</p>
<p><span id="more-30"></span></p>
<p>This technical tip explains how to bind a database table (that you have dropped on a page in the Java Studio Creator 2 IDE) to a Data Table component, which is a standard component from the previous version of the IDE, Java Studio Creator 2004Q2. Standard components have been maintained in Java Studio Creator 2 so that pages from projects developed with Java Studio Creator 2004Q2 can work without modifications. You can find these standard components on the Palette in the Standard section.</p>
<p>In Java Studio Creator 2, data provider components bind the Table component to a database table. That is, when you drop a database table on a Table component on a page, the IDE uses a data provider to bind the Table component to the database table.</p>
<p>If you use a Data Table component from the Standard section of the Palette, the Data Table component cannot be bound to the database table using a data provider. However, by manually binding the component to the database table, it is possible to create pages that use both standard components and basic components. Follow the instructions below to bind a database table to a Standard Data Table component.</td>
<td></td>
<td valign="top">
<table class="grey4" border="0" cellpadding="2" cellspacing="0">
<tr>
<td align="center"><img src="http://developers.sun.com/jscreator/reference/techart/2/bindingDataTableComponents/chary_kanaparthi.jpg" alt="Chary Kanaparthi" border="0" /><a name="author"></a></td>
</tr>
<tr>
<td>
<div class="pad3"><span class="dkcaption1"><b>Chary Kanaparthi</b> is a member of the Quality Engineering team for  Java Studio Creator. </span></div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p><span class="sp10"> </span><br />
<a name="02"></a></p>
<div><b>Binding a Data Table Component to a Database Table</b></div>
<div class="contentdivider">
<table class="grey4" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td><img src="http://developers.sun.com/im/a.gif" alt=" " border="0" height="4" width="1" /></td>
</tr>
</table>
</div>
<p>You can bind a Data Table component to a database table using the Table Layout dialog. You  actually bind the Data Table component to the database table&#8217;s RowSet. Follow the steps outlined  here to see how this is accomplished.</p>
<ol>
<li>Drop a Data Table from the Standard section of the Palette on to a page in the Design window.</li>
<li>Add a database table to the page. In the Servers window, right-click a database table from the  Data Sources node and select Add to Page from the context menu.</li>
<li>Select  the Data Table component. You can select the component in the Outline window or on  the Design window page. Right-click to bring up its context menu and click Table Layout.</li>
<li>From the Table Layout dialog, select  the appropriate RowSet for the Get data from: prompt.  Click OK.  Figure 1 shows personRowSet selected from the dropdown list.</li>
</ol>
<table border="0" cellpadding="2" cellspacing="0" width="600">
<tr>
<td align="center"><img src="http://developers.sun.com/jscreator/reference/techart/2/bindingDataTableComponents/StdTableLayout.jpg" alt="Bind Table to RowSet" border="0" height="483" width="508" /></p>
<div class="pad3"> <span class="dkcaption1"> <b>Figure 1</b>: Bind Table to RowSet</span></div>
</td>
</tr>
</table>
<p><span class="sp10"> </span><br />
After the operation completes, the Data Table component on the page changes to reflect the  binding to the database table. The Data Table is now bound to the PERSON database table,  personRowSet, as shown in Figure 2.</p>
<table border="0" cellpadding="2" cellspacing="0" width="600">
<tr>
<td align="center"><img src="http://developers.sun.com/jscreator/reference/techart/2/bindingDataTableComponents/StdTableComponent.jpg" alt="Standard Data Table Component After Binding" border="0" height="211" width="402" /></p>
<div class="pad3"> <span class="dkcaption1"> <b>Figure 2</b>: Standard Data Table Component After Binding</span></div>
</td>
</tr>
</table>
<p><span class="sp10"> </span><br />
<a name="06"></a></p>
<div><b>More Developer Resources</b></div>
<div class="contentdivider">
<table class="grey4" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td><img src="http://developers.sun.com/im/a.gif" alt=" " border="0" height="4" width="1" /></td>
</tr>
</table>
</div>
<p><span class="sp10"> </span><br />
For more tech tips, articles, forums, tutorials, weblogs, and other expert advice for developers, visit the Java Studio Creator developer resources on the Sun Developer Network (SDN) at <a href="http://developers.sun.com/jscreator/">http://developers.sun.com/jscreator/</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/kavax.wordpress.com/30/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/kavax.wordpress.com/30/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kavax.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kavax.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kavax.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kavax.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kavax.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kavax.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kavax.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kavax.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kavax.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kavax.wordpress.com/30/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kavax.wordpress.com&blog=3270419&post=30&subd=kavax&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://kavax.wordpress.com/2008/03/30/data-table-components-in-sun-javatm-studio-creator-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/348544c759d3cca37771632e0b9b15a7?s=96&#38;d=identicon" medium="image">
			<media:title type="html">sacramental</media:title>
		</media:content>

		<media:content url="http://developers.sun.com/im/a.gif" medium="image">
			<media:title type="html"> </media:title>
		</media:content>

		<media:content url="http://developers.sun.com/jscreator/reference/techart/2/bindingDataTableComponents/chary_kanaparthi.jpg" medium="image">
			<media:title type="html">Chary Kanaparthi</media:title>
		</media:content>

		<media:content url="http://developers.sun.com/im/a.gif" medium="image">
			<media:title type="html"> </media:title>
		</media:content>

		<media:content url="http://developers.sun.com/jscreator/reference/techart/2/bindingDataTableComponents/StdTableLayout.jpg" medium="image">
			<media:title type="html">Bind Table to RowSet</media:title>
		</media:content>

		<media:content url="http://developers.sun.com/jscreator/reference/techart/2/bindingDataTableComponents/StdTableComponent.jpg" medium="image">
			<media:title type="html">Standard Data Table Component After Binding</media:title>
		</media:content>

		<media:content url="http://developers.sun.com/im/a.gif" medium="image">
			<media:title type="html"> </media:title>
		</media:content>
	</item>
		<item>
		<title>Cập nhật dữ liệu vào CSDL thông qua trung gian ResultSet</title>
		<link>http://kavax.wordpress.com/2008/03/27/c%e1%ba%adp-nh%e1%ba%adt-d%e1%bb%af-li%e1%bb%87u-vao-csdl-thong-qua-trung-gian-resultset/</link>
		<comments>http://kavax.wordpress.com/2008/03/27/c%e1%ba%adp-nh%e1%ba%adt-d%e1%bb%af-li%e1%bb%87u-vao-csdl-thong-qua-trung-gian-resultset/#comments</comments>
		<pubDate>Thu, 27 Mar 2008 09:02:59 +0000</pubDate>
		<dc:creator>fate</dc:creator>
				<category><![CDATA[JDBC]]></category>

		<guid isPermaLink="false">http://kavax.wordpress.com/2008/03/27/c%e1%ba%adp-nh%e1%ba%adt-d%e1%bb%af-li%e1%bb%87u-vao-csdl-thong-qua-trung-gian-resultset/</guid>
		<description><![CDATA[Table Mônhọc(MaMon,TenMon,SoTiet)
// Lấy về ResultSet từ table Môn
String s_sql = &#8220;select * from tbMon&#8221;;
Statement stat = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
ResultSet rs = stat.executeQuery(s_sql);
// Cập nhật dữ lịêu không cần viết t-sql
rs.absolute(row_id);    // đi đến dòng thứ row_id trong ResultSet
rs.updateString(&#8220;TenMon&#8221;,tenmon);    // update tên môn vào ResultSet
rs.updateInt(&#8220;SoTiet&#8221;,sotiet);    // update số [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kavax.wordpress.com&blog=3270419&post=27&subd=kavax&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Table Mônhọc(MaMon,TenMon,SoTiet)</p>
<p>// Lấy về ResultSet từ table Môn<br />
String s_sql = &#8220;select * from tbMon&#8221;;<br />
Statement stat = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);<br />
ResultSet rs = stat.executeQuery(s_sql);<br />
<span id="more-27"></span>// Cập nhật dữ lịêu không cần viết t-sql<br />
rs.absolute(row_id);    // đi đến dòng thứ row_id trong ResultSet<br />
rs.updateString(&#8220;TenMon&#8221;,tenmon);    // update tên môn vào ResultSet<br />
rs.updateInt(&#8220;SoTiet&#8221;,sotiet);    // update số tiết vào ResultSet<br />
rs.updateRow();        // cập nhật vào CSDL</p>
<p>// Xoá dữ lịêu không cần viết t-sql<br />
rs.absolute(row_id);    // đi đến dòng thứ row_id trong ResultSet<br />
rs.deleteRow();        xoá dòng đó trong CSDL</p>
<p>// Thêm dữ lịêu không cần viết t-sql<br />
rs.moveToInsertRow();    // nhảy sang 1 dòng trống để thêm<br />
rs.updateString(&#8220;MaMon&#8221;,ma_mon);    // thêm mã môn vào ResultSet<br />
rs.updateString(&#8220;TenMon&#8221;,ten_mon);    // thêm tên môn vào ResultSet<br />
rs.updateInt(&#8220;SoTiet&#8221;,so_tiet);    // thêm số tiết vào ResultSet<br />
rs.insertRow();        // thêm bộ dữ liệu đó vào CSDL<br />
rs.moveToCurrentRow();    //</p>
<p>Nói thêm về Row_ID:<br />
- Dòng đầu tiên trong ResultSet sẽ có Row_ID = 1<br />
- Ví dụ:<br />
// lấy về ResultSet<br />
while(rs.next())<br />
{<br />
rs.getString(1); // ỏ lần loop đầu tiên của while, rs sẽ trỏ vào dòng có Row_ID = 1 (dòng đầu tiên trong table trong CSDL)<br />
}</p>
<p>Nói thêm về Col_ID<br />
- Cột đầu tiên trong ResultSetMetaData sẽ có Col_ID = 1<br />
- Ví dụ:<br />
// lấy về ResultSetMetaData md= rs.getMetaData();<br />
for(int i=1;i&lt;=md.getColumnCount();i++)<br />
md.getColumnName(1);    // lần loop đầu tiên, metadata sẽ trỏ vào cột có Col_ID = 1 (cột đầu tiên trong table trong CSDL)</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/kavax.wordpress.com/27/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/kavax.wordpress.com/27/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kavax.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kavax.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kavax.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kavax.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kavax.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kavax.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kavax.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kavax.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kavax.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kavax.wordpress.com/27/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kavax.wordpress.com&blog=3270419&post=27&subd=kavax&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://kavax.wordpress.com/2008/03/27/c%e1%ba%adp-nh%e1%ba%adt-d%e1%bb%af-li%e1%bb%87u-vao-csdl-thong-qua-trung-gian-resultset/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/348544c759d3cca37771632e0b9b15a7?s=96&#38;d=identicon" medium="image">
			<media:title type="html">sacramental</media:title>
		</media:content>
	</item>
		<item>
		<title>Lập Trình Csdl Java-postgresql</title>
		<link>http://kavax.wordpress.com/2008/03/25/l%e1%ba%adp-trinh-csdl-java-postgresql/</link>
		<comments>http://kavax.wordpress.com/2008/03/25/l%e1%ba%adp-trinh-csdl-java-postgresql/#comments</comments>
		<pubDate>Tue, 25 Mar 2008 12:15:14 +0000</pubDate>
		<dc:creator>fate</dc:creator>
				<category><![CDATA[JDBC]]></category>
		<category><![CDATA[POSTGRESQL]]></category>

		<guid isPermaLink="false">http://kavax.wordpress.com/2008/03/25/l%e1%ba%adp-trinh-csdl-java-postgresql/</guid>
		<description><![CDATA[DẠO ĐẦU:
JAVA LÀ 1 NGÔN NGỮ &#8211; CÔNG NGHỆ LT LÂU ĐỜI , ỔN ĐỊNH. NÓ CÓ THỂ LÀM VIỆC VỚI NHIỀU HỆ QTCSDL KHÁC NHAU NHƯ ORACLE,SQLSERVER,MYSQL,POSGRESQL (THỰC TẾ CÁC CTY CHUỘNG CÁC LOẠI DBMS NÀY NHẤT TRONG SỐ CÁC DBMS)
ORACLE,SQLSERVER,MYSQL ĐA ĐƯỢC NHIỀU NGƯỜI BIẾT ĐẾN, VẬY MINH SẼ HƯỚNG DẪN CÁC BẠN [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kavax.wordpress.com&blog=3270419&post=7&subd=kavax&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><b>DẠO ĐẦU:</b><br />
JAVA LÀ 1 NGÔN NGỮ &#8211; CÔNG NGHỆ LT LÂU ĐỜI , ỔN ĐỊNH. NÓ CÓ THỂ LÀM VIỆC VỚI NHIỀU HỆ QTCSDL KHÁC NHAU NHƯ ORACLE,SQLSERVER,MYSQL,POSGRESQL (THỰC TẾ CÁC CTY CHUỘNG CÁC LOẠI DBMS NÀY NHẤT TRONG SỐ CÁC DBMS)</p>
<p>ORACLE,SQLSERVER,MYSQL ĐA ĐƯỢC NHIỀU NGƯỜI BIẾT ĐẾN, VẬY MINH SẼ HƯỚNG DẪN CÁC BẠN LẬP TRÌNH CSDL TỪ JAVA -&gt; POSGRESQL</p>
<p><b>ĐIỀU KIỆN CẦN ĐỂ CÓ THỄ THỰC HÀNH CÁC THAO TÁC TRONG BÀI NÀY:</b></p>
<p>1/ CƠ BẢN JAVA<br />
2/ CƠ BẢN LÝ THUYẾT LẬP TRÌNH CSDL JAVA<br />
3/ CƠ BẢN POSGRESQL HOẶC THAM KHẢO BÀI VIẾT VỀ POSTGRE CŨNG Ở TRONG BLOG NÀY</p>
<p><b><br />
CÔNG CỤ SỬ DỤNG TRONG BÀI VIẾT NÀY:</b></p>
<p>TRÌNH CÔNG CỤ TIỆN ÍCH PHÁT TRIỂN JAVA: J2SE5.0/JDK1.5 (NÊN LÀ VERSION NÀY ĐỂ TUONG THÍCH VỚI DRIVER CỦA POSTGRESQL DƯỚI ĐÂY)<br />
www.java.sun.com</p>
<p>bộ cài postgresql (msi), cũng có thể down bộ no-install.zip (tìm trên postgresql.org)<br />
<!--quoteo--></p>
<div class="quotetop">QUOTE</div>
<div class="quotemain"><!--quotec--><a href="http://ftp4.tw.postgresql.org/binary/v8.2.6/win32/postgresql-8.2.6-2.zip" target="_blank">http://ftp4.tw.postgresql.org/binary/v8.2&#8230;.sql-8.2.6-2.zip</a><!--QuoteEnd--></div>
<p><!--QuoteEEnd--></p>
<p>driver của postgresql để lập trình java với jdbc<br />
<!--quoteo--></p>
<div class="quotetop">QUOTE</div>
<div class="quotemain"><!--quotec--><a href="http://jdbc.postgresql.org/download/postgresql-8.2-507.jdbc3.jar" target="_blank">http://jdbc.postgresql.org/download/postgr&#8230;2-507.jdbc3.jar</a><!--QuoteEnd--></div>
<p><!--QuoteEEnd--></p>
<p>tài lịeu sử dụng driver trên<br />
<!--quoteo--></p>
<div class="quotetop">QUOTE</div>
<div class="quotemain"><!--quotec--><a href="http://jdbc.postgresql.org/documentation/postgresql-jdbc-82-doc.tar.gz" target="_blank">http://jdbc.postgresql.org/documentation/p&#8230;c-82-doc.tar.gz</a><!--QuoteEnd--></div>
<p><!--QuoteEEnd--><i><b>THỰC HÀNH:</b></i></p>
<p><span id="more-7"></span></p>
<p>Cần có 1 database trước khi dịch và chạy file này. Các bạn nên tham khảo thêm topic: http://kiamiracle.wordpress.com/2008/02/09/th%e1%bb%ac-s%e1%bb%a8c-v%e1%bb%9ai-1-h%e1%bb%86-qt-csdl-m%e1%bb%9ai-postgresql/</p>
<p><b>1&gt; Cấu trúc ứng dụng</b>: các file sau để cùng 1 thư mục<br />
&#8211;postgresql-8.2-507.jdbc3.jar -&gt; đây là driver của postgres cho jdbc mà bạn dowload về<br />
&#8211;TestConnection.java<br />
&#8211;runit.bat</p>
<p>Cài đặt jdk1.5 để thực hành (tự tìm hiểu)- tham khảo trên www.javavietnam.org là tốt nhất</p>
<p><b>2&gt; jdk_home</b><br />
- Giả sử đây là thư mục bin của jdk đã cài:<br />
C:\Program Files\Java\jdk1.5.0_14\bin</p>
<p><b>3&gt; Mã nguồn file TestConnection.java</b><!--quoteo--></p>
<div class="quotetop">QUOTE</div>
<div class="quotemain"><!--quotec-->import java.sql.*;public class TestConnection<br />
{<br />
public static void main(String args[]) throws Exception<br />
{<br />
System.out.println(&#8220;Hello World&#8221;);<br />
Class.forName(&#8220;org.postgresql.Driver&#8221;); // đăng ký driver<br />
String url = &#8220;jdbc:postgresql://localhost:5432/QLVT?user=postgres&amp;password=shushi&#8221;;<br />
// QLVT là tên db đó// thiết lập kết nối<br />
Connection conn = DriverManager.getConnection(url);Statement st = conn.createStatement();<br />
ResultSet rs = st.executeQuery(&#8220;SELECT * FROM \&#8221;DanhMucVatTu\&#8221;");<br />
while (rs.next())<br />
{<br />
System.out.println(rs.getString(1)+&#8221;&#8212;&#8212;-&#8221;+rs.getString(2));<br />
}<br />
rs.close();<br />
st.close();}<br />
}<!--QuoteEnd--></div>
<p><!--QuoteEEnd--></p>
<p><b>4&gt; Nội dung file runit.bat</b></p>
<p>set path=.;C:\Program Files\Java\jdk1.5.0_14\bin<br />
javac TestConnection.java<br />
set CLASSPATH=.;postgresql-8.2-507.jdbc3.jar<br />
java TestConnection<br />
@pause</p>
<p>*** FINAL: CHẠY FILE RUNIT.BAT VÀ CẢM NHẬN</p>
<p>http://kiamiracle.wordpress.com/2008/02/09/th%e1%bb%ac-s%e1%bb%a8c-v%e1%bb%9ai-1-h%e1%bb%86-qt-csdl-m%e1%bb%9ai-postgresql/</p>
<div class="quotemain"><!--QuoteEnd--></div>
<p><!--QuoteEEnd--><br />
<b><br />
CÔNG CỤ SỬ DỤNG TRONG BÀI VIẾT NÀY:</b></p>
<p>TRÌNH CÔNG CỤ TIỆN ÍCH PHÁT TRIỂN JAVA: J2SE5.0/JDK1.5 (NÊN LÀ VERSION NÀY ĐỂ TUONG THÍCH VỚI DRIVER CỦA POSTGRESQL DƯỚI ĐÂY)<br />
www.java.sun.com</p>
<p>bộ cài postgresql (msi), cũng có thể down bộ no-install.zip (tìm trên postgresql.org)<br />
<!--quoteo--></p>
<div class="quotetop">QUOTE</div>
<div class="quotemain"><!--quotec--><a href="http://ftp4.tw.postgresql.org/binary/v8.2.6/win32/postgresql-8.2.6-2.zip" target="_blank">http://ftp4.tw.postgresql.org/binary/v8.2&#8230;.sql-8.2.6-2.zip</a><!--QuoteEnd--></div>
<p><!--QuoteEEnd--></p>
<p>driver của postgresql để lập trình java với jdbc<br />
<!--quoteo--></p>
<div class="quotetop">QUOTE</div>
<div class="quotemain"><!--quotec--><a href="http://jdbc.postgresql.org/download/postgresql-8.2-507.jdbc3.jar" target="_blank">http://jdbc.postgresql.org/download/postgr&#8230;2-507.jdbc3.jar</a><!--QuoteEnd--></div>
<p><!--QuoteEEnd--></p>
<p>tài lịeu sử dụng driver trên<br />
<!--quoteo--></p>
<div class="quotetop">QUOTE</div>
<div class="quotemain"><!--quotec--><a href="http://jdbc.postgresql.org/documentation/postgresql-jdbc-82-doc.tar.gz" target="_blank">http://jdbc.postgresql.org/documentation/p&#8230;c-82-doc.tar.gz</a><!--QuoteEnd--></div>
<p><!--QuoteEEnd--></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/kavax.wordpress.com/7/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/kavax.wordpress.com/7/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kavax.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kavax.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kavax.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kavax.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kavax.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kavax.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kavax.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kavax.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kavax.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kavax.wordpress.com/7/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kavax.wordpress.com&blog=3270419&post=7&subd=kavax&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://kavax.wordpress.com/2008/03/25/l%e1%ba%adp-trinh-csdl-java-postgresql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/348544c759d3cca37771632e0b9b15a7?s=96&#38;d=identicon" medium="image">
			<media:title type="html">sacramental</media:title>
		</media:content>
	</item>
	</channel>
</rss>