<?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/"
	>

<channel>
	<title>Knowledge Sharing &#187; Java</title>
	<atom:link href="http://blog.danigunawan.com/tag/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.danigunawan.com</link>
	<description>"Say it... although a word..."</description>
	<lastBuildDate>Wed, 25 Jan 2012 00:14:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>After Oracle Bought Sun</title>
		<link>http://blog.danigunawan.com/java/after-oracle-bought-sun/</link>
		<comments>http://blog.danigunawan.com/java/after-oracle-bought-sun/#comments</comments>
		<pubDate>Fri, 24 Apr 2009 09:46:14 +0000</pubDate>
		<dc:creator>Dagu</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Sun]]></category>

		<guid isPermaLink="false">http://blog.danigunawan.com/?p=525</guid>
		<description><![CDATA[A few days ago, Oracle, a company which is known by it&#8217;s RDBMS, Oracle Database, bought Sun Microsystems ($7.4 billion.. wheewwww), a company which is known by it&#8217;s famous programming language, Java. As we know, Sun had bought MySQL, the famous open source database. Hmm&#8230; can you imagine how big Oracle now? I just wonder [...]
Related posts:<ol>
<li><a href='http://blog.danigunawan.com/programming/java-mysql-connection/' rel='bookmark' title='Java &amp; MySQL Connection'>Java &amp; MySQL Connection</a></li>
<li><a href='http://blog.danigunawan.com/database/creating-database-in-mysql/' rel='bookmark' title='Creating Database in MySQL'>Creating Database in MySQL</a></li>
<li><a href='http://blog.danigunawan.com/operating-systems/how-to-install-java-in-linux-ubuntu/' rel='bookmark' title='How To Install Java in Linux Ubuntu'>How To Install Java in Linux Ubuntu</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div id="attachment_526" class="wp-caption alignleft" style="width: 205px"><a href="http://blog.danigunawan.com/wp-content/uploads/2009/04/zot_sun_s_oracle_b.gif"><img class="size-full wp-image-526" style="margin: 5px;" title="zot_sun_s_oracle_b" src="http://blog.danigunawan.com/wp-content/uploads/2009/04/zot_sun_s_oracle_b.gif" alt="Sun - Oracle" width="195" height="98" /></a><p class="wp-caption-text">Sun - Oracle</p></div>
<p>A few days ago, Oracle, a company which is known by it&#8217;s RDBMS, Oracle Database, bought Sun Microsystems ($7.4 billion.. wheewwww), a company which is known by it&#8217;s <a href="http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html">famous programming language</a>, Java. As we know, Sun had bought MySQL, the famous open source database. Hmm&#8230; can you imagine how big Oracle now?</p>
<p>I just wonder what will happen tomorrow. Oracle has the enterprice market, meanwhile MySQL has SOHO market. Now Oracle has them all. I think Microsoft will be jealous. Microsoft SQL Server will not rule the Database World. Absolutely.</p>
<p>There are so many opinions about the future after Oracle bought Sun. May be Oracle will stop MySQL development, or still developing but not provide it as open source anymore. Or it will be better, MySQL will have Oracle features. What about Java? Do we have to pay to use Java like Microsoft does? Some people think it will be disaster. But I hope that Oracle won&#8217;t let open source community down.</p>
<p>Related posts:<ol>
<li><a href='http://blog.danigunawan.com/programming/java-mysql-connection/' rel='bookmark' title='Java &amp; MySQL Connection'>Java &amp; MySQL Connection</a></li>
<li><a href='http://blog.danigunawan.com/database/creating-database-in-mysql/' rel='bookmark' title='Creating Database in MySQL'>Creating Database in MySQL</a></li>
<li><a href='http://blog.danigunawan.com/operating-systems/how-to-install-java-in-linux-ubuntu/' rel='bookmark' title='How To Install Java in Linux Ubuntu'>How To Install Java in Linux Ubuntu</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.danigunawan.com/java/after-oracle-bought-sun/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How To Install Java in Linux Ubuntu</title>
		<link>http://blog.danigunawan.com/operating-systems/how-to-install-java-in-linux-ubuntu/</link>
		<comments>http://blog.danigunawan.com/operating-systems/how-to-install-java-in-linux-ubuntu/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 04:53:30 +0000</pubDate>
		<dc:creator>Dagu</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Operating Systems]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.danigunawan.com/?p=504</guid>
		<description><![CDATA[Java is one of the most popular programming languages. I learned Java a few years ago. I learned it in Windows OS. Now I need to install it in Ubuntu. Here are the steps: 1) You need to update Ubuntu Repository. Type this command: sudo apt-get update Just wait till your Ubuntu Repository updated. 2) [...]
Related posts:<ol>
<li><a href='http://blog.danigunawan.com/programming/java-mysql-connection/' rel='bookmark' title='Java &amp; MySQL Connection'>Java &amp; MySQL Connection</a></li>
<li><a href='http://blog.danigunawan.com/operating-systems/how-to-create-environment-variables-in-linux/' rel='bookmark' title='How to Create Environment Variables in Linux'>How to Create Environment Variables in Linux</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.danigunawan.com/tag/java/">Java</a> is one of the most popular programming languages. I learned Java a few years ago. I learned it in Windows OS. Now I need to install it in Ubuntu. Here are the steps:</p>
<p><strong>1) You need to update Ubuntu Repository</strong>. Type this command:</p>
<pre>sudo apt-get update</pre>
<p>Just wait till your Ubuntu Repository updated.</p>
<p><strong>2) Now it&#8217;s time to install Java</strong>. If you are developer, you need JDK (Java Development Kit), but if not, you only need JRE (Java Runtime Environment). I will install JDK 6 in my Ubuntu.</p>
<p>for JDK, here is the command:</p>
<pre>sudo apt-get install sun-java6-jdk sun-java6-plugin</pre>
<p>for JRE, here is the command:</p>
<pre>sudo apt-get install sun-java6-jre sun-java6-plugin</pre>
<p><strong>3) After that, run command</strong>:</p>
<pre>sudo update-java-alternatives -s java-6-sun</pre>
<p>Then add the line “<strong>/usr/lib/jvm/java-6-sun</strong>” to the top of <strong>/etc/jvm file</strong>.</p>
<p><strong>4) Check your Java installation using these commands</strong>:</p>
<pre>java -version</pre>
<p>the output:</p>
<pre>java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)</pre>
<p>if you install JDK, check Java compiler using:</p>
<pre>javac -version</pre>
<p>the output:</p>
<pre>javac 1.6.0_03</pre>
<p><strong>5) You&#8217;re done!</strong></p>
<p>Related posts:<ol>
<li><a href='http://blog.danigunawan.com/programming/java-mysql-connection/' rel='bookmark' title='Java &amp; MySQL Connection'>Java &amp; MySQL Connection</a></li>
<li><a href='http://blog.danigunawan.com/operating-systems/how-to-create-environment-variables-in-linux/' rel='bookmark' title='How to Create Environment Variables in Linux'>How to Create Environment Variables in Linux</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.danigunawan.com/operating-systems/how-to-install-java-in-linux-ubuntu/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Java &amp; MySQL Connection</title>
		<link>http://blog.danigunawan.com/programming/java-mysql-connection/</link>
		<comments>http://blog.danigunawan.com/programming/java-mysql-connection/#comments</comments>
		<pubDate>Sat, 24 Nov 2007 04:18:00 +0000</pubDate>
		<dc:creator>Dagu</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://blog.danigunawan.com/2007/11/24/koneksi-java-mysql/</guid>
		<description><![CDATA[To connect a Java application with MySQL, we need a driver as interface between Java and MySQL. Driver can be downloaded from the official MySQL website. [ Download MySQL Connector ] Extract downloaded file (file type: *.jar). Copy that file to directory [jre installation]/lib/ext/. Ok, your Java application is ready to connect with MySQL. Testing [...]
Related posts:<ol>
<li><a href='http://blog.danigunawan.com/operating-systems/how-to-install-java-in-linux-ubuntu/' rel='bookmark' title='How To Install Java in Linux Ubuntu'>How To Install Java in Linux Ubuntu</a></li>
<li><a href='http://blog.danigunawan.com/database/creating-database-in-mysql/' rel='bookmark' title='Creating Database in MySQL'>Creating Database in MySQL</a></li>
<li><a href='http://blog.danigunawan.com/java/after-oracle-bought-sun/' rel='bookmark' title='After Oracle Bought Sun'>After Oracle Bought Sun</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>To connect a Java application with MySQL, we need a driver as interface between Java and MySQL. Driver can be downloaded from the official MySQL website.</p>
<p><a href="http://dev.mysql.com/downloads/connector/j/3.0.html">[ Download MySQL Connector ]</a></p>
<p>Extract downloaded file (file type: *.jar). Copy that file to directory <span style="font-weight: bold;">[jre installation]/lib/ext/</span>. Ok, your Java application is ready to connect with MySQL.</p>
<p><span id="more-91"></span></p>
<p><strong>Testing</strong><br />
Code below is used to connect between Java and MySQL.<br />
<span style="font-family: courier new;">/*</span><br />
<span style="font-family: courier new;"> * DBConnection.java</span><br />
<span style="font-family: courier new;"> *</span><br />
<span style="font-family: courier new;"> * Created on 29 September 2007, 11:41</span><br />
<span style="font-family: courier new;"> *</span><br />
<span style="font-family: courier new;"> */</span></p>
<p><span style="font-family: courier new;">import java.sql.*;</span></p>
<p><span style="font-family: courier new;">/**</span><br />
<span style="font-family: courier new;"> *</span><br />
<span style="font-family: courier new;"> * @author Dani Gunawan</span><br />
<span style="font-family: courier new;"> */</span><br />
<span style="font-family: courier new;">public class DBConnection {</span><br />
<span style="font-family: courier new;"> </span><br />
<span style="font-family: courier new;"> /** Creates a new instance of DBConnection */</span><br />
<span style="font-family: courier new;"> public DBConnection() {</span><br />
<span style="font-family: courier new;"> }</span><br />
<span style="font-family: courier new;"> </span><br />
<span style="font-family: courier new;"> public Connection connect() {</span><br />
<span style="font-family: courier new;"> Connection conn = null;</span></p>
<p><span style="font-family: courier new;"> try</span><br />
<span style="font-family: courier new;"> {</span><br />
<span style="font-family: courier new;"> String userName = &#8220;root&#8221;;</span><br />
<span style="font-family: courier new;"> String password = &#8220;&#8221;;</span><br />
<span style="font-family: courier new;"> String url = &#8220;jdbc:mysql://blog.danigunawan.com/test&#8221;;</span><br />
<span style="font-family: courier new;"> Class.forName (&#8220;com.mysql.jdbc.Driver&#8221;).newInstance ();</span><br />
<span style="font-family: courier new;"> conn = DriverManager.getConnection (url, userName, password);</span><br />
<span style="font-family: courier new;"> } catch (Exception e) {</span><br />
<span style="font-family: courier new;"> e.printStackTrace();</span><br />
<span style="font-family: courier new;"> conn = null;</span><br />
<span style="font-family: courier new;"> } finally {</span><br />
<span style="font-family: courier new;"> if (conn != null)</span><br />
<span style="font-family: courier new;"> {</span><br />
<span style="font-family: courier new;"> try</span><br />
<span style="font-family: courier new;"> {</span><br />
<span style="font-family: courier new;"> conn.close ();</span><br />
<span style="font-family: courier new;"> }</span><br />
<span style="font-family: courier new;"> catch (Exception ex) { </span><br />
<span style="font-family: courier new;"> ex.printStackTrace();</span><br />
<span style="font-family: courier new;"> }</span><br />
<span style="font-family: courier new;"> }</span><br />
<span style="font-family: courier new;"> }</span><br />
<span style="font-family: courier new;"> </span><br />
<span style="font-family: courier new;"> return conn;</span><br />
<span style="font-family: courier new;"> }</span><br />
<span style="font-family: courier new;">}</span></p>
<p>Code below is used to test the database connection.</p>
<p><span style="font-family: courier new;">/**</span><br />
<span style="font-family: courier new;"> * TesConnection.java</span><br />
<span style="font-family: courier new;"> */</span><br />
<span style="font-family: courier new;">import java.sql.*;</span></p>
<p><span style="font-family: courier new;">public class TesConnection {</span></p>
<p><span style="font-family: courier new;"> public static void main(String args[]) {</span></p>
<p><span style="font-family: courier new;"> Connection dbcon = new DBConnection().connect();</span><br />
<span style="font-family: courier new;"> </span><br />
<span style="font-family: courier new;"> if (dbcon != null) {</span><br />
<span style="font-family: courier new;"> System.out.println(&#8220;Database connection is successfully created&#8221;);</span><br />
<span style="font-family: courier new;"> } else {</span><br />
<span style="font-family: courier new;"> System.out.println(&#8220;Database connection isn&#8217;t successfully created&#8221;);</span><br />
<span style="font-family: courier new;"> }</span><br />
<span style="font-family: courier new;"> }</span></p>
<p><span style="font-family: courier new;">}</span></p>
<p><strong>How to Use Them?</strong><br />
Put those two source in the same directory. Compile DBConnection.java and TesConnection.java respectively.<br />
<span style="font-family: courier new;"><br />
javac DBConnection.java</span><br />
<span style="font-family: courier new;">javac TesConnection.java</span></p>
<p>If you want to compile all of them, use wildcard asterisk (*).</p>
<p><span style="font-family: courier new;">javac *.java</span></p>
<p>Run TesConnection:</p>
<p><span style="font-family: courier new;">java TesConnection</span></p>
<p>If the result:</p>
<p><span style="font-weight: bold;">Database connection is successfully created</span></p>
<p>Then your database is has been connected. But if:</p>
<p><span style="font-weight: bold;">Database connection isn&#8217;t successfully created</span></p>
<p>means your Java application isn&#8217;t connected yet with the database.<br />
Possibility:<br />
- MySQL isn&#8217;t installed yet<br />
- Database hasn&#8217;t been created yet (or maybe wrong database name)<br />
- Wrong database user or password</p>
<p>Both source can be downloaded from link below:</p>
<p><a href="http://danigunawan.com/wp-content/uploads/2008/12/tesdb.zip" target="_blank">[ Download example file ]</a></p>
<p><span style="font-weight: bold;">P.S.: </span><br />
Code had been tested in Windows XP SP 2 Operating System, never been done in other operating systems.</p>
<p>Related posts:<ol>
<li><a href='http://blog.danigunawan.com/operating-systems/how-to-install-java-in-linux-ubuntu/' rel='bookmark' title='How To Install Java in Linux Ubuntu'>How To Install Java in Linux Ubuntu</a></li>
<li><a href='http://blog.danigunawan.com/database/creating-database-in-mysql/' rel='bookmark' title='Creating Database in MySQL'>Creating Database in MySQL</a></li>
<li><a href='http://blog.danigunawan.com/java/after-oracle-bought-sun/' rel='bookmark' title='After Oracle Bought Sun'>After Oracle Bought Sun</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.danigunawan.com/programming/java-mysql-connection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

