Advertisement
yayachadazt

d

Sep 15th, 2014
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1.  
  2. package aplikasi.yaya.koneksi;
  3. import java.sql.Connection;
  4. import java.sql.DriverManager;
  5. import java.sql.PreparedStatement;
  6. import java.sql.ResultSet;
  7. import java.sql.Statement;
  8. /**
  9. *
  10. * @author YAYA
  11. */
  12. public class koneksi {
  13.  
  14.  
  15. public Connection con ;
  16. public ResultSet res ;
  17. public Statement stat ;
  18. public PreparedStatement pre ;
  19. public void koneksi(){
  20. try {
  21. Class.forName("com.mysql.jdbc.Driver");
  22. try {
  23. String url ="jdbc:mysql://localhost:3306/apmasjid";
  24. String user="root";
  25. String pass="";
  26. con=DriverManager.getConnection(url,user,pass);
  27. stat=con.createStatement();
  28. System.out.println("Koneksi Berhasil");
  29. } catch (Exception e) {
  30. }
  31. } catch (Exception e) {
  32. System.out.println("Gagal");
  33. }}
  34.  
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement