MCPcopy Create free account
hub / github.com/diyhi/bbs / getConnection

Method getConnection

src/test/java/cms/Init.java:193–201  ·  view source on GitHub ↗

获取数据库连接 @return

()

Source from the content-addressed store, hash-verified

191 * @return
192 */
193 private static Connection getConnection() throws Exception{
194 Install install = getDatabaseParameter();
195
196 //linux下5.7必须加这句,不然会报错java.sql.SQLException: No suitable driver found for
197 DriverManager.registerDriver(new com.mysql.cj.jdbc.Driver());//注册驱动
198
199 return DriverManager.getConnection(install.getDatabaseURL().trim(), install.getDatabaseUser().trim(), install.getDatabasePassword().trim());
200
201 }
202
203
204 /**

Callers 1

installMethod · 0.95

Calls 1

getDatabaseParameterMethod · 0.95

Tested by

no test coverage detected