Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package database;
- import java.sql.*;
- import java.util.logging.Level;
- import java.util.logging.Logger;
- public class Db_Connection
- {
- public void main (String[] args){
- Connection cnx= Connection();
- }
- public Connection Connection()
- {
- try
- {
- Class.forName("com.mysql.jdbc.Driver");
- String techworld3g = "jdbc:mysql://localhost:3306/techworld3g?user=root";
- Connection myConnection = DriverManager.getConnection(techworld3g);
- return myConnection;
- } catch (ClassNotFoundException | SQLException ex) {Logger.getLogger(Db_Connection.class.getName()).log(Level.SEVERE, null, ex);}
- return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement