oracle存储过程insert,错误信息:Non supported character set: oracle-character-set-852

这几天快被oracle(10.2.0g)存储过程给搞疯了,开始定义了一个type数据类型,结果就各种报错,什么“无法定义为内部表示”啊,弄了半天结果是我type类型和java里面的数据格式不一致导致的,弄了整个晚上才搞好,因为对oracle的type不太熟悉,所有走了不少弯路

如果你用纯粹的jdbc获取连接,然后调用oracle的存储过程,批量插入数据的话,就看看我的另外一篇文章吧,http://blog.csdn.net/u011054048/article/details/41386693

但是当我换了一个奇葩的连接池(com.bitmechanic.sql)时,遇到ArrayDescriptor desc = ArrayDescriptor.createDescriptor("ARRAY_BARCODEID", conn);就开始报错

java.lang.ClassCastException: com.bitmechanic.sql.PooledConnection cannot be cast to oracle.jdbc.OracleConnection
真是纠结死我了,这个奇葩的连接池网上的资料太少了,搜寻半天无果后,我果断换成了dbcp,获取oracle的connection代码如下:

/**
	 * 功能描述:获取oracle连接
	 * @param con
	 * @return
	 * @throws SQLException
	 */
	public static Connection getOracleConnection(Connection conn) throws SQLException {
		if (conn instanceof DelegatingConnection) {
			Connection nativeCon = ((DelegatingConnection) conn).getInnermostDelegate();
			/* For some reason, the innermost delegate can be null: not for a
			* Statement's Connection but for the Connection handle returned by the pool.
			* We'll fall back to the MetaData's Connection in this case, which is
			* a native unwrapped Connection with Commons DBCP 1.1.
			*/
			System.out.println("getOracleConnection="+(nativeCon != null ? nativeCon : conn.getMetaData().getConnection()));
			return (nativeCon != null ? nativeCon : conn.getMetaData().getConnection());
		}
		return conn;
	}

哎呀,真是松了一口气,但是现在oracle connection获取到了,结果又报错:

java.sql.SQLException: Non supported character set: oracle-character-set-852
有些大神的解决方法,就是把nls_charset12.jar add to build path,我去,我怎么不行呢?!然后各种找啊,突然看到网上说如果各种方法都不行后,那就换个jar包试试吧,然后我就到oracle_home下查找jar包,在F:\oracle\product\10.2.0\db_1\jdbc\lib下,我看到了3种jar包,一个是ojdbc驱动,一个是nls_charset12.jar,还有一个是classes12.jar,我就想,当初我在 http://blog.csdn.net/u011054048/article/details/41386693测试怎么可以,而现在怎么不行了呢?真是苦恼,然后我就试着把classes12.jar加到我的web项目中,重启tomcat,竟然就行了!
我这里附上两个jar(oracle 10g)包地址,免费的哦

nls_charset12.jar

classes12.jar

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值