Latest news:

New android application Islamic Video has been released. its a free islamic video application for android smartphone. Download now!

MySQL database connection using java

Right Click on the libraries  under your projec propertise , now click on the Add jar/folder

now add the mysql-connector-java-5.1.23-bin.jar

now add the following class to your project 

package yourpackagename;

import java.sql.*;

public class DB {

    Connection con = null;
    Statement st = null;
    ResultSet rs = null;
    ResultSetMetaData md = null;
    String dburl = "jdbc:mysql://localhost:3306/addressBook";
    String dbuser = "root";
    String dbpassword = "";

    public DB() {
        try {
            con = DriverManager.getConnection(dburl, dbuser, dbpassword);
            st = con.createStatement();
        } catch (Exception ex) {

Tags :

Views : 4

Recent Posts


Popular Tags


Subscribe Us

Follow Us