获取数据库连接 @return
()
| 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 | /** |
no test coverage detected