×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Israel Edet
Added: Dec 4, 2016 7:28 PM
Modified: Dec 4, 2016 7:29 PM
Views: 25
Group 1 Project
  1.  
  2. package inventorysystem.data;
  3.  
  4.  
  5. import java.sql.Statement;
  6. import java.sql.Connection;
  7. import java.sql.DriverManager;
  8. import java.sql.SQLException;
  9.  
  10. /**
  11.  *
  12.  * @author Epic
  13.  */
  14. public class DBConnectionClass {
  15.     private Connection db_conection;
  16.     private Statement stmt;
  17.     public DBConnectionClass() {
  18.         try {
  19.             Class.forName("com.mysql.jdbc.Driver").newInstance();
  20.             db_conection = DriverManager.getConnection("jdbc:mysql://localhost:3306/inventory_system", "root", "");
  21.         } catch (Exception e) {
  22.             e.printStackTrace();
  23.         }
  24.          
  25.        
  26.     }
  27.     public Connection getConnection(){
  28.          return db_conection;
  29.      }
  30.  
  31. }
  32.  

1 comment

Yani Fernandez 2 months ago
nice one

Write a comment