Guest User

Untitled

a guest
Jun 28th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | None | 0 0
  1. import org.springframework.web.bind.annotation.RequestMapping;
  2. import org.springframework.web.bind.annotation.RestController;
  3. import org.springframework.web.bind.annotation.*;
  4. import java.sql.*;
  5.  
  6. @RestController
  7. @RequestMapping
  8. public class miController {
  9.  
  10. private static String driver = "com.mysql.jdbc.Driver";
  11. private static String server = "jdbc:mysql://localhost/pruebas";
  12. private static Connection conexion = null;
  13.  
  14. miController(){
  15. conectar();
  16. }
  17.  
  18.  
  19. private void conectar() {
  20. try {
  21. Class.forName(driver);
  22. conexion = DriverManager.getConnection(server, "yo", "pass");
  23. } catch (Exception e) {
  24. System.out.println("Error: Imposible realizar la conexion a BD.");
  25. e.printStackTrace();
  26. }
  27.  
  28. }
  29.  
  30. @RequestMapping(value = "/hola", method = RequestMethod.GET)
  31. public @ResponseBody String hola() {
  32. return "Hola mundo2!! " ;
  33. }
  34.  
  35. }
  36.  
  37. Thu Jun 28 17:24:42 CEST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
  38. Error: Imposible realizar la conexion a BD.
  39. java.sql.SQLException: Unable to load authentication plugin 'caching_sha2_password'.
  40. at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:869)
  41. at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:865)
  42. at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1746)
  43. at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1226)
  44. at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2188)
  45. at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2219)
  46. at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2014)
  47. at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:776)
  48. at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
Add Comment
Please, Sign In to add comment