ConectionFactory cf = new ConectionFactory();//创建数据库连接
Connection con = cf.getConection();//打开水数据库的连接
PreparedStatement pst = null;//声明一个PreparedStatement类型的对象
String sql = "SQL语句"
pst = con.prepareStatement(sql);//执行SQL语句
executeQuery()方法返回查询到的结果集,ResultSet类型变量接收
executeUpdate()方法返回受影响的数据行数,int类型变量接收
JDBC连接流程
转载本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
上一篇:shell函数
下一篇:html day 01 下半
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
JDBC连接
JDBC连接数据库参考
职场 休闲 JDBC连接数据库 -
jdbc连接Gbase
gbase8a 简单操作
jdbc Gbase -
测试JDBC连接
jdbc的简单测试连接数据库
测试 class 数据库连接 version 数据库访问 -
JDBC连接步骤
JDBC:Java Data Base ConnectionJDBC是用于运行sql语句并从数据库中获取新新的java API.JDBC是用来(让我们的程序
JDBC连接步骤 SQL 数据库 存储过程