jdbc编程步骤

本文详细介绍了Java中如何使用JDBC进行数据库操作的基本步骤,包括加载驱动、建立连接、执行SQL语句、获取结果数据及关闭资源等。通过这些步骤,读者可以了解如何在Java应用程序中实现对数据库的操作。

##1.Load the Driver

注册 Class.forName("oracle.jdbc.driver.OracleDirver");

或 new oracle.jdbc.driver.OracleDirver();

##2.Connect to the DataBase

DriverManager.getConnection();

##3.Execute the SQL

Connection.createStatement(); Statement.executeQuery(); Statement.executeUpdate();

##4.Restrieve the result data

循环取得结果while(rs.next()){}

##5.Show the result data

将数据库中的各种类型转换为java中的类型(getXXX)方法

##6.Close

close the ResultSet close the Statement close the Connection

转载于:https://my.oschina.net/csmw00/blog/675509

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值