java中使用JDBC连接数据库的步骤?

[复制链接]
查看11 | 回复2 | 2011-10-11 10:34:26 | 显示全部楼层 |阅读模式
jdbc的流程:
1.注册驱动
DriverManager.registerDriver(new Driver());
2.获得连接
DriverManager.getConnection(url,user,password)==con
3.创建Statement对象
con.createStatement()==Statement sta
4.执行SQL
sta.execute(sql)==ResultSet rs
5.处理结果
...
回复

使用道具 举报

千问 | 2011-10-11 10:34:26 | 显示全部楼层
import java.sql.*;public class ConnectionDB {private static ConnectionDB connDB = new ConnectionDB();private static Connection conn;private ConnectionDB() {try {...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行