Spring setdriverclassname method: set the driver class of the data source
•
Java
setDriverClassName(String driverClassName)
Example
public static void main(String[] args){ String driver = "com.MysqL.jdbc.Driver"; String url = "jdbc:MysqL://lzw:3306/testDatabase"; String username = "root"; String password = "111"; DriverManagerDataSource dmd = new DriverManagerDataSource(url); dmd.setDriverClassName(driver); //设置数据库的驱动类 …… //省略获取数据库连接和其他操作 }
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码