Guest User

Untitled

a guest
Aug 11th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. <bean id="dataSource"
  2. class="org.springframework.jdbc.datasource.DriverManagerDataSource">
  3.  
  4. <property name="driverClassName" value="com.mysql.jdbc.Driver" />
  5. <property name="url" value="jdbc:mysql://localhost:3306/dbName" />
  6. <property name="username" value="root" />
  7. <property name="password" value="password" />
  8. </bean>
  9.  
  10. <bean name="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"
  11. p:dataSource-ref="dataSource" />
  12.  
  13. <dependency>
  14. <groupId>org.springframework</groupId>
  15. <artifactId>spring-jdbc</artifactId>
  16. <version>4.3.18.RELEASE</version>
  17. </dependency>
  18.  
  19. <dependency>
  20. <groupId>mysql</groupId>
  21. <artifactId>mysql-connector-java</artifactId>
  22. <version>5.1.30</version>
  23. </dependency>
  24.  
  25. Exception in thread "main" org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server.
Add Comment
Please, Sign In to add comment