Advertisement
Guest User

conexao.jaav

a guest
May 16th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package cirobd;
  7.  
  8. import java.sql.*;
  9.  
  10.  
  11. public class conexao {
  12.  
  13. public conexao() {
  14.  
  15. try{
  16. Class.forName("com.mysql.jdbc.Driver");
  17.  
  18.  
  19. Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/dbagenda","root","root");
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26. System.out.println("OK:Conexão OK");
  27.  
  28.  
  29.  
  30. } catch(Exception e){
  31. System.out.println(e);
  32. System.out.println("Erro2 SQL"+e.getMessage());
  33.  
  34. }
  35.  
  36.  
  37. }
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement