Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BasicDataSource ds = new BasicDataSource();
- ds.setDriverClassName("com.mysql.jdbc.Driver");
- ds.setUrl("jdbc:mysql://localhost/db1?autoReconnect=true");
- ds.setUsername("root");
- ds.setPassword("");
- db = new JdbcTemplate(ds);
- 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.)
- at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement