Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package br.com.utd.jdbc;
- import java.sql.DriverManager;
- import java.sql.SQLException;
- import javax.swing.JOptionPane;
- import com.mysql.jdbc.Connection;
- public class Conexao {
- private final static String URL = "jdbc:mysql://127.0.0.1:3306/livraria";
- private final static String USUARIO = "root";
- private final static String SENHA = "**********";
- public static Connection factoryConexao(){
- Connection conexao = null;
- try{
- conexao = DriverManager.getConnection(URL, USUARIO, SENHA);
- return conexao;
- }catch(SQLException e1){
- JOptionPane.showMessageDialog(null,
- "Falha na conexão com o banco de dados:"+e1);
- return conexao;
- }
- }
- }
- conexao = DriverManager.getConnection(URL, USUARIO, SENHA);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement