Types of Java applications using the SQLite database

Minggu, 20 November 2011
preliminary
This article discusses a simple example application using Java and SQLite. core of this article is the use of the SQLite database in java applications.

why I'm using SQLite? because in a previous article I had discussed about the introduction of SQLite where one advantage is that we do not need to install a database server because the database already terinstegrasi or embeded into Java applications that we make. we just need a plug-v056.jar sqlitejdbc java application that can connect to the SQLite database.



syntax connection

     package configuration;
     import java.sql.Connection;
     java.sql.DriverManager import;
     import java.sql.SQLException;
     import javax.swing.JOptionPane;
     / **
     * @ Author Agus Sumarna
     * /
     public class dbConnection {
     private Connection connection;

     public Connection connect () {
     / / for connection to a driver
     try {
     Class.forName ("org.sqlite.JDBC");
     System.out.println ("managed to load driver");
     } catch (ClassNotFoundException cnfe) {
     System.out.println ("No Driver" + cnfe);
     }

     / / for connection to the database
     try {
     String url = "jdbc: sqlite: db / db_pegawai.sqlite";
     connection = DriverManager.getConnection (url);
     System.out.println ("Successful connection");
     } catch (SQLException se) {
     System.out.println ("Failed to connect" + a)​​;
     JOptionPane.showMessageDialog (null, "Database Connection Failed", "Warning", JOptionPane.WARNING_MESSAGE);
     }
     return connection;
     }
     }

     1. For the driver there is in the lib folder in project application folder
     2. For database files found in the db folder in project application folder

application





 

The functions in the application are:

     1. Displays employee data
     2. Deleting employee data
     3. Updating employee data
     4. Finding data on behalf of employees


Download

download Java applications using the SQLite database

A few of my articles may be useful to your friends and you all
I hope you all can use this program as well as possible....

0 komentar: On Types of Java applications using the SQLite database

Posting Komentar

Grab this Widget ~ Blogger Accessories
 
bottom