Advertisement
Guest User

Untitled

a guest
May 29th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 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 com.ruslan.fahmi.login;
  7.  
  8. import com.mysql.jdbc.Connection;
  9. import com.mysql.jdbc.Statement;
  10. import java.sql.DriverManager;
  11. import java.sql.SQLException;
  12.  
  13. /**
  14. *
  15. * @author Ruslan
  16. */
  17. public class Koneksi {
  18. public Connection con;
  19. public Statement ss;
  20.  
  21. String driverName = "com.mysql.jdbc.Driver";
  22. String url = "jdbc:mysql://localhost:3306/db_kyojin_karate";
  23. String username = "root";
  24. String password = "";
  25.  
  26. public void getKoneksi()
  27. {
  28. try {
  29. con = (Connection) DriverManager.getConnection(url, username, password);
  30. System.out.println("Koneksi Sukses ");
  31. ss = (Statement) con.createStatement();
  32.  
  33. }catch (SQLException ex) {
  34. System.out.println("Koneksi Gagal");
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement