I\'ve looked over the documentation to define a bean. I\'m just unclear on what class file to use for a Mysql database. Can anyone fill in the bean definition below?
Use this class org.springframework.jdbc.datasource.DriverManagerDataSource
- DriverManagerDataSource. As a best practice its better if we isolate the database values into a .properties
file and configure it into our spring servlet xml configuration. In the below example the properties are stored as key-value pairs and we access the value
using the corresponding key
.
applicationContext-dataSource.xml:
jdbc.propeties file:
jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/sample_db
jdbc.username=root
jdbc.password=sec3ret