Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package model;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.SQLException;
- public class Db {
- // JDBC Drive configurações
- static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
- static final String DB_URL = "jdbc:mysql://localhost/SimpleERP";
- // Credenciais para acesso ao banco de dados
- static final String USUARIO = "root";
- static final String SENHA = "";
- public Db(){
- }
- public static void Conectar() {
- try {
- try {
- Class.forName(JDBC_DRIVER);
- System.out.println(" [ DB ] Conectando...");
- Connection con = DriverManager.getConnection(DB_URL, USUARIO, SENHA);
- System.out.println(" [ DB ] Conectado.");
- con.close();
- } catch (SQLException e) { // Connection
- e.printStackTrace();
- }
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- };
- }
- }
Add Comment
Please, Sign In to add comment