我试图在我的应用程序中通过休眠连接到 oracle 11g XE。当我在 tomcat(7.0) 中部署应用程序时,我收到以下消息。
java.sql.SQLException:侦听器拒绝连接并出现以下错误:ORA-12505,TNS:侦听器当前不知道连接描述符中给出的 SID
当我运行应用程序并通过 UI 调用对 Dao 类的请求时,我得到以下异常消息。
org.springframework.jdbc.support.MetaDataAccessException:无法获取用于提取元数据的连接;嵌套异常是 org.springframework.jdbc.CannotGetJdbcConnectionException: 无法获取 JDBC 连接;嵌套异常是 java.sql.SQLException:侦听器拒绝连接并出现以下错误:ORA-12505,TNS:侦听器当前不知道连接描述符中给出的 SID
我的数据库属性文件是
jdbc.driverClassName=oracle.jdbc.driver.OracleDriver
jdbc.url=jdbc:oracle:thin:@localhost:1522:XE
jdbc.username=system
jdbc.password=oracle
我已经安装了 oracle11g XE,这些是我的 tnanames.ora 和 listener.ora 文件。我应该在哪里进行更改。
监听器.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = D:\oracleXE\app\oracle\product\11.2.0\server)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = D:\oracleXE\app\oracle\product\11.2.0\server)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = SIPLDT0019-PC)(PORT = 1522))
)
)
DEFAULT_SERVICE_LISTENER = (XE)
tnsnames.ora
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = SIPLDT0019-PC)(PORT = 1522))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)