Monday, September 22, 2008

JDBC on LINUX

I've though that JDBC is something significant for build an application. But today we won't talk about JDBC on windows, we'll talk about how to connect java programing with database management system on linux... In other word, it's mean that we won't talk about win32 anymore. Ha3...
anyway, if we want to build an application that has relation with database on linux (with java programing too) it' will take a several time... and there's some steps to do those things correctly. But now, maybe you ask for me “how to connect java language programming with database management system ?” hu... its simple.... (ha3.. sounds good !!!) .but it won't be OK, if you don't follow these steps.
and the following steps is :

Oh,my god... I forgot...
I have choose mysql as database management system that we will use...

STEP 1
install mysql on your UNIX system...

$> sudo apt-get install mysql



STEP 2
after you install mysql on your UNIX system, you must configure that...
login as root to mysql

$>mysql -uroot -pripsta

mysql>

you must create database that u need...
(remember, in UNIX system... you can't create database in local user mode)

mysql> create database agusta;

STEP 3
if you have made a database before...
next, you must set that database if you want to that database can use by local user mode.

mysql> GRANT ALL PRIVILEGES ON agusta.* TO dude@localhost IDENTIFIED BY 'ripsta';

mysql> GRANT ALL PRIVILEGES ON agusta.* TO dude@localhost.localdomain IDENTIFIED BY 'ripsta';

STEP 4
if you have done with that without error, so you must take step deeper...
OK, you need java connector to mysql...
you can download from this URL :


if you have downloaded the connector that appropriate, lets extarct the *.zip file to directory you need.
For example :

/home/dude/java/conn/
OK lets imagine that the coonector has extracted in the directory...

STEP 5
ok this is the technically steps that you must learn...
this is java part...


import java.sql.*;

/**
*
* @author dude
*/
public class Database {

public static void main(String[] args)
{
Connection conn=null;
try{

String url="jdbc:mysql://localhost:3306/agusta";
String user="dude";
String pwd="ripsta";

String jdbcDriver = "org.gjt.mm.mysql.Driver";
Class.forName(jdbcDriver);

System.out.println("trying to make a connection to "+url+" with user "+user+" and password "+pwd+" proccessing.......");

conn = DriverManager.getConnection(url,user,pwd);
System.out.println("success...");

}
catch(Exception e)
{
System.out.println("connection error");
System.out.println(e.getMessage());
}

}

}

copy this source code to your text editor, and save the file as Database.java into the active directory (/home/dude/java/conn/) <--- it's urgent...

STEP 6
ok now, we must chek all things we've done...
lets change the Classpath first...
in the terminal, set directory as the active directory...

$>cd /home/dude/java/conn/
$>export CLASSPATH=.
$>export CLASSPATH=$CLASSPATH:/home/dude/java/conn/mysql-connector-java-3.1.10/mysql-connector-java-3.1.10-bin.jar

$>javac Database.java
$>java Database

well... we will happy now...
the compilation will success without runtime error...
if you confuse, you can check the video tutorial

Readmore »»

Saturday, September 13, 2008

What's the IDE you NEED ?

Sometimes we confuse... when we must try to construct the code in java with no IDE... waste the time, and full of trouble if we stand only to adapt the situation like that... maybe,it's about 4 weeks to build an application in java language programing. But it can be easier and earlier if we believe with IDE power. Because we need more effective than before, so we used to like the IDE to develop the application. In fact, there's too many IDE you need with the new feature and plug in.

Anyway, from A to B IDE java just in betweens. In other words it's mean that All of java IDE can be used to make an java application. Because the world demands, time to build an application must do as fast as possible. Some peoples've said that build an application without IDE just feels like find the ring in the deep blue sea.... (need more time to do and need more effort to exist)

Ha3... but it's not real... now, finding the ring in the deep blue sea was over. That's why the IDE's coming... the software developer will consider that. I mean, they consider the power of the IDE they need. Because some time, when the developer building the application they also have more than one programmer. So, they usually have a rule and a history too. With IDE they need, they can make it better than before. I mean, they can handle those guys (many programmers). Some IDE just give the opportunity to the developer to make a rule for those programmers. Although, its must for the developer. IDE make it real for us. IDE that famous in the world of java programing is following:



NetBeans IDE


This is IDE that sun microsystem available for us. Because basic of this IDE is near with owner of java (Although java is open source, sun micro system has publish the java), so it has the 1st place for the popular IDE in this world. besides this IDE can be got easier than all, NetBeans also has support by the community. Full plug in and features.... NetBeans IDE and NetBeans Platform are based on software from netbeans.org, which has been dual licensed under the Common Development and Distribution License (CDDL) and the GNU General Public License version 2 with Classpath exception. For more information, please visit www.netbeans.org.


Eclipse IDE


It's different with NetBeans, The Eclipse also has support by the community as NetBeans has. But maybe, it's not easier to get like NetBeans. Some developer prefer to use this IDE than NetbBeans Although NetBeans in 1st place of this survey. It's because a habit and culture of the developer has. I've though that Eclipse has 2nd place for all contribution to the open source software development. Please chek and enjoy the Eclipse IDE. Anyway, copyright Eclipse contributors and others 2000, 2007. All rights reserved. Visit http://www.eclipse.org/platform. And for more information about this IDE includes software developed by the Apache Software Foundation http://www.apache.org/


JEdit IDE

Maybe the 3rd position is JEdit... Why? Why not the JCreator? Why must JEdit? And How come?
Ha3... easy guys.... its not the end of the world... There's too many reason why I choose the JEdit become the 3rd winner (actually there's no winner, just survey from the society) and not the JCreator. Its because the JCreator is not open anymore (even thought, it's never be open source). And its different with my concept of this survey... (java and opensource). But it doesn't make the JEdit look like the worse... if you choose the IDE that can work easier in your openrating system without spend your resource highly, this software can be the appropriate IDE you need. If you're a student not a developer that walk in business line, so this IDE is the one of your solution to build an application in java. For more information about this IDE, please visit http://www.jedit.org

so, make the way to construct the code (java code) more easier than before with IDE you need...
(this survey is just by Vectorcode Management and according to the our experience)


Readmore »»

Friday, September 5, 2008

install java di Linux


Untuk instal java di linux maka JDK yang harus di download adalah JDK untuk linux platform. Jika Linux anda suport paket instalasi RPM (Redhat, Mandrake) maka anda bisa langsung mendownload JDK yang pemaketannya dengan rpm. Linux yang saya pakai adalah Debian Sarge untuk keluarga x86 sehingga JDK yang saya download adalah jdk-1_5_0_04-linux-i586.bin (paket instalasi JDK yang general dan dapat dipakai oleh semua distribusi linux). Adapun cara instalasinya adalah sebagai berikut:

Masuk ke console dengan menggunakan program terminal. Masuk seabagai super user (root) lalu copy file JDK ke direktori dimana JDK tersebut akan diinstal (terserah dimana saja asal jangan di
direktori /tmp). Misalkan saya ingin menginstal java di direktori /usr/lib dan file jdk-1_5_0_04-linux-i586.bin berada di home direktori.

agusta@embedded:~$ su
Password:
embedded:/home/agusta# cp jdk­1_5_0_04­linux­i586.bin /usr/lib
Masuk ke direktori /usr/lib.
embedded:/home/agusta# cd /usr/lib
embedded:/usr/lib# chmod +x jdk­1_5_0_04­linux­i586.bin
embedded:/usr/lib# ./jdk­1_5_0_04­linux­i586.bin


Pada saat instalasi anda akan diminta untuk menyetujui licensi dari java. Tekan tombol Space beberapa kali sampai muncul pertanyaan yang harus anda jawab. Ketik yes sebagai jawabannya yang berarti juga anda menyetujui semua yang tertulis di dalam licensi tersebut. Kemudian tunggu sampai instalasi selesai. Dan setelah selesai hapus file jdk-1_5_0_04-linux-i586.bin pada direktori
/usr/lib.

embedded:/usr/lib# rm ­f jdk­1_5_0_04­linux­i586.bin

Sampai tahap ini instalasi telah selasai dan anda bisa kembali ke user biasa dengan mengetik perintah exit pada console. Selanjutnya yang perlu dilakukan adalah memasang PATH environtment sehingga semua perintah java bisa diakses dari mana saja. Caranya adalah sebagai berikut :

Sebagai user biasa masukan perintah ini di console.
agusta@embedded:~$ export JAVA_HOME=/usr/lib/jdk1.5.0_04
agusta@embedded:~$ export PATH=${JAVA_HOME}/bin:${PATH}
Kemudian tes perintah java.
agusta@embedded:~$ java ­version
java version "1.5.0_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04­b05)JavaHotSpot(TM) Client VM (build 1.5.0_04­b05, mixed mode, sharing)

Jika muncul pesan seperti di atas berarti anda telah berhasil menginstall java dengan benar.

selanjutnya agar lebih efektif dalam menjalankan semua perintah-perintah java sebaiknya PATH environtment ditulis dalam file bash_profile atau bashrc yang terletak di dalam direktori home. Gunakan editor kesayangan anda (vi, nano, jed, dll) untuk mengedit kedua file tersebut. Misalkan anda ingin menulis PATH environtmentya di dalam bash_profile (penulis familiar dengan editor nano) maka:

agusta@embedded:~$ nano .bash_profile

Kemudian ketik tulisan di bawah ini dalam bash_profile.

export JAVA_HOME=/usr/lib/jdk1.5.0_04
export PATH=${JAVA_HOME}/bin:${PATH}

Simpan file tersebut, kemudian jalankan perintah di bawah ini.
agusta@embedded:~$ . ./.bash_profile

Dan selamat, kalian baru saja selesai menginstal java di linux. Sekarang kalian sudah dapat memanfaatkan java di linux kapanpun anda inginkan. saya berharap selain distribusi debian, cara instalasi di atas juga dapat dipakai di semua distribusi linux.
apabila masih kurang jelas search aja di panel search di atas

Readmore »»

Wednesday, September 3, 2008

why must java

in this term we will talk about java...
but,before we step deeper... we will concern "why must java".
in early world of computer programing with high technology,
we need a cooperate with every platform of operating system. and because the world demand, the language programing has growth so fast. and kind of language programing has developed.
when we talk about windows, cocacola, etc... we also talk about its developer directly. but its different in java... java is divided way... java is divided profit... hm,you have not to talk about sun microsystem when you use java in each your projects... and because, java is open source... so java is free absolutely. and you don't need think about license of your application to make your project. you'll be free...

Readmore »»