Advertisement
Guest User

Untitled

a guest
Jul 1st, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.51 KB | None | 0 0
  1. package ConnectPkg;
  2. import java.SQL.*;
  3.  
  4. public class ConnectDB{
  5. public static Statement connecttodatabase(url, USER, pass){
  6. String DRIVER = "com.mysql.jdbc.Driver";
  7. Class.forName(DRIVER).newInstance();
  8.  
  9.  
  10. Connection con = NULL;
  11. Statement state = NULL;
  12.  
  13. try{
  14. String url="jdbc:mysql://dbsrv2.cs.fsu.edu/cop4710t30db?user=cop4710t30&password=brA7he6r";
  15.  
  16. con = DriverManager.getConnection(url);
  17. state = con.createStatement();
  18.  
  19. RETURN state;
  20. }catch(Exception e){
  21. System.OUT.println(e.getMessage());
  22. }
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement