the JDBC thin driver provides the only way to access Oracle from the Web (applets). It is smaller and slower than the OCI drivers.
the JDBC oci driver :
One must have Net8 (SQL*Net) installed and working before attempting to use one of the OCI drivers.
从使用thin驱动切换到oci驱动在配置来说很简单,只需把连接字符串java:oracle:thin:@hostip:1521:实例名换为java:oracle:oci@本地服务名即可。如:
从 jdbc:oracle:thin:@10.1.1.2:1521:shdb 改成
jdbc:oracle:oci8:@shdb
//shdb具体查看network/admin/tnsnames.ora文件
//有可能thin和oci两种方法的shdb是不一样的
public class TwoThread {
public static void main(String[] args) {
ThinThread thin = new ThinThread();
OciThread oci = new OciThread();
thin.start();
oci.start();
}
}
至于thin和oci的代码在此省略...
2个线程在各自的run函数里都是先进行数据库连接,然后在同一张表中插入50条数据
结果在thin线程刚开始插入第一条数据的时候(也就是连接刚成功),oci线程已经完成了30条的数据插入,之后几乎就是间隔的进行数据插入知道完成...
也就是说2着进行sql语句操作的效率目前还没有比较出来,但是光连接数据库这一步差别就已经很大了...