BlasToIce

Script_P6_Koneksi

Dec 21st, 2018
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. package server.barang;
  2. import java.sql.*;
  3.  
  4. public class ConnectionMySQL
  5. {
  6. Connection conn=null;
  7. PreparedStatement pstm=null;
  8. ResultSet rs=null;
  9. public Connection getConnect()
  10. {
  11. String JDBC_DRIVER="com.mysql.jdbc.Driver";
  12. String JDBC_URL="jdbc:mysql://localhost:3306/gudang";
  13. String USER="root";
  14. String PASS="";
  15. try
  16. {
  17. Class.forName(JDBC_DRIVER);
  18. conn = DriverManager.getConnection(JDBC_URL,USER,PASS);
  19. }
  20. catch (Exception e)
  21. {
  22. System.out.println("Gagal Koneksi"+e.toString());
  23. }
  24. return conn;
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment