-
Notifications
You must be signed in to change notification settings - Fork 0
/
DBLoader.java
32 lines (24 loc) · 924 Bytes
/
DBLoader.java
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
import java.sql.*;
class DBLoader
{
static ResultSet executeQuery(String sqlstatement)
{
try
{
Class.forName("com.mysql.jdbc.Driver");
System.out.println("Driver Loaded Successful");
Connection conn=DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/musicstreaming","nikhil","applehunt");
System.out.println("Connection Built");
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
System.out.println("Statement Created");
ResultSet rs=stmt.executeQuery(sqlstatement);
System.out.println("ResultSet Created");
return rs;
}
catch(Exception ex)
{
ex.printStackTrace();
}
return null;
}
}