gastaojunior

Principal.java Cap. 4 - Tecnologia cliente servidor

May 6th, 2021
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.51 KB | None | 0 0
  1. import java.sql.*;
  2.  
  3. public class Principal {
  4.     public static void main(String[] args) {
  5.         conecta();
  6.     }
  7.     public static void conecta(){
  8.         Connection conexao;
  9.         String driver = "com.mysql.jdbc.Driver";
  10.         String ulr = "jdbc:mysql://localhost:3306/teste";
  11.         String login = "root";
  12.         String senha = "";
  13.         try {
  14.             Class.forName(driver);
  15.             conexao = DriverManager.getConnection(ulr, login, senha);
  16.             System.out.println("Conexão Bem Sucedida");
  17.         } catch (Exception e) {
  18.             e.printStackTrace();
  19.         }
  20.     }
  21. }
Add Comment
Please, Sign In to add comment