Guest User

Untitled

a guest
Mar 11th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. driver = com.mysql.jdbc.Driver
  2. url = jdbc:mysql://localhost:3306/TestingSystem
  3. user = root
  4. password = admin
  5. charset = utf8
  6.  
  7. private void connect(){
  8. String urlDB = properties.getProperty("url");
  9. connectionInfo.put("user", properties.getProperty("user"));
  10. connectionInfo.put("password", properties.getProperty("password"));
  11. connectionInfo.put("charSet", properties.getProperty("charset"));
  12. try {
  13. Class.forName(properties.getProperty("driver"));
  14. } catch (ClassNotFoundException e) {
  15. log.error("Not found driver for data base");
  16. }
  17. try {
  18. connection = DriverManager.getConnection(urlDB, connectionInfo);
  19. if(connection == null) {
  20. log.error("Connection with data base isn't open.");
  21. } else {
  22. log.info("Connection with data base is open.");
  23. }
  24. } catch (SQLException e) {
  25. log.error("Error connection with data base");
  26. }
  27. }
  28.  
  29. UPDATE basic_data SET data = 'Пример'
  30. WHERE name = 'Пример'
  31.  
  32.  
  33. INSERT INTO test_data_questions(input_data, output_data, id_question)
  34. VALUES('Пример', 'Пример', (SELECT q.id FROM questions q WHERE q.title = 'Пример'))
Add Comment
Please, Sign In to add comment