<?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>mariosimaremare</title>
	<atom:link href="http://mariosimaremare.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://mariosimaremare.wordpress.com</link>
	<description>execute! who executes everythings</description>
	<lastBuildDate>Sun, 07 Feb 2010 04:15:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='mariosimaremare.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>mariosimaremare</title>
		<link>http://mariosimaremare.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://mariosimaremare.wordpress.com/osd.xml" title="mariosimaremare" />
	<atom:link rel='hub' href='http://mariosimaremare.wordpress.com/?pushpress=hub'/>
		<item>
		<title>[Library]: Adding Library Into Java[TM] Project</title>
		<link>http://mariosimaremare.wordpress.com/2010/02/07/library-adding-library-into-javatm-project/</link>
		<comments>http://mariosimaremare.wordpress.com/2010/02/07/library-adding-library-into-javatm-project/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 04:06:32 +0000</pubDate>
		<dc:creator>mariosimaremare</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://mariosimaremare.wordpress.com/?p=124</guid>
		<description><![CDATA[&#8220;currently, i develop an application under Java platform, and i need to use a class which i&#8217;ve never used before, where can i get the library which contains the class?&#8221; &#8220;how to add more library into my Java project [or program]?&#8221; that questions rise when someone realize that his program needs an additional libraries. there [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mariosimaremare.wordpress.com&amp;blog=5256382&amp;post=124&amp;subd=mariosimaremare&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<blockquote><p><strong>&#8220;currently, i develop an application under Java platform, and i need to use a class which i&#8217;ve never used before, where can i get the library which contains the class?&#8221;</strong></p></blockquote>
<blockquote style="text-align:center;">
<p style="text-align:left;"><strong>&#8220;how to add more library into my Java project [or program]?&#8221; </strong></p>
</blockquote>
<p style="text-align:left;">that questions rise when someone realize that his program needs an additional libraries. there are a sequence of problem people used to face on:</p>
<ol>
<li>what library does my program needs?</li>
<li>i know the library but where can i get it [or download it]?</li>
<li> i have the library but how to add it into my program?</li>
</ol>
<p>most of people are getting stuck to find out what kind of library does his program requires to run, <strong>the easiest way to find it out is by forcing the program to run, then an exception will be thrown and you just need to see what is missing</strong>&#8230;? for example, see the following exception:</p>
<p><pre class="brush: java;">
Exception [TOPLINK-4003] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.DatabaseException
Exception Description: Configuration error.  Class [com.mysql.jdbc.Driver] not found.
 at oracle.toplink.essentials.exceptions.DatabaseException.configurationErrorClassNotFound(DatabaseException.java:101)
 at oracle.toplink.essentials.sessions.DefaultConnector.loadDriver(DefaultConnector.java:183)
 at oracle.toplink.essentials.sessions.DefaultConnector.connect(DefaultConnector.java:98)
 .....
</pre></p>
<p>that&#8217;s because of missing class <code>com.mysql.jdbc.Driver</code>, then check this one:</p>
<p><pre class="brush: java;">
Exception in thread &quot;main&quot; java.lang.NoClassDefFoundError: javax/mail/Message
 at javamail.Main.main(Main.java:8)
Caused by: java.lang.ClassNotFoundException: javax.mail.Message
 at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
 at java.security.AccessController.doPrivileged(Native Method)
 .....
</pre></p>
<p>it&#8217;s caused by the missing of class <code>javax.mail.Message</code>, then &#8220;how to know the library [jar file] if i just know the required class?&#8221; simply open your browser and go to <a href="http://findjar.com/">http://findjar.com/</a> to seach what jar file contains the class. download it.</p>
<p>now you have the jar, so how to connect the library [jar file] to the program? there are two possibilities, your program written with IDE or NOT at all.</p>
<p>if you use an IDE in develop your program you just need to add it on, in NetBeans IDE for example you just need to do these:</p>
<ol>
<li> right click on the project then select properties,<a href="http://mariosimaremare.files.wordpress.com/2010/02/msm-00021.jpg"><img class="aligncenter size-full wp-image-127" title="msm-0002" src="http://mariosimaremare.files.wordpress.com/2010/02/msm-00021.jpg?w=600" alt=""   /></a></li>
<li> go to &#8216;Libraries&#8217; category,<a href="http://mariosimaremare.files.wordpress.com/2010/02/msm-00031.jpg"><img class="aligncenter size-full wp-image-128" title="msm-0003" src="http://mariosimaremare.files.wordpress.com/2010/02/msm-00031.jpg?w=600" alt=""   /></a></li>
<li>select &#8216;Add JAR/Folder&#8217; to find you JAR file.<a href="http://mariosimaremare.files.wordpress.com/2010/02/msm-0004.jpg"><img class="aligncenter size-full wp-image-129" title="msm-0004" src="http://mariosimaremare.files.wordpress.com/2010/02/msm-0004.jpg?w=600" alt=""   /></a></li>
</ol>
<p>but if you don&#8217;t use any IDE, you have to link the JAR to the &#8216;Environtment Variables&#8217;, i will show how to add it in Windows operating system.</p>
<ol>
<li>first ensure the JAR file is in your local drive, then right click on the My Computer icon &gt; select Properties<a href="http://mariosimaremare.files.wordpress.com/2010/02/msm-0005.jpg"><img class="aligncenter size-full wp-image-130" title="msm-0005" src="http://mariosimaremare.files.wordpress.com/2010/02/msm-0005.jpg?w=600" alt=""   /></a></li>
<li>select the Advanced tab &gt; select Environtment Variables<a href="http://mariosimaremare.files.wordpress.com/2010/02/msm-0006.jpg"><img class="aligncenter size-full wp-image-131" title="msm-0006" src="http://mariosimaremare.files.wordpress.com/2010/02/msm-0006.jpg?w=600" alt=""   /></a></li>
<li> find the &#8216;Path&#8217; variable and edit it to add your jar directory location<a href="http://mariosimaremare.files.wordpress.com/2010/02/msm-0008.jpg"><img class="aligncenter size-full wp-image-132" title="msm-0008" src="http://mariosimaremare.files.wordpress.com/2010/02/msm-0008.jpg?w=600" alt=""   /></a> <a href="http://mariosimaremare.files.wordpress.com/2010/02/msm-0007.jpg"><img class="aligncenter size-full wp-image-133" title="msm-0007" src="http://mariosimaremare.files.wordpress.com/2010/02/msm-0007.jpg?w=600" alt=""   /></a><a href="http://mariosimaremare.files.wordpress.com/2010/02/msm-0009.jpg"><img class="aligncenter size-full wp-image-135" title="msm-0009" src="http://mariosimaremare.files.wordpress.com/2010/02/msm-0009.jpg?w=600" alt=""   /></a></li>
<li>finish. reopen your command prompt [if you use it].</li>
</ol>
<p>have a good day,&#8230;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mariosimaremare.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mariosimaremare.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mariosimaremare.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mariosimaremare.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mariosimaremare.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mariosimaremare.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mariosimaremare.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mariosimaremare.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mariosimaremare.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mariosimaremare.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mariosimaremare.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mariosimaremare.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mariosimaremare.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mariosimaremare.wordpress.com/124/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mariosimaremare.wordpress.com&amp;blog=5256382&amp;post=124&amp;subd=mariosimaremare&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mariosimaremare.wordpress.com/2010/02/07/library-adding-library-into-javatm-project/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/318671dd7e2afff2042d4ffba5a5f28b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mariosimaremare</media:title>
		</media:content>

		<media:content url="http://mariosimaremare.files.wordpress.com/2010/02/msm-00021.jpg" medium="image">
			<media:title type="html">msm-0002</media:title>
		</media:content>

		<media:content url="http://mariosimaremare.files.wordpress.com/2010/02/msm-00031.jpg" medium="image">
			<media:title type="html">msm-0003</media:title>
		</media:content>

		<media:content url="http://mariosimaremare.files.wordpress.com/2010/02/msm-0004.jpg" medium="image">
			<media:title type="html">msm-0004</media:title>
		</media:content>

		<media:content url="http://mariosimaremare.files.wordpress.com/2010/02/msm-0005.jpg" medium="image">
			<media:title type="html">msm-0005</media:title>
		</media:content>

		<media:content url="http://mariosimaremare.files.wordpress.com/2010/02/msm-0006.jpg" medium="image">
			<media:title type="html">msm-0006</media:title>
		</media:content>

		<media:content url="http://mariosimaremare.files.wordpress.com/2010/02/msm-0008.jpg" medium="image">
			<media:title type="html">msm-0008</media:title>
		</media:content>

		<media:content url="http://mariosimaremare.files.wordpress.com/2010/02/msm-0007.jpg" medium="image">
			<media:title type="html">msm-0007</media:title>
		</media:content>

		<media:content url="http://mariosimaremare.files.wordpress.com/2010/02/msm-0009.jpg" medium="image">
			<media:title type="html">msm-0009</media:title>
		</media:content>
	</item>
		<item>
		<title>[Database]: storage engine [part1]</title>
		<link>http://mariosimaremare.wordpress.com/2010/02/05/database-storage-engine-part1/</link>
		<comments>http://mariosimaremare.wordpress.com/2010/02/05/database-storage-engine-part1/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 03:55:32 +0000</pubDate>
		<dc:creator>mariosimaremare</dc:creator>
				<category><![CDATA[databases]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://mariosimaremare.wordpress.com/?p=120</guid>
		<description><![CDATA[&#8220;have ever heard &#8216;storage engine&#8217;? what is that?&#8221; &#8220;do you know what is MyISAM and InnoDB?&#8221; &#8220;and what are the differences between them?&#8221; before having a discussion about MyISAM and InnoDB let we talk about &#8216;database engine&#8217; [or storage engine]. a storage engine is an underlying software [in Database Management System - DBMS] which takes [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mariosimaremare.wordpress.com&amp;blog=5256382&amp;post=120&amp;subd=mariosimaremare&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<blockquote><p><strong>&#8220;have ever heard &#8216;storage engine&#8217;? what is that?&#8221;<br />
&#8220;do you know what is MyISAM and InnoDB?&#8221;<br />
&#8220;and what are the differences between them?&#8221;</strong></p></blockquote>
<p>before having a discussion about MyISAM and InnoDB let we talk about &#8216;database engine&#8217; [or storage engine]. a storage engine is an underlying software [in Database Management System - DBMS] which takes control in managing how to connect, create, alter and remove database objects [tables, triggers, indexes, and others]. the storage engine also takes care of transaction.</p>
<p><strong>&#8220;so what MyISAM is?&#8221;</strong><br />
MyISAM is one of popular storage engine, it&#8217;s a replacement of ISAM storage engine.<br />
MyISAM developed for MySQL DBMS, MyISAM storage engine will create three type of file for every table creation, FRM file [store the table definition], MYI file [store all indexes for the table] and MYD [MY Data, store the records].</p>
<p><strong>&#8220;then what about InnoDB?&#8221;</strong><br />
InnoDB is also a storage engine for MySQL, invented by Innobase Oy [Finland], an open source company. InnoDB is dual licensed, GNU GPL and as a proprietary software [owned by Oracle - Innobase Oy was acquired by Oracle in 2005].</p>
<p><strong>these are some differences between InnoDB and MyISAM:</strong></p>
<ul>
<li> InnoDB uses row-level locking while MyISAM uses table-level locking, InnoDBB has a better performance in update action,</li>
<li>it store the table definition, indexes and all of the rows in one file, it&#8217;s unlike MyISAM,</li>
<li>a crashed table may be repaired by tracking the log when MyISAM table needs to be full scaned,</li>
<li>in the storage [physical disk], InnoDB places records in order of primary key [index] while MyISAM in order of their added time,</li>
<li>InnoDB supports transaction and better table relationship when MyISAM doesn&#8217;t support transaction.</li>
</ul>
<p>there are still many storage engines out there like Memory, Federated, and others&#8230;<br />
for further information about MySQL&#8217;s storage engine, you can find here: <a href="http://dev.mysql.com/doc/refman/5.1/en/storage-engines.html">http://dev.mysql.com/doc/refman/5.1/en/storage-engines.html</a></p>
<p>have a good day&#8230;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mariosimaremare.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mariosimaremare.wordpress.com/120/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mariosimaremare.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mariosimaremare.wordpress.com/120/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mariosimaremare.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mariosimaremare.wordpress.com/120/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mariosimaremare.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mariosimaremare.wordpress.com/120/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mariosimaremare.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mariosimaremare.wordpress.com/120/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mariosimaremare.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mariosimaremare.wordpress.com/120/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mariosimaremare.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mariosimaremare.wordpress.com/120/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mariosimaremare.wordpress.com&amp;blog=5256382&amp;post=120&amp;subd=mariosimaremare&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mariosimaremare.wordpress.com/2010/02/05/database-storage-engine-part1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/318671dd7e2afff2042d4ffba5a5f28b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mariosimaremare</media:title>
		</media:content>
	</item>
		<item>
		<title>[Exception]: a java mail exception</title>
		<link>http://mariosimaremare.wordpress.com/2010/02/04/exception-a-java-mail-exception/</link>
		<comments>http://mariosimaremare.wordpress.com/2010/02/04/exception-a-java-mail-exception/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 08:54:12 +0000</pubDate>
		<dc:creator>mariosimaremare</dc:creator>
				<category><![CDATA[exception]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://mariosimaremare.wordpress.com/?p=115</guid>
		<description><![CDATA[do you get this exception stack: the exception thrown because you miss the Mail API. You can download it here: http://java.sun.com/products/javamail/downloads/index.html to fix it up, just add the required Mail API. [see here to see how to link an external library] have a good day<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mariosimaremare.wordpress.com&amp;blog=5256382&amp;post=115&amp;subd=mariosimaremare&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>do you get this exception stack:</p>
<p><pre class="brush: java;">Exception in thread &quot;main&quot; java.lang.NoClassDefFoundError: javax/mail/Message
 at javamail.Main.main(Main.java:8)
Caused by: java.lang.ClassNotFoundException: javax.mail.Message
 at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
 at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
 ... 1 more
Java Result: 1</pre></p>
<p>the exception thrown because you miss the Mail API.<br />
You can download it here: <a href="http://java.sun.com/products/javamail/downloads/index.html">http://java.sun.com/products/javamail/downloads/index.html</a><br />
to fix it up, just add the required Mail API.<br />
[see here to see how to link an external library]</p>
<p>have a good day</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mariosimaremare.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mariosimaremare.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mariosimaremare.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mariosimaremare.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mariosimaremare.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mariosimaremare.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mariosimaremare.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mariosimaremare.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mariosimaremare.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mariosimaremare.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mariosimaremare.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mariosimaremare.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mariosimaremare.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mariosimaremare.wordpress.com/115/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mariosimaremare.wordpress.com&amp;blog=5256382&amp;post=115&amp;subd=mariosimaremare&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mariosimaremare.wordpress.com/2010/02/04/exception-a-java-mail-exception/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/318671dd7e2afff2042d4ffba5a5f28b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mariosimaremare</media:title>
		</media:content>
	</item>
		<item>
		<title>[Exception]: a database exception [part 1]</title>
		<link>http://mariosimaremare.wordpress.com/2010/02/04/exception-a-database-exception-part-1/</link>
		<comments>http://mariosimaremare.wordpress.com/2010/02/04/exception-a-database-exception-part-1/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 07:11:13 +0000</pubDate>
		<dc:creator>mariosimaremare</dc:creator>
				<category><![CDATA[exception]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://mariosimaremare.wordpress.com/?p=110</guid>
		<description><![CDATA[do you get this exception stack: the exception thrown because you miss the Database Driver, exception above occurs if you forget to link the MySQL Database Driver [sometimes called with MySQL Connector]. for MySQL, you can get the Driver here: http://dev.mysql.com/downloads/connector/j/ to fix it up, just add the required JDBC Driver. [see here to see [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mariosimaremare.wordpress.com&amp;blog=5256382&amp;post=110&amp;subd=mariosimaremare&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>do you get this exception stack:</p>
<p><pre class="brush: java;">

Exception in thread &quot;main&quot; Local Exception Stack:
Exception [TOPLINK-4003] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.DatabaseException
Exception Description: Configuration error.  Class [com.mysql.jdbc.Driver] not found.
at oracle.toplink.essentials.exceptions.DatabaseException.configurationErrorClassNotFound(DatabaseException.java:101)
at oracle.toplink.essentials.sessions.DefaultConnector.loadDriver(DefaultConnector.java:183)
at oracle.toplink.essentials.sessions.DefaultConnector.connect(DefaultConnector.java:98)
at oracle.toplink.essentials.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:184)
at oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:582)
at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:280)
at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:229)
at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:93)
at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:126)
at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:120)
at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:91)
at simplejpa.entities.manager.DBManager.refreshEntityManager(DBManager.java:17)
at simplejpa.entities.manager.DBManager.addNewAccount(DBManager.java:28)
at simplejpa.Main.main(Main.java:13)
Java Result: 1

</pre></p>
<p><strong>the exception thrown because you miss the Database Driver</strong>, exception above occurs if you forget to link the MySQL Database Driver [sometimes called with MySQL Connector]. for MySQL, you can get the Driver here: <a href="http://dev.mysql.com/downloads/connector/j/" target="_blank">http://dev.mysql.com/downloads/connector/j/</a><br />
to fix it up, just add the required JDBC Driver.<br />
[<a href="http://mariosimaremare.wordpress.com/2010/02/07/library-adding-library-into-javatm-project/">see here to see how to link an external library</a>]</p>
<p>have a good day</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mariosimaremare.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mariosimaremare.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mariosimaremare.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mariosimaremare.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mariosimaremare.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mariosimaremare.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mariosimaremare.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mariosimaremare.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mariosimaremare.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mariosimaremare.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mariosimaremare.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mariosimaremare.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mariosimaremare.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mariosimaremare.wordpress.com/110/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mariosimaremare.wordpress.com&amp;blog=5256382&amp;post=110&amp;subd=mariosimaremare&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mariosimaremare.wordpress.com/2010/02/04/exception-a-database-exception-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/318671dd7e2afff2042d4ffba5a5f28b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mariosimaremare</media:title>
		</media:content>
	</item>
		<item>
		<title>Sending Email using Java[TM] Mail API</title>
		<link>http://mariosimaremare.wordpress.com/2010/02/04/sending-email-using-javatm-mail-api/</link>
		<comments>http://mariosimaremare.wordpress.com/2010/02/04/sending-email-using-javatm-mail-api/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 04:16:34 +0000</pubDate>
		<dc:creator>mariosimaremare</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://mariosimaremare.wordpress.com/?p=105</guid>
		<description><![CDATA[&#8220;can somebody help me to send email using java?&#8221; a year ago, i had a project which requires mail functionality. the most required function was to send email. then we decided to design a class which exploit Java Mail API to fulfill the requirement. actually we designed only one class, but for improvement, i break [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mariosimaremare.wordpress.com&amp;blog=5256382&amp;post=105&amp;subd=mariosimaremare&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<blockquote><p><strong>&#8220;can somebody help me to send email using java?&#8221;</strong></p></blockquote>
<p>a year ago, i had a project which requires mail functionality. the most required function was to send email. then we decided to design a class which exploit Java Mail API to fulfill the requirement.<br />
actually we designed only one class, but for improvement, i break it into two classes, these are the classes and the codes:<br />
MailSender</p>
<p><pre class="brush: java;">
package javamail;

import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;

public class MailSender {

 private String SMTPHost;
 private String SMTPPort;
 private String username;
 private String password;

 public MailSender() {
 SMTPHost = &quot;&quot;;
 SMTPPort = &quot;&quot;;
 username = &quot;&quot;;
 password = &quot;&quot;;
 }

 public MailSender(String _SMTPHost, String _SMTPPort,
 String _username, String _password) {
 SMTPHost = _SMTPHost;
 SMTPPort = _SMTPPort;
 username = _username;
 password = _password;
 }

 public void setPassword(String _password) {
 password = _password;
 }

 public void setUsername(String _username) {
 username = _username;
 }

 public String getSMTPHost() {
 return SMTPHost;
 }

 public void setSMTPHost(String _SMTPHost) {
 SMTPHost = _SMTPHost;
 }

 public String getSMTPPort() {
 return SMTPPort;
 }

 public void setSMTPPort(String _SMTPPort) {
 SMTPPort = _SMTPPort;
 }

 public void sendMail(List&lt;String&gt; _to, List&lt;String&gt; _toCC,
 List&lt;String&gt; _toBCC, String _subject, String _content)
 throws Exception {
 if (IMAPAuthenticator.getIMAPAuthentication(SMTPHost, username, password)) {
 Properties props = System.getProperties();

 props.put(&quot;mail.smtp.host&quot;, SMTPHost);
 props.put(&quot;mail.debug&quot;, &quot;true&quot;);
 props.put(&quot;mail.smtp.port&quot;, &quot;25&quot;);
 props.put(&quot;mail.smtp.localhost&quot;, SMTPPort);
 props.put(&quot;mail.smtp.auth&quot;, &quot;false&quot;);

 Session session = Session.getInstance(props);
 Message message = new MimeMessage(session);

 try {
 message.setFrom(new InternetAddress(username +
 &quot;@&quot; + SMTPHost));

 for (int counter = 0; counter &lt; _to.size(); ++counter) {
 message.setRecipient(Message.RecipientType.TO, new InternetAddress(_to.get(counter)));
 }

 if (_toCC != null) {
 for (int counterCC = 0; counterCC &lt; _toCC.size(); ++counterCC) {
 message.setRecipient(Message.RecipientType.CC, new InternetAddress(_toCC.get(counterCC)));
 }
 }

 if (_toBCC != null) {
 for (int counterBCC = 0; counterBCC &lt; _toBCC.size(); ++counterBCC) {
 message.setRecipient(Message.RecipientType.BCC, new InternetAddress(_toBCC.get(counterBCC)));
 }
 }

 message.setSubject(_subject);
 message.setText(_content);
 message.setSentDate(new Date());

 Transport.send(message);

 } catch (Exception e) {
 e.printStackTrace();
 throw e;
 }
 } else {
 throw new AuthenticationFailedException(&quot;invalid user&quot;);
 }
 }
}
</pre></p>
<p>IMAPAuthenticator</p>
<p><pre class="brush: java;">
package javamail;

import com.sun.mail.imap.IMAPStore;
import java.util.Properties;
import javax.mail.Session;

public class IMAPAuthenticator {

 public static boolean getIMAPAuthentication(String _IMAPHost,
 String _username, String _password) throws Exception {
 boolean isAuthenticated = false;

 try {
 Properties properties = System.getProperties();
 Session session = Session.getDefaultInstance(properties);
 IMAPStore store = (IMAPStore) session.getStore(&quot;imap&quot;);

 store.connect(_IMAPHost, _username, _password);
 store.close();
 isAuthenticated = true;

 } catch (Exception ex) {
 ex.printStackTrace();
 isAuthenticated = false;
 }

 return isAuthenticated;
 }
}
</pre></p>
<p>to test it, write this code in your Main class then run it.</p>
<p><pre class="brush: java;">package javamail;

import java.util.ArrayList;

public class Main {

 public static void main(String[] args) throws Exception {
 MailSender ms = new MailSender();
 ms.setUsername(&quot;myusername&quot;);
 ms.setPassword(&quot;myPASSwORD&quot;);
 ms.setSMTPHost(&quot;mail.myhosting.ac.id&quot;);
 ms.setSMTPPort(&quot;25&quot;);

 ArrayList&lt;String&gt; to = new ArrayList();
 ArrayList&lt;String&gt; toCC = new ArrayList();
 String subject = &quot;[JavaMail]: subject&quot;;
 String content = &quot;[JavaMail]: content&quot;;
 to.add(&quot;mr@mail.hishost.com&quot;);
 toCC.add(&quot;ms@herhost.co.id&quot;);
 toCC.add(&quot;bthr@mail.somewhere.net&quot;);

 ms.sendMail(to, toCC, toCC, subject, content);
 }
}
</pre></p>
<p>check your inbox and have a good day&#8230;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mariosimaremare.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mariosimaremare.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mariosimaremare.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mariosimaremare.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mariosimaremare.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mariosimaremare.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mariosimaremare.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mariosimaremare.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mariosimaremare.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mariosimaremare.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mariosimaremare.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mariosimaremare.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mariosimaremare.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mariosimaremare.wordpress.com/105/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mariosimaremare.wordpress.com&amp;blog=5256382&amp;post=105&amp;subd=mariosimaremare&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mariosimaremare.wordpress.com/2010/02/04/sending-email-using-javatm-mail-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/318671dd7e2afff2042d4ffba5a5f28b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mariosimaremare</media:title>
		</media:content>
	</item>
		<item>
		<title>serialize [object] and deserialize in Java[TM]</title>
		<link>http://mariosimaremare.wordpress.com/2010/02/03/serialize-object-and-deserialize-in-javatm/</link>
		<comments>http://mariosimaremare.wordpress.com/2010/02/03/serialize-object-and-deserialize-in-javatm/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 10:30:11 +0000</pubDate>
		<dc:creator>mariosimaremare</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://mariosimaremare.wordpress.com/?p=88</guid>
		<description><![CDATA[&#8220;can i store my object into file?&#8221; &#8220;how to transmit an object over the network&#8221; in java programming, you can write or transmit your object over the network, how come? java provides an object serialization which &#8216;converts&#8217; an object into a streaming bits, then you can do many things with the stream. &#8220;could you give [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mariosimaremare.wordpress.com&amp;blog=5256382&amp;post=88&amp;subd=mariosimaremare&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<blockquote>
<p style="text-align:left;"><strong>&#8220;can i store my object into file?&#8221;<br />
&#8220;how to transmit an object over the network&#8221;</strong></p>
</blockquote>
<p style="text-align:left;">in java programming, you can write or transmit your object over the network, how come? <strong>java provides an object serialization</strong> which &#8216;converts&#8217; an object into a streaming bits, then you can do many things with the stream.<br />
&#8220;could you give me some example?&#8221;, okay, in this session i will show you how to serialize objects and deserialize it back.<br />
this are term people used to know:<br />
object -&gt; serialize / deflate / marshalling -&gt; streaming bits<br />
streaming bits -&gt; deserialize / inflate / unmarshalling &#8211; &gt; objects<br />
<strong>one thing you have to remember is when you want to make a serializable class, make sure that you ‘flag’ it by implements <code>java.io.Serializable</code> interface.</strong><br />
the scenario of the sample is like this:<a href="http://mariosimaremare.files.wordpress.com/2010/02/011.jpg"><img class="aligncenter size-full wp-image-98" title="01" src="http://mariosimaremare.files.wordpress.com/2010/02/011.jpg?w=600" alt=""   /></a><br />
there are three classes:<br />
SerializableObject: the class which object will be serialized<br />
ObjectDeflater: object to streaming bit &#8216;converter&#8217;<br />
ObjectInflater: streaming bit to object &#8216;converter&#8217;</p>
<p>this is very simple, just create a new project [i use JDK 1.6 update 10 and NetBeans 6.5 IDE] then create the three required classes. after that, write down these codes:</p>
<p>code for SerializableObject:</p>
<p><pre class="brush: java;">
package javaserialization;
import java.io.Serializable;

public class SerializableObject implements Serializable {

 private final int DEFAULT_ID = 0;
 private final String DEFAULT_NAME = &quot;DEFAULT_NAME&quot;;
 private final String DEFAULT_MESSAGE = &quot;DEFAULT_MESSAGE&quot;;
 private int objectId;
 private String objectName;
 private String objectMessage;

 public SerializableObject() {
 objectId = DEFAULT_ID;
 objectName = DEFAULT_NAME;
 objectMessage = DEFAULT_MESSAGE;
 }

 public SerializableObject(
 int _objectId,
 String _objectName,
 String _objectMessage) {
 objectId = _objectId;
 objectName = _objectName;
 objectMessage = _objectMessage;
 }

 public int getObjectId() {
 return objectId;
 }

 public void setObjectId(int objectId) {
 this.objectId = objectId;
 }

 public String getObjectMessage() {
 return objectMessage;
 }

 public void setObjectMessage(String objectMessage) {
 this.objectMessage = objectMessage;
 }

 public String getObjectName() {
 return objectName;
 }

 public void setObjectName(String objectName) {
 this.objectName = objectName;
 }

 public void printInfo() {
 System.out.println(
 objectId + &quot;\n&quot; +
 objectName + &quot;\n&quot; +
 objectMessage + &quot;\n&quot;);
 }
}

</pre></p>
<p>code for ObjectDeflater:</p>
<p><pre class="brush: java;">
package javaserialization;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

public class ObjectDeflater {

 private String filePath;
 private File file;
 private FileOutputStream fos;
 private ObjectOutputStream oos;

 public ObjectDeflater(String _filePath) {
 filePath = _filePath;
 }

 private void allocate() throws IOException {
 file = new File(filePath);
 fos = new FileOutputStream(file);
 oos = new ObjectOutputStream(fos);
 }

 private void dealocate() {
 try {
 oos.close();
 } catch (IOException ioe) {
 ioe.printStackTrace();
 }
 }

 public void deflateObject(int _numberOfObject) throws IOException {
 allocate();

 SerializableObject so = null;
 for (int objCounter = 0; objCounter &lt; _numberOfObject; ++objCounter) {
 so = new SerializableObject(objCounter, &quot;my name is: &quot; + objCounter, &quot;my message is: &quot; + objCounter);
 oos.writeObject(so);
 }

 dealocate();
 }
}
</pre></p>
<p>code for ObjectInflater:</p>
<p><pre class="brush: java;">package javaserialization;

import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;

public class ObjectInflater {

 private String filePath;
 private File file;
 private FileInputStream fis;
 private ObjectInputStream ois;

 public ObjectInflater(String _filePath) {
 filePath = _filePath;
 }

 private void allocate() throws IOException {
 file = new File(filePath);
 fis = new FileInputStream(file);
 ois = new ObjectInputStream(fis);
 }

 private void dealocate() {
 try {
 ois.close();
 } catch (IOException ioe) {
 ioe.printStackTrace();
 }
 }

 public void inflateObject() throws IOException, ClassNotFoundException {
 allocate();

 SerializableObject so = null;
 try {
 while ((so = (SerializableObject) ois.readObject()) != null) {
 so.printInfo();
 }
 } catch (EOFException eofe) {
 // reaches end of file
 // no action required
 // leave it blank
 }

 dealocate();
 }
}
</pre></p>
<p>to test the project, write this code in the Main class:</p>
<p><pre class="brush: java;">
package javaserialization;

public class Main {

 public static void main(String[] args) {
 // your file path, it must be exists
 String filePath = &quot;D:\\tutorials\\JavaSerialization\\objectschest.txt&quot;;
 ObjectDeflater od = null;
 ObjectInflater oi = null;

 try {
 od = new ObjectDeflater(filePath);
 od.deflateObject(5);
 } catch (Exception ex) {
 ex.printStackTrace();
 }

 try {
 oi = new ObjectInflater(filePath);
 oi.inflateObject();
 } catch (Exception ex) {
 ex.printStackTrace();
 }
 }
}
</pre></p>
<p>run the project then discover what is happening&#8230;<br />
have a good day,</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mariosimaremare.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mariosimaremare.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mariosimaremare.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mariosimaremare.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mariosimaremare.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mariosimaremare.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mariosimaremare.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mariosimaremare.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mariosimaremare.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mariosimaremare.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mariosimaremare.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mariosimaremare.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mariosimaremare.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mariosimaremare.wordpress.com/88/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mariosimaremare.wordpress.com&amp;blog=5256382&amp;post=88&amp;subd=mariosimaremare&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mariosimaremare.wordpress.com/2010/02/03/serialize-object-and-deserialize-in-javatm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/318671dd7e2afff2042d4ffba5a5f28b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mariosimaremare</media:title>
		</media:content>

		<media:content url="http://mariosimaremare.files.wordpress.com/2010/02/011.jpg" medium="image">
			<media:title type="html">01</media:title>
		</media:content>
	</item>
		<item>
		<title>Using Java Persistence API [JPA] &#8211; Sample [2]</title>
		<link>http://mariosimaremare.wordpress.com/2010/02/03/using-java-persistence-api-jpa-sample-2/</link>
		<comments>http://mariosimaremare.wordpress.com/2010/02/03/using-java-persistence-api-jpa-sample-2/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 08:10:40 +0000</pubDate>
		<dc:creator>mariosimaremare</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://mariosimaremare.wordpress.com/?p=81</guid>
		<description><![CDATA[well, in this section you will try to update and remove a record in a database through Java Persistence API. hum,&#8230; this part is a continued part of the provious section actually, so you need to do the previous [about record insertion] before continuing to this one. updating and removing record by using JPA is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mariosimaremare.wordpress.com&amp;blog=5256382&amp;post=81&amp;subd=mariosimaremare&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>well, in this section you will try to update and remove a record in a database through Java Persistence API.</p>
<p>hum,&#8230; this part is a continued part of <a href="http://mariosimaremare.wordpress.com/2010/02/02/using-java-persistence-api-jpa-sample-1/">the provious section</a> actually, so you need to do the previous [about record insertion] before continuing to this one.</p>
<p>updating and removing record by using JPA is so easy. in this session you just need to modify two classes that we have made before [in <a href="http://mariosimaremare.wordpress.com/2010/02/02/using-java-persistence-api-jpa-sample-1/">the previous part</a>].</p>
<ol>
<li>first is modifying DBManager class by adding four more methods, the class will be like this:<pre class="brush: java;">package simplejpa.entities.manager;
import javax.persistence.Query;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import simplejpa.entities.Account;

public class DBManager {

 private EntityManager em;
 private EntityManagerFactory emf;

 private EntityManager refreshEntityManager() {
 emf = Persistence.createEntityManagerFactory(&quot;SimpleJPAPU&quot;);
 if (em == null) {
 em = emf.createEntityManager();
 }

 return em;
 }

 public void addNewAccount(
 String _accountName,
 String _accountEmail,
 String _accountPhone,
 String _accountAddress) {
 refreshEntityManager();
 try {
 em.getTransaction().begin();
 Account account = new Account();
 account.setAccountName(_accountName);
 account.setAccountEmail(_accountEmail);
 account.setAccountPhone(_accountPhone);
 account.setAccountAddress(_accountAddress);

 em.persist(account);
 em.getTransaction().commit();
 } catch (Exception ex) {
 ex.printStackTrace();
 }
 }

 public Account getAccountWithID(Long _accountId) {
 refreshEntityManager();
 Account account = null;
 Query query = em.createQuery(&quot;SELECT A FROM Account A WHERE A.accountId=:ACCOUNTID&quot;);
 query.setParameter(&quot;ACCOUNTID&quot;, _accountId);

 try {
 account = (Account) query.getSingleResult();
 } catch (Exception ex) {
 ex.printStackTrace();
 }

 return (account);
 }

 public Account getAccountWithName(String _accountName) {
 refreshEntityManager();
 Account account = null;
 Query query = em.createQuery(&quot;SELECT A FROM Account A WHERE A.accountName=:ACCOUNTNAME&quot;);
 query.setParameter(&quot;ACCOUNTNAME&quot;, _accountName);

 try {
 account = (Account) query.getSingleResult();
 } catch (Exception ex) {
 ex.printStackTrace();
 }

 return (account);
 }

 public void updateAccountWithID(
 Long _accountId,
 String _newAccountName,
 String _newAccountEmail,
 String _newAccountPhone,
 String _newAccountAddress) {
 refreshEntityManager();
 try {
 em.getTransaction().begin();
 Account account = getAccountWithID(_accountId);
 account.setAccountName(_newAccountName);
 account.setAccountEmail(_newAccountEmail);
 account.setAccountPhone(_newAccountPhone);
 account.setAccountAddress(_newAccountAddress);

 em.merge(account);
 em.getTransaction().commit();
 } catch (Exception ex) {
 ex.printStackTrace();
 }
 }

 public void removeAccountWithID(
 Long _accountId) {
 refreshEntityManager();
 try {
 em.getTransaction().begin();
 Account account = getAccountWithID(_accountId);

 em.remove(account);
 em.getTransaction().commit();
 } catch (Exception ex) {
 ex.printStackTrace();
 }
 }
}
</pre></li>
<li>the next is to modifying Main class, just like this:<pre class="brush: java;">package simplejpa;
import simplejpa.entities.Account;
import simplejpa.entities.manager.DBManager;

public class Main {

 public static void main(String[] args) {
 // instantiate DBManager
 DBManager dbm = new DBManager();

 // try to add some new accounts
 dbm.addNewAccount(&quot;mario&quot;, &quot;mariosimaremare@yahoo.co.id&quot;, &quot;0123456789&quot;, &quot;Sitoluama&quot;);
 dbm.addNewAccount(&quot;mario elyezer&quot;, &quot;mariosimaremare@gmail.com&quot;, &quot;081081081081&quot;, &quot;Laguboti&quot;);
 dbm.addNewAccount(&quot;mario simaremare&quot;, &quot;mariosimaremare@hotmail.com&quot;, &quot;085208520852&quot;, &quot;North Sumatera&quot;);

 // retrieve some registered accounts
 Account mario = dbm.getAccountWithName(&quot;mario&quot;);
 Account marioelyezer = dbm.getAccountWithName(&quot;mario elyezer&quot;);

 // try to remove account
 dbm.removeAccountWithID(mario.getAccountId());
 // try to update account
 dbm.updateAccountWithID(marioelyezer.getAccountId(), &quot;mario elyezer subekti&quot;, &quot;me@mycampus.com&quot;, &quot;065506550655&quot;, &quot;campus&quot;);
 }
}
</pre></li>
<li>ok, finish! you can run it to see what will happens&#8230;</li>
</ol>
<p>have a good day,</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mariosimaremare.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mariosimaremare.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mariosimaremare.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mariosimaremare.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mariosimaremare.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mariosimaremare.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mariosimaremare.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mariosimaremare.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mariosimaremare.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mariosimaremare.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mariosimaremare.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mariosimaremare.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mariosimaremare.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mariosimaremare.wordpress.com/81/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mariosimaremare.wordpress.com&amp;blog=5256382&amp;post=81&amp;subd=mariosimaremare&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mariosimaremare.wordpress.com/2010/02/03/using-java-persistence-api-jpa-sample-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/318671dd7e2afff2042d4ffba5a5f28b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mariosimaremare</media:title>
		</media:content>
	</item>
		<item>
		<title>Using Java Persistence API [JPA] &#8211; Sample [1]</title>
		<link>http://mariosimaremare.wordpress.com/2010/02/02/using-java-persistence-api-jpa-sample-1/</link>
		<comments>http://mariosimaremare.wordpress.com/2010/02/02/using-java-persistence-api-jpa-sample-1/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 10:47:48 +0000</pubDate>
		<dc:creator>mariosimaremare</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://mariosimaremare.wordpress.com/?p=34</guid>
		<description><![CDATA[now, we will practice a simple action by using Java Persistence API to interact between a simple application and it&#8217;s database. first of all, i use this as my specifications: MySQL database, JDK 1.6 update 10 and NetBeans 6.5 as IDE. let&#8217;s we start it: now create a database called &#8216;tutorialdb&#8217; with only one table [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mariosimaremare.wordpress.com&amp;blog=5256382&amp;post=34&amp;subd=mariosimaremare&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>now, we will practice a simple action by using Java Persistence API to interact between a simple application and it&#8217;s database.<br />
first of all, i use this as my specifications:<br />
MySQL database, JDK 1.6 update 10 and NetBeans 6.5 as IDE.</p>
<p>let&#8217;s we start it:</p>
<ol>
<li> now create a database called &#8216;tutorialdb&#8217; with only one table inside, &#8216;account&#8217; table. you may see the table specification below:<a href="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-01.jpg"><img class="aligncenter size-full wp-image-55" title="msm-t02- (01)" src="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-01.jpg?w=600" alt=""   /></a></li>
<li>ok, i think there is no problem in database and table creation. now we go to the java code.</li>
<li>open your NetBeans [i use NetBeans 6.5] and create a new project, name it as &#8216;SimpleJPA&#8217;.</li>
<li>now we just need to &#8216;convert&#8217; all tables into classes. how? by right clicking on the project, select &#8216;New&#8217; &gt; &#8216;Entity Classes from Database&#8230;&#8217;.<a href="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-02.jpg"><img class="aligncenter size-full wp-image-56" title="msm-t02- (02)" src="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-02.jpg?w=600" alt=""   /></a></li>
<li>if you have no database connection, just create a new one by choosing &#8216;New Database Connection&#8217;.<a href="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-03.jpg"><img class="aligncenter size-full wp-image-57" title="msm-t02- (03)" src="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-03.jpg?w=600" alt=""   /></a></li>
<li>fill all required fields, make sure that you fill all of them.</li>
<li>then NetBeans will retrieve all tables inside the database, choose the &#8216;account&#8217; then click &#8216;Next&#8217; to continue&#8230;<a href="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-04.jpg"><img class="aligncenter size-full wp-image-58" title="msm-t02- (04)" src="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-04.jpg?w=600" alt=""   /></a></li>
<li>you can specified the package for this entity [and it's recommended].<a href="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-05.jpg"><img class="aligncenter size-full wp-image-59" title="msm-t02- (05)" src="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-05.jpg?w=600" alt=""   /></a><a href="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-06.jpg"><img class="aligncenter size-full wp-image-60" title="msm-t02- (06)" src="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-06.jpg?w=600" alt=""   /></a></li>
<li>after the entity generated, you&#8217;ll see some missing libraries, <a href="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-07.jpg"><img class="aligncenter size-full wp-image-61" title="msm-t02- (07)" src="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-07.jpg?w=600" alt=""   /></a>to fix it, you just need to add TopLink and MySQL Connector, don&#8217;t worry NetBeans provide all of them.  you just need to link it to them. how? right clicking on the project&#8217;s Libraries &gt; Add Library.<a href="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-08.jpg"><img class="aligncenter size-full wp-image-62" title="msm-t02- (08)" src="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-08.jpg?w=600" alt=""   /></a> select TopLink Essential<a href="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-09.jpg"><img class="aligncenter size-full wp-image-63" title="msm-t02- (09)" src="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-09.jpg?w=600" alt=""   /></a> and MySQL JDBC Driver.<a href="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-10.jpg"><img class="aligncenter size-full wp-image-64" title="msm-t02- (10)" src="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-10.jpg?w=600" alt=""   /></a><a href="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-11.jpg"><img class="aligncenter size-full wp-image-65" title="msm-t02- (11)" src="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-11.jpg?w=600" alt=""   /></a></li>
<li>the next step is creating a persistence unit, it&#8217;s a part of Java Persistence API, which act as the administrator of connectivity, and maintain the entity life cycle. to create a persistence unit, right clicking on the project &gt; &#8216;New&#8217; &gt; &#8216;Persistence Unit&#8217;.<a href="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-12.jpg"><img class="aligncenter size-full wp-image-66" title="msm-t02- (12)" src="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-12.jpg?w=600" alt=""   /></a></li>
<li>then fill the persistence unit&#8217;s name, set the driver with TopLink [default] and select the database connection. finish.<a href="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-13.jpg"><img class="aligncenter size-full wp-image-67" title="msm-t02- (13)" src="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-13.jpg?w=600" alt=""   /></a><a href="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-16.jpg"><img class="aligncenter size-full wp-image-70" title="msm-t02- (16)" src="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-16.jpg?w=600" alt=""   /></a><a href="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-17.jpg"><img class="aligncenter size-full wp-image-71" title="msm-t02- (17)" src="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-17.jpg?w=600" alt=""   /></a></li>
<li>now you have a managed type of entity.</li>
<li>hmm,&#8230; do we have all? actually, yes, but i would prefer to create a manager class which will simplify us [as the programmer] to interact with the entity object, just call it as &#8216;Database Manager&#8217;.</li>
<li>okay, now create a new Java Class name it as &#8216;DBManager&#8217;<a href="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-14.jpg"><img class="aligncenter size-full wp-image-68" title="msm-t02- (14)" src="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-14.jpg?w=600" alt=""   /></a> then write down this code:</li>
<p><pre class="brush: java;">
package simplejpa.entities.manager;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import simplejpa.entities.Account;

public class DBManager {

 private EntityManager em;
 private EntityManagerFactory emf;

 private EntityManager refreshEntityManager() {
 emf = Persistence.createEntityManagerFactory(&quot;SimpleJPAPU&quot;);
 if (em == null) {
 em = emf.createEntityManager();
 }

 return em;
 }

 public void addNewAccount(
 String _accountName,
 String _accountEmail,
 String _accountPhone,
 String _accountAddress) {
 refreshEntityManager();
 try {
 em.getTransaction().begin();
 Account account = new Account();
 account.setAccountName(_accountName);
 account.setAccountEmail(_accountEmail);
 account.setAccountPhone(_accountPhone);
 account.setAccountAddress(_accountAddress);

 em.persist(account);
 em.getTransaction().commit();
 } catch (Exception ex) {
 ex.printStackTrace();
 }
 }
}
</pre></p>
<li>to test the JPA, on the Main class, write down this code:</li>
</ol>
<p><pre class="brush: java;">package simplejpa;

import simplejpa.entities.manager.DBManager;

public class Main {

    public static void main(String[] args) {
        DBManager dbm = new DBManager();
        String name = &quot;mario&quot;;
        String email = &quot;mariosimaremare@yahoo.co.id&quot;;
        String phone = &quot;00123456789&quot;;
        String address = &quot;North Sumatera - Indonesia&quot;;
        dbm.addNewAccount(name, email, phone, address);
    }
}
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mariosimaremare.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mariosimaremare.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mariosimaremare.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mariosimaremare.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mariosimaremare.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mariosimaremare.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mariosimaremare.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mariosimaremare.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mariosimaremare.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mariosimaremare.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mariosimaremare.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mariosimaremare.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mariosimaremare.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mariosimaremare.wordpress.com/34/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mariosimaremare.wordpress.com&amp;blog=5256382&amp;post=34&amp;subd=mariosimaremare&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mariosimaremare.wordpress.com/2010/02/02/using-java-persistence-api-jpa-sample-1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/318671dd7e2afff2042d4ffba5a5f28b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mariosimaremare</media:title>
		</media:content>

		<media:content url="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-01.jpg" medium="image">
			<media:title type="html">msm-t02- (01)</media:title>
		</media:content>

		<media:content url="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-02.jpg" medium="image">
			<media:title type="html">msm-t02- (02)</media:title>
		</media:content>

		<media:content url="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-03.jpg" medium="image">
			<media:title type="html">msm-t02- (03)</media:title>
		</media:content>

		<media:content url="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-04.jpg" medium="image">
			<media:title type="html">msm-t02- (04)</media:title>
		</media:content>

		<media:content url="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-05.jpg" medium="image">
			<media:title type="html">msm-t02- (05)</media:title>
		</media:content>

		<media:content url="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-06.jpg" medium="image">
			<media:title type="html">msm-t02- (06)</media:title>
		</media:content>

		<media:content url="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-07.jpg" medium="image">
			<media:title type="html">msm-t02- (07)</media:title>
		</media:content>

		<media:content url="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-08.jpg" medium="image">
			<media:title type="html">msm-t02- (08)</media:title>
		</media:content>

		<media:content url="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-09.jpg" medium="image">
			<media:title type="html">msm-t02- (09)</media:title>
		</media:content>

		<media:content url="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-10.jpg" medium="image">
			<media:title type="html">msm-t02- (10)</media:title>
		</media:content>

		<media:content url="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-11.jpg" medium="image">
			<media:title type="html">msm-t02- (11)</media:title>
		</media:content>

		<media:content url="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-12.jpg" medium="image">
			<media:title type="html">msm-t02- (12)</media:title>
		</media:content>

		<media:content url="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-13.jpg" medium="image">
			<media:title type="html">msm-t02- (13)</media:title>
		</media:content>

		<media:content url="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-16.jpg" medium="image">
			<media:title type="html">msm-t02- (16)</media:title>
		</media:content>

		<media:content url="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-17.jpg" medium="image">
			<media:title type="html">msm-t02- (17)</media:title>
		</media:content>

		<media:content url="http://mariosimaremare.files.wordpress.com/2010/02/msm-t02-14.jpg" medium="image">
			<media:title type="html">msm-t02- (14)</media:title>
		</media:content>
	</item>
		<item>
		<title>Connection pooling in Sun Java[TM] System Application Server [SJSAS]</title>
		<link>http://mariosimaremare.wordpress.com/2010/01/31/connection-pooling-in-sun-javatm-system-application-server-sjsas/</link>
		<comments>http://mariosimaremare.wordpress.com/2010/01/31/connection-pooling-in-sun-javatm-system-application-server-sjsas/#comments</comments>
		<pubDate>Sun, 31 Jan 2010 13:05:28 +0000</pubDate>
		<dc:creator>mariosimaremare</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://mariosimaremare.wordpress.com/?p=12</guid>
		<description><![CDATA[At this post you will see how easy in creating a connection pooling and JDBC Resource in Sun Java [TM] System Application Server. you may need to use a JDBC Resource when you are going to develop an enterprise application, okay, these are the steps: First of all, in this steps i use  SJSAS 9.1_02 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mariosimaremare.wordpress.com&amp;blog=5256382&amp;post=12&amp;subd=mariosimaremare&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>At this post you will see how easy in creating a connection pooling and JDBC Resource in Sun Java [TM] System Application Server.</p>
<p>you may need to use a JDBC Resource when you are going to develop an enterprise application, okay, these are the steps:</p>
<ol>
<li>First of all, in this steps i use  SJSAS 9.1_02 with JDK 1.6 Update 10.</li>
<li>Go to the Admin Console [http://localhost:4848/ is the default].</li>
<li>Select Resource &gt; JDBC &gt; Connection Pools.<a href="http://mariosimaremare.files.wordpress.com/2010/01/01.jpg"><img class="aligncenter size-full wp-image-14" title="01" src="http://mariosimaremare.files.wordpress.com/2010/01/01.jpg?w=600" alt=""   /></a></li>
<li>Then select &#8216;New&#8230;&#8217; on pools.<a href="http://mariosimaremare.files.wordpress.com/2010/01/02.jpg"><img class="aligncenter size-full wp-image-15" title="02" src="http://mariosimaremare.files.wordpress.com/2010/01/02.jpg?w=600" alt=""   /></a></li>
<li>In the general settings, fill the pool name and select the resource type and the database vendor [depends on your database].<a href="http://mariosimaremare.files.wordpress.com/2010/01/03.jpg"><img class="aligncenter size-full wp-image-16" title="03" src="http://mariosimaremare.files.wordpress.com/2010/01/03.jpg?w=600" alt=""   /></a></li>
<li>Click &#8216;Next&#8217; to continue.</li>
<li>The next session is set the properties. There are four most important properties to be set. There are:</li>
<li>Click &#8216;Finish&#8217; to finish.</li>
<li>Now you have a new connection pool, to test it, just click on the &#8216;Ping&#8217; button. <a href="http://mariosimaremare.files.wordpress.com/2010/01/06.jpg"><img class="aligncenter size-full wp-image-19" title="06" src="http://mariosimaremare.files.wordpress.com/2010/01/06.jpg?w=600" alt=""   /></a>You will see this when it&#8217;s succeeded.<a href="http://mariosimaremare.files.wordpress.com/2010/01/07.jpg"><img class="aligncenter size-full wp-image-20" title="07" src="http://mariosimaremare.files.wordpress.com/2010/01/07.jpg?w=600" alt=""   /></a></li>
</ol>
<p>really easy, after creating the pool, let&#8217;s move to create the JDBC Resource. Creating JDBC Resource is much easier than creating it&#8217;s pool. These are the steps:</p>
<ol>
<li>Still on the admin console, select Resource &gt; JDBC &gt; JDBC Resources. Click &#8216;New&#8230;&#8217;.<a href="http://mariosimaremare.files.wordpress.com/2010/01/08.jpg"><img class="aligncenter size-full wp-image-21" title="08" src="http://mariosimaremare.files.wordpress.com/2010/01/08.jpg?w=600" alt=""   /></a></li>
<li>You just have to write down the JNDI name [prefixed by 'jdbc/'], for e.g. &#8216;jdbc/tutorial&#8217; and the pool which this resource will use [select the last pool that you 've made before].<a href="http://mariosimaremare.files.wordpress.com/2010/01/09.jpg"><img class="aligncenter size-full wp-image-22" title="09" src="http://mariosimaremare.files.wordpress.com/2010/01/09.jpg?w=600" alt=""   /></a></li>
<li>Click &#8216;OK&#8217; and now you can access a datasource by using a JNDI namely &#8216;jdbc/tutorial&#8217;.</li>
</ol>
<p>have a good day&#8230;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mariosimaremare.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mariosimaremare.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mariosimaremare.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mariosimaremare.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mariosimaremare.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mariosimaremare.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mariosimaremare.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mariosimaremare.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mariosimaremare.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mariosimaremare.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mariosimaremare.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mariosimaremare.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mariosimaremare.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mariosimaremare.wordpress.com/12/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mariosimaremare.wordpress.com&amp;blog=5256382&amp;post=12&amp;subd=mariosimaremare&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mariosimaremare.wordpress.com/2010/01/31/connection-pooling-in-sun-javatm-system-application-server-sjsas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/318671dd7e2afff2042d4ffba5a5f28b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mariosimaremare</media:title>
		</media:content>

		<media:content url="http://mariosimaremare.files.wordpress.com/2010/01/01.jpg" medium="image">
			<media:title type="html">01</media:title>
		</media:content>

		<media:content url="http://mariosimaremare.files.wordpress.com/2010/01/02.jpg" medium="image">
			<media:title type="html">02</media:title>
		</media:content>

		<media:content url="http://mariosimaremare.files.wordpress.com/2010/01/03.jpg" medium="image">
			<media:title type="html">03</media:title>
		</media:content>

		<media:content url="http://mariosimaremare.files.wordpress.com/2010/01/06.jpg" medium="image">
			<media:title type="html">06</media:title>
		</media:content>

		<media:content url="http://mariosimaremare.files.wordpress.com/2010/01/07.jpg" medium="image">
			<media:title type="html">07</media:title>
		</media:content>

		<media:content url="http://mariosimaremare.files.wordpress.com/2010/01/08.jpg" medium="image">
			<media:title type="html">08</media:title>
		</media:content>

		<media:content url="http://mariosimaremare.files.wordpress.com/2010/01/09.jpg" medium="image">
			<media:title type="html">09</media:title>
		</media:content>
	</item>
	</channel>
</rss>
