Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package jdbc;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.SQLException;
- public class ConnectionFactory {
- public Connection getConnection(){
- System.out.println("Conectando ao banco");
- try{
- Class.forName("com.mysql.jdbc.Driver").newInstance();
- Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/teste", "root", "julianna");
- return con;
- }catch(SQLException e){
- throw new RuntimeException(e);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement