MYSQL
ORACLE
要求jdk至少1.6以上
SQL Server
每一种数据库有不同的版本,也有数据库对JDK版本有要求,具体驱动版本的选择,可以参考数据库官方文档说明。
#
2.String url="jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncodin
3.String username="root";
4.String password="test1234";
5.Connection conn=DriverManager.getConnection(url,username,password);
6.try{
7.//增删改查等CRUD操作8.
9.}catch(SQLException e){10.
11.}finally{
12.//最后关闭连接
13.try{
14.if(conn!=null&&!conn.isClosed()){
15.conn.close();
16.}
17.}catch(SQLException e){
18.e.printStackTrace();
19.}
20.}
基本的JDBC编程,比较繁琐,所以出现了封装JDBC编程细节的各种框架,这些框架常见的有Mybais,Hibernate,DbUtils等。
联系客服