-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDatabase.java
More file actions
29 lines (26 loc) · 867 Bytes
/
Copy pathDatabase.java
File metadata and controls
29 lines (26 loc) · 867 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
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
/**
*
* @author soura
*/
public class Database {
protected static Connection initializeDatabase()
throws SQLException, ClassNotFoundException
{
// Initialize all the information regarding
// Database Connection
String dbDriver = "com.mysql.jdbc.Driver";
String dbURL = "jdbc:mysql:// localhost:3306/";
// Database name to access
String dbName = "test";
String dbEmail = "root";
String dbPassword = "";
Class.forName(dbDriver);
Connection con = DriverManager.getConnection(dbURL + dbName,
dbEmail,
dbPassword);
return con;
}
}