Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.sql.*;
- public class Principal {
- public static void main(String[] args) {
- conecta();
- }
- public static void conecta(){
- Connection conexao;
- String driver = "com.mysql.jdbc.Driver";
- String ulr = "jdbc:mysql://localhost:3306/teste";
- String login = "root";
- String senha = "";
- try {
- Class.forName(driver);
- conexao = DriverManager.getConnection(ulr, login, senha);
- System.out.println("Conexão Bem Sucedida");
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
Add Comment
Please, Sign In to add comment