起步软件技术论坛-X3

 找回密码
 立即注册
搜索
查看: 1014|回复: 4

Oracle数据库的JDBC连接

[复制链接]
发表于 2006-3-31 09:11:57 | 显示全部楼层 |阅读模式
使用10.1版本的jdbc驱动连接到Oracle9i的数据库时,执行插入或修改的语句包括中文时会报错ORA-01461。

Oracle920的错误文档上是这样描述1461错误的:

ORA-01461 can bind a LONG value only for insert into a LONG column

Cause: An attempt was made to insert a value from a LONG datatype into

another datatype. This is not allowed.

Action: Do not try to insert LONG datatypes into other types of columns.

不过,检查修改的数据库表并没有发现LONG类型的字段。而且插入英文不会出现问题,只有在插入中文的时候才会报错。

只有将jdbc的jar包换成9i的或10.2的,同样的程序都不会报错。
这个错误在thin模式出现,修改为oci模式就好了,可以不换驱动程序。
回复

使用道具 举报

 楼主| 发表于 2006-3-31 10:36:03 | 显示全部楼层
- classes111.zip & classes111.jar
    Classes for use with JDK 1.1.x.  It contains the JDBC driver
    classes except classes necessary for NLS support in Object and
    Collection types.

  - nls_charset11.zip & nls_charset11.jar
    NLS classes for use with JDK 1.1.x.  It contains classes necessary
    for NLS support in Object and Collection types.

  - classes111_g.zip & classes111_g.jar
    Same as classes111.zip, except that classes were compiled with
    "javac -g" and contain OracleLog traceing code.

  - classes12.zip & classes12.jar
    Classes for use with JDK 1.2.x.  It contains the JDBC driver
    classes except classes necessary for NLS support in Object and
    Collection types.

  - nls_charset12.zip & nls_charset12.jar
    NLS classes for use with JDK 1.2.x.  It contains classes necessary
    for NLS support in Object and Collection types.

  - classes12_g.zip & classes12_g.jar
    Same as classes12.zip, except that classes were compiled with
    "javac -g" and contain OracleLog tracing code.

  - classes12dms.jar
    Same as classes12.jar except contains additional code to support
    Oracle Dynamic Monitoring Service.

  - classes12dms_g.jar
    Same as classes12dms.jar except that classes were compiled with
    "javac -g" and contain OracleLog traceing code.

  - ojdbc14.jar
    Classes for use with JDK 1.4. It contains the JDBC driver
    classes except classes necessary for NLS support in Object and
    Collection types. Use nls_charset12.jar if needed.

  - ojdbc14_g.jar
    Same as ojdbc14.jar except that classes were compiled with
    "javac -g" and contain OracleLog tracing code.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-3-31 10:38:37 | 显示全部楼层
On Win95/Win98/NT:
  - Add [ORACLE_HOME]\jdbc\lib\classes111.zip and
    [ORACLE_HOME]\jdbc\lib\nls_charset11.zip to your CLASSPATH.
    (Add classes12.zip and nls_charset12.zip if JDK 1.2.x or 1.3 is
    used. Add ojdbc14.jar and nls_charset12.zip if JDK 1.4 is used.)
  - Make sure [ORACLE_HOME]\bin is in your PATH.

On Solaris/Digital Unix:
  - Add [ORACLE_HOME]/jdbc/lib/classes111.zip and
    [ORACLE_HOME]/jdbc/lib/nls_charset11.zip to your CLASSPATH.
    (Add classes12.zip and nls_charset12.zip if JDK 1.2.x or 1.3 is
     used. Add ojdbc14.jar and nls_charset12.zip if JDK 1.4 is used.)
  - Add [ORACLE_HOME]/jdbc/lib to your LD_LIBRARY_PATH.

On HP/UX:
  - Add [ORACLE_HOME]/jdbc/lib/classes111.zip and
    [ORACLE_HOME]/jdbc/lib/nls_charset11.zip to your CLASSPATH.
    (Add classes12.zip and nls_charset12.zip if JDK 1.2.x or 1.3 is
    used. Add ojdbc14.jar and nls_charset12.zip if JDK 1.4 is used.)
  - Add [ORACLE_HOME]/jdbc/lib to your SHLIB_PATH and LD_LIBRARY_PATH.

On AIX:
  - Add [ORACLE_HOME]/jdbc/lib/classes111.zip and
    [ORACLE_HOME]/jdbc/lib/nls_charset11.zip to your CLASSPATH.
    (Add classes12.zip and nls_charset12.zip if JDK 1.2.x 1.3 is
     used.  Add ojdbc14.jar and nls_charset12.zip if JDK 1.4 is used.)
  - Add [ORACLE_HOME]/jdbc/lib to your LIBPATH and LD_LIBRARY_PATH.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-5-16 10:46:41 | 显示全部楼层
我们推荐采用OCI模式,thin模式对 二进制字段的支持不好。

thin就是纯粹用Java完成访问数据库的所有方法,优点是不用安装客户端,但是对二进制字段访问效率非常差
  jdbcracle:thinyouroraclehost:1521:yoursid

oci就是使用Java来调用本机的Oracle客户端然后再访问数据库,优点是速度快但是需要安装和配置数据库
  jdbcracleciyouroracle-tns-name
或者
  jdbcracleci(description=(address=(host=youroraclehost)(protocol=tcp)(port=1521))(connect_data=(SERVICE_NAME=yourservicename)))

平台上用了很多的二进制字段,因此必须使用oci模式
回复 支持 反对

使用道具 举报

发表于 2006-5-25 09:50:04 | 显示全部楼层
COM+的版本,Oralce的客户端只支持10.1(包括10.1)以下的版本,10.2不支持。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Justep Inc.

GMT+8, 2024-12-27 12:00 , Processed in 0.044664 second(s), 15 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表