Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Md Mostafizur Rahman
Added: Nov 25, 2018 6:22 AM
Views: 6
Tags: no tags
  1.  
  2. package DAO;
  3.  
  4. import java.sql.*;
  5. public class DatabaseHelper {
  6.     public static Connection getConnection(){
  7.         try {
  8.             Class.forName("com.mysql.jdbc.Driver");
  9.             Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/employee_payroll","root","root");
  10.             return con;
  11.         } catch (Exception e) {
  12.             System.err.println("Connection error");
  13.             return null;
  14.         }
  15.     }
  16. }
  17.