Monday, 12 February 2018

how to connect java with sqlite database

who to///////////////////******************* Java Connector ***************////////////////////////

           

import java.sql.*;

import javax.swing.*;

public class connector {

    

    Connection cn=null;

    public static Connection connectorBD()

    { 

        try 

        {

            Class.forName("org.sqlite.JDBC");

            Connection cn = DriverManager.getConnection("jdbc:sqlite:C:\\Users\\bilal\\Documents\\NetBeansProjects\\HospitalManagementSystem\\HospitalManament.sqlite");//Here you past your address

         

            return cn;

        }

        catch(Exception e)

        { 

            JOptionPane.showMessageDialog(null, e);

            return null;

        }

    }

} 

No comments:

Post a Comment