Advertisement
Guest User

Untitled

a guest
Sep 10th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. public class conexion {
  2. public String db ="Juntaagua";
  3. public String url="jdbc:mysql://127.0.0.1:8889/"+db;
  4. public String user="root";
  5. public String pass= "root";
  6. public int nombre = 1;
  7.  
  8. public conexion() {
  9. }
  10.  
  11. public Connection conectar(){
  12. Connection link = null;
  13.  
  14. try {
  15. Class.forName("org.gjt.mm.mysql.Driver");
  16. link=DriverManager.getConnection(this.url, this.user, this.pass);
  17. } catch (ClassNotFoundException | SQLException e) {
  18. JOptionPane.showConfirmDialog(null, e);
  19. }
  20.  
  21. return link;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement