Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package db;
- import java.sql.*;
- public class DBConnection {
- static Connection conn;
- public static Connection getConnection()
- {
- try
- {
- Class.forName("com.mysql.jdbc.Driver");
- try
- {
- /* String url = "jdbc:mysql://localhost:3306/blewsrms";
- String uname = "root";
- String pwd = "root";
- */
- String url = "jdbc:mysql://localhost:3306/bleweduc_sms";
- String uname = "bleweduc_abc";
- String pwd = "abc@123";
- conn = DriverManager.getConnection(url,uname,pwd);
- System.out.println("connection Successfull");
- }
- catch (SQLException ex)
- {
- ex.printStackTrace();
- }
- }
- catch(ClassNotFoundException e)
- {
- System.out.println(e);
- }
- return conn;
- }
- }
Add Comment
Please, Sign In to add comment