-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconnection.java
More file actions
33 lines (26 loc) · 800 Bytes
/
connection.java
File metadata and controls
33 lines (26 loc) · 800 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package end_sem3;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class connection {
static Connection con = null;
public static Connection connectDB()
{
String url = "jdbc:mysql://localhost:3306/blockchain";
String username = "root";
String password = "Prahas@12319";{
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection(url, username, password); // creating the connection between the compiler and sql database
return con;
}
catch (SQLException e) {
System.out.println(e);
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return con;
}
}