Linux 下Oracle Client JAVA JDBC 集成点滴

首先Java下根据JDBC规范连接数据库,有几种形式,参考 

http://djdnmq.iteye.com/blog/356468 oracle 驱动oci thin 区别

 

Oracle客户端准备

10201_client_linux32.zip

安装完成后,需要确保在终端中可以正确的执行sqlplus命令

Oracle环境变量

如果Tomcat是服务,需要把Oracle的安装环境变量写到TOMCAT中,类似如下

Tomcat加入/home/**/apache-tomcat-6.0.35/bin/catalina.sh开头,当前的用户加入:.bash_profile的末尾,具体的内容如下: 

export ORACLE_HOME=/home/ ** /oracle/product/10.2.0/client_1

export ORACLE_BASE=/home/ ** /oracle/product/10.2.0

export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME:$ORACLE_HOME/lib:$ORACLE_HOME/jdbc/lib:${LD_LIBRARY_PATH}

 

建立到目标数据库的TNS连接

类似在/home/**/oracle/product/10.2.0/client_1/bin执行./netmgr

建立到目标数据库的TNS名字,此时就可以使用JDBC的OCI形式访问Oracle数据库了

 

Web容器访问Oracle出现如下错误的一些参考资料 

no ocijdbc10 in java.library.path

 https://forums.oracle.com/forums/thread.jspa?threadID=290097

 https://forums.oracle.com/forums/thread.jspa?threadID=615281

- JDBC Thin Driver 
100% Java client-side JDBC driver for use in client applications, middle-tier servers and applets.

- JDBC OCI Driver 
Client-side JDBC driver for use on a machine where OCI is installed.

- JDBC Thin Server-side Driver 
JDBC driver for use in Java program in the database to access remote Oracle databases.

- JDBC Server-side Internal Driver Server-side JDBC driver for use by Java Stored procedures. This driver used to be called the "JDBC Kprb Driver". 

 http://www.oracle.com/technetwork/database/enterprise-edition/jdbc101040-094982.html

 https://forums.oracle.com/forums/thread.jspa?threadID=290097 

 

posted @ 2012-05-01 15:38  2012  阅读(1040)  评论(0编辑  收藏  举报