Advertisement
Guest User

Untitled

a guest
Apr 20th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. BasicDataSource ds = new BasicDataSource();
  2. ds.setDriverClassName("com.mysql.jdbc.Driver");
  3. ds.setUrl("jdbc:mysql://localhost/db1?autoReconnect=true");
  4. ds.setUsername("root");
  5. ds.setPassword("");
  6. db = new JdbcTemplate(ds);
  7.  
  8. Exception in thread "main" org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Cannot create PoolableConnectionFactory (Could not create connection to database server. Attempted reconnect 3 times. Giving up.)
  9. at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement