How to connect sqlite database from java jframe


import java.sql.*;


import javax.swing.JOptionPane;

public class ConnectionClass
{
    Connection conn = null;
    public static Connection dbconnect()
    {
    try {
      Class.forName("org.sqlite.JDBC");
      Connection conn = DriverManager.getConnection("jdbc:sqlite:F:\\New folder\\New folder\\JavaProgram\\SchoolMnagementSystem\\SchoolManagementSystem.sqlite");
      //JOptionPane.showMessageDialog(null, "Connected");
      return conn;
    } catch ( Exception e )
    {
      JOptionPane.showMessageDialog(null, e);
      return null;
    }
  }
}

No comments:

Post a Comment