昨天搞了一下springMVC+Hibernate时,启动项目进行数据操作时,老报这个错:
java.sql.SQLException: 无法从套接字读取更多的数据
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1123)
at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1075)
at oracle.jdbc.driver.T4C8TTIpro.receive(T4C8TTIpro.java:131)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:881)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:268)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:441)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at ConnOracle.main(ConnOracle.java:25)
......
搞了一整天没弄出个所以然,今天再弄了一下,发现这个错误的原因是因为配置数据连接时,
<property name="url">
<value>jdbcracle:thin127.0.0.1:1521rcl</value>
</property>
的sid:"orcl"错了。因为之前我看了oracle安装目录下的C:\oracleproduct\10.2.0\db_1\NETWORK\ADMIN\listener.ora文件内容为:
# listener.ora Network Configuration File: C:\oracle\product\10.2.0\db_1\network\admin\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = C:\oracle\product\10.2.0\db_1)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = h00044)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
)
就把数据库连接配置的sid设置成“PLSExtProc”,结果一运行就老是报这个错误,弄了很久郁闷死了。
原因就是SID应为orcl,这是系统安装时默认的,如果修改改的话,那就将sid设为你安装时候设置的。
现在问题解决了,特记下来,以备以后碰到相同的问题可用,也希望对碰到相同问题的童鞋能够参考。
--转自