Advertisement
cybergraph

pertemuan10ConnectionApp

Dec 12th, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 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 pert10;
  7. import java.io.*;
  8. import java.sql.*;
  9. /**
  10. *
  11. * @author LK09NU17UTY
  12. */
  13. public class ConnectionApp {
  14.  
  15.  
  16. public static void jalankan()
  17. {
  18. Connection com = null;
  19.  
  20.  
  21.  
  22.  
  23. try
  24. {
  25. String jdboDriver = "com.mysql.jdbc.Driver";
  26. Class.forName(jdboDriver);
  27.  
  28. String url ="jdbc:mysql://localhost:3306/mahasiswa";
  29. String user="root";
  30. String pswd="";
  31.  
  32. System.out.println("Mencoba menmabngun koneksi ke"+url+"'dengan user'"+user+"'password'"+pswd+"'...'");
  33. com= DriverManager.getConnection(url,user,pswd);
  34. System.out.println("Sukses");
  35. }
  36. catch(Exception e)
  37. {
  38. e.printStackTrace();
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement