Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static Connection connection = null;
- public static Connection getConnection()
- {
- try{
- if(connection == null){
- Class.forName("com.mysql.jdbc.Driver");
- Connection con=DriverManager.getConnection(
- "jdbc:mysql://localhost/demo","root","");
- connection = con;
- }
- }catch(Exception e)
- {
- System.out.println(e);
- }
- return connection;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement