我有一个使用Postgres的 Spring Boot应用程序(1.2).今天我正在尝试将其切换到Oracle,但是当我尝试连接时,我得到一个异常,说:
java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
在那之下,
Caused by: java.net.ConnectException: Connection refused
当然,这看起来像是糟糕的凭据,但我知道它们很好,而且他们在Oracle SQL Developer中工作得很好.我很困惑.这是我的属性文件条目:
# Properties for Hibernate and Oracle
spring.datasource.driverClassName=oracle.jdbc.driver.OracleDriver
spring.datasource.url=jdbc:oracle:thin:@//earth-db-11:5121/stardev
spring.datasource.username=ops$abcdefg
spring.datasource.password=mypassword
spring.jpa.database-platform=org.hibernate.dialect.Oracle10gDialect
我唯一的想法就是用户名中有一个$,我试图转义并在其周围加上双引号.
有任何想法吗?
谢谢…
更新:
非常感谢BonanzaOne,我的端口号错了.更正会导致新错误:
java.sql.SQLRecoverableException: Listener refused the connection with the following error:
ORA-12514, TNS:listener does not currently know of service requested in connect descriptor
当然,我查了一下,但我没有按照它告诉我的说法:
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
Cause: The listener received a request to establish a connection to a database
or other service. The connect descriptor received by the listener specified a
service name for a service (usually a database service) that either has not yet
dynamically registered with the listener or has not been statically configured
for the listener. This may be a temporary condition such as after the listener
has started, but before the database instance has registered with the listener.
不过,SQL Explorer连接正常.