Spring getdriverclassname method: get the name of the database driver class
•
Java
getDriverClassName()
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(driver,url,username,password);
String driverClassName = dmd.getDriverClassName();
System.out.println("数据库驱动类为:"+driverClassName);
}
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
二维码
