-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPecConnector.java
More file actions
23 lines (22 loc) · 895 Bytes
/
PecConnector.java
File metadata and controls
23 lines (22 loc) · 895 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package Project;
/**
*
* @author ritesh
*/
import java.sql.*;
import javax.swing.JOptionPane;
public class PecConnector{
Connection conn = null;
public static Connection ConnectorDb(){
try{
//Class.forName("org.sqlite.JDBC"); // for sqlite
//Connection conn = DriverManager.getConnection("jdbc:sqlite://media//ritesh//Windows//Users//RITESH GOYAL//Documents//NetBeansProjects//Step_tutorials//db1.sqlite");//for sqlite
Class.forName("com.mysql.jdbc.Driver"); //for mysql
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/pec","root","Goyal1998"); //for mysql
//JOptionPane.showMessageDialog(null, "connection Established");
return conn;
}catch(ClassNotFoundException | SQLException e){
JOptionPane.showMessageDialog(null, e);
return null;}
}
}