我一直希望客户端不安装oracle客户端,无论我使用java、delphi、c++,当知道oracle10g出了instant client轻量级客户端后,我就开始查找相关资料,终于可以了,将方法贡献出来,希望能帮助大家。
经测试,用oracle10g代的instant client连接oracle9.2,没有什么问题,根据instant client产品经理的说法,应该连接8i也没有什么问题。
Oracle 10G 中Instant Client 的使用
==============================================================
从10G开始,Oracle 提供了一个较为轻量级的客户包,叫做
Instant Client. 将它安装好后,就不用再安装庞大的
Oracle Client了. 这对于应用程序的分发是一个改进.
(用winrar3.3压缩后大概27M)
步骤:
1. 从OTN 下载几个压缩包,解压到一个目录, c:\instant client
instantclient-basic-win32-10.1.0.2.zip : 这是最核心的包
instantclient-jdbc-win32-10.1.0.2.zip: 包含JDBC Driver的包
instantclient-sqlplus-win32-10.1.0.2.zip: 最简单的SQLPLUS包
2. 配置环境变量和tnsnames.ora/sqlnet.ora文件
首先, PATH变量中加入 c:\instant client
如果你的机器从来没有安装过ORACLE的软件,注册表中
应该没有下面这个键:
HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE
因此,我们可以写一个批处理的文件,手工的添加
环境变量, 例如:
set NLS_LANG=SIMPLIFIED CHINESE_CHINA.ZHS16GBK
>>>> 此处设置这个根本没有用,可以在系统环境变量
中增加一个NLS_LANG,也可以在注册表中增加一个:
[HKEY_LOCAL_MACHINE\SOFTWARE\Oracle]
"NLS_LANG"="SIMPLIFIED CHINESE_CHINA.ZHS16GBK",
这样中文问题就可以解决了,前提是你在客户端的字符
集设置需要保持和服务器端的一致。
最后,再配置tnsnames.ora和sqlnet.ora. 如果本机找
不到示例文件,就从server上拷贝一个.
3. 如果开发JAVA应用程序,还要配置一些环境变量,
例如CLASSPATH,JAVA_HOME等等. CLASSES12.jar 文件是
必须的,其他的根据需要添加.
4. 如果启动SQLPLUS时出现下面的错误:
ORA-12545: Connect failed because target host or object does not exist
试着把tnsnames.ora 中的host 改成IP地址.
文章二:Oracle Instant Client 虹湾安装版
URL:http://irisbay.com/cgi-bin/index.cgi?action=viewnews&id=30
点击这里下载
http://www.orientaletravel.com/ora10client.rar
Oracle Instant Client 10.2.0.1 可以免费分发的Oracle小巧客户端
可连接8.1.7以上的Oracle数据库
可安装于从未安装过Oracle的机器
可以支持delphi,VB或PB开发的应用程序
可以支持PL/SQL Developer
安装内容:
0. 复制文件
1. 设置环境变量ORACLE_HOME, NLS_LANG, TNS_ADMIN
2. 将安装目录加入PATH
3. 生成默认的TNSNAMES.ORA
4. 安装完后根据自己的情况编辑TNSNAMES.ORA
内容来源 http://www.oracle.com/technology/software/tech/oci/instantclient/
Instant Client allows you to run your applications without installing the standard Oracle client or having an ORACLE_HOME. OCI, OCCI, Pro*C, ODBC, and JDBC applications work without modification, while using significantly less disk space than before. Even SQL*Plus can be used with Instant Client. No recompile, no hassle.
ISVs and Partners benefit greatly from packaging Instant Client along with their applications, saving customers the extra step of installing and configuring an Oracle client. Free. The same fully-featured, high-performance applications that Oracle ISVs and partners have always delivered will continue to work, untouched.
Customers can try new packaged applications and Oracle client features quickly without worrying about other installations. Larger enterprises can automate setup and configuration of Instant Client by using installation scripts accessing a central IT repository. Finally, everyone can benefit from the smaller footprint.
Especially for production use. Especially for free.
Instant Client的组成:
- Basic Package:
All files required to run OCI, OCCI, and JDBC-OCI applications
- JDBC Supplement Package*:
Additional support for XA, Internationalization, and RowSet operations under JDBC
- SQL*Plus Package*:
Additional libraries and executable for running SQL*Plus with Instant Client
- SDK Package*:
Additional header files and an example makefile for developing Oracle applications with Instant Client
- ODBC Package*:
Additional libraries for enabling ODBC applications
Instant Client的相关地址:
http://www.oracle.com/technology/tech/oci/instantclient/instantclient.html
http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/winsoft.html
http://www.oracle.com/technology/tech/oci/instantclient/ic-faq.html