我有一个使用Postgres的Spring Boot应用程序(1.2)。今天,我想将其切换到Oracle,但是当我尝试连接我得到一个异常,说:无法通过Spring Boot和Hibernate连接到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
我唯一的想法是,有在用户名$,而我试图逃避它,并把它周围的双引号。
任何想法?
谢谢...
UPDATE:
非常感谢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连接罚款。
赞成@ BonanzaOne的回答,您是否可以使用完全相同的凭据/连接url连接到Oracle与SQL Developer? – xenoterracide
糟糕,所以stardev是SID,而不是服务名称。只是要弄清楚如何使用SID来代替... –
明白了!我必须将/更改为:并在主机名称前删除//。谢谢你们! –