
oracle jdbc ?useUnicode=true&characterEncoding=utf8加上就报错
driver=oracle.jdbc.OracleDriverurl=jdbc:oracle:thin:@localhost:1521:orcl?useUnicode=t...
driver =oracle.jdbc.OracleDriver
url =jdbc:oracle:thin:@localhost:1521:orcl?useUnicode=true&characterEncoding=utf8
username =jsd1303
password =jsd1303
为什么加上?useUnicode=true&characterEncoding=utf8就会报错啊,不加上我就能获取到,还有就是,原先没用这个命令时MYEclipse 打印con时,是那种乱七八糟的东西,好像是unicode吧,
今天加上这个虽然报错,可是我再删除?useUnicode=true&characterEncoding=utf8后
再 打印 con 竟然是正常的那种字符
jdbc:oracle:thin:@localhost:1521:orcl, UserName=JSD1302, Oracle JDBC driver
好奇怪,为什么啊
=========================
下面是报错的信息(加上?useUnicode=true&characterEncoding=utf8
),不加不报错
Exception in thread "main" org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
localhost:1521:orcl?useUnicode=true&characterEncoding=utf8
) 展开
url =jdbc:oracle:thin:@localhost:1521:orcl?useUnicode=true&characterEncoding=utf8
username =jsd1303
password =jsd1303
为什么加上?useUnicode=true&characterEncoding=utf8就会报错啊,不加上我就能获取到,还有就是,原先没用这个命令时MYEclipse 打印con时,是那种乱七八糟的东西,好像是unicode吧,
今天加上这个虽然报错,可是我再删除?useUnicode=true&characterEncoding=utf8后
再 打印 con 竟然是正常的那种字符
jdbc:oracle:thin:@localhost:1521:orcl, UserName=JSD1302, Oracle JDBC driver
好奇怪,为什么啊
=========================
下面是报错的信息(加上?useUnicode=true&characterEncoding=utf8
),不加不报错
Exception in thread "main" org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
localhost:1521:orcl?useUnicode=true&characterEncoding=utf8
) 展开
2个回答
展开全部
?useUnicode=true&characterEncoding=utf8 是解决乱码问题,将oracle的编码改为utf8,如果正确执行的话,编码方式已经改变了,你再次打印就是正常的字符,至于你说的报错,不知道报的是什么错,无法确定。
我看了一下楼主报的错,应该就是你的sid写错了,就是orcl,数据库监听监听你的sid最后无法连接你的数据库,所以楼主你先看一下你懂得orcl这个sid写错了没,如果没错,你在:以及orcl中间加一个空格试一试
我看了一下楼主报的错,应该就是你的sid写错了,就是orcl,数据库监听监听你的sid最后无法连接你的数据库,所以楼主你先看一下你懂得orcl这个sid写错了没,如果没错,你在:以及orcl中间加一个空格试一试
推荐于2018-03-04
展开全部
jdbc里面Oracle的url不需要加useUnicode=true&characterEncoding=utf8,mySql才需要加这一段来设置编码方式,Oracle在安装数据库的时候就已经设置了,所以不需要再指定了。
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询