Pages

Subscribe:

Ads 468x60px

5/25/11

Connect Java and Database (2) Create Database

After XAMPP running, then make a new database using phpmyadmin. You may open your browser and click this URL : http://localhost/phpmyadmin/ there'll be a view like this and you may create a database name "databasename" like I do.
 Then it would be:

Then make a new java project in NetBean, which filled with syntax that could edit the database's proses such as update, delete, insert, etc.
 Then include the driver for java and mysql in Libraries :
then choose MySQL JDBC Driver, but before that you must download it in http://dev.mysql.com/downloads/connector/j/. And you must copy mysql-connector-java-5.1.12-bin.jar to c:/programfile/java/jdk/jre/lib/ext if you are use a windows OS, so do with directories org and com to src folders of your NetBean projects example : D:\NetBeansProjects\javamysql\src.

Next is make a new .java files for connecting the database with java and the main program for execute it. First make a java file named Connecting that have a syntax like this :
And make a main.java for syntax like this :
Then when you execute Main.java, it must be like this :
 Next we'll make a program for database operation..^_^

0 comments:

Post a Comment