JDBC底层驱动 Bottomline
本文导语: Bottomline 是一个底层的JDBC接口,用于直接从jar文件中加载数据库驱动程序,其结构如下图所示 示例代码 Class.forName("xeus.bottomline.BottomlineDriver"); Properties props = new Properties(); props.put("user", "root"); props.put("password", "root"); props.put("ja...
Bottomline 是一个底层的JDBC接口,用于直接从jar文件中加载数据库驱动程序,其结构如下图所示
示例代码
Class.forName("xeus.bottomline.BottomlineDriver");
Properties props = new Properties();
props.put("user", "root");
props.put("password", "root");
props.put("jar","D:\database-drivers\mysql-connector-java-5.0.3\mysql-connector-java-5.0.3-bin.jar");
props.put("class", "com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection("jdbc:bottomline:mysql://localhost:3306/myDB", props);
/*
In version 1.2 or later.
The connection parameters can be passed as Query String to the connection URL
*/
Connection conn1 = DriverManager.getConnection("jdbc:bottomline:mysql://localhost:3306/myDB?user=root&password=root"
+ "&jar=D:\database-drivers\mysql-connector-java-5.0.3\mysql-connector-java-5.0.3-bin.jar"
+ "&class=com.mysql.jdbc.Driver");
// And also like the following
Connection conn2 = DriverManager.getConnection("jdbc:bottomline:mysql://localhost:3306/myDB?"
+ "&jar=D:\database-drivers\mysql-connector-java-5.0.3\mysql-connector-java-5.0.3-bin.jar"
+ "&class=com.mysql.jdbc.Driver", "root", "root");
编者:我觉得这个项目实在有点脱裤子放屁!