Raizekas

DB sukurimas

Feb 23rd, 2021
66
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package org.db.veiksmai;
  2.  
  3. import java.sql.Connection;
  4. import java.sql.DriverManager;
  5. import java.sql.SQLException;
  6.  
  7. public class DuombazesSukurimas
  8. {
  9. public static Connection sukurtiDuomenuBaze () throws SQLException
  10. {
  11. String dbNuoroda = "jdbc:mysql:// localhost:3306/";
  12. String dbVardas = "prekiu_katalogas";
  13. String dbUsername = "root";
  14. String dbPassword = "";
  15.  
  16. Connection jungtis = DriverManager.getConnection(dbNuoroda + dbVardas, dbUsername, dbPassword);
  17.  
  18. return jungtis;
  19. }
  20.  
  21.  
  22. }
  23.  
RAW Paste Data