0

I have a spring boot JPA application that works fine locally by connecting to the oracle database which also running locally.

But when I deploy my application to pivotal cloud foundry it gives below exception while connecting to local database server:

2020-02-08T15:13:27.499+05:30 [APP/PROC/WEB/0] [OUT] Caused by: java.net.UnknownHostException: DESKTOP-619LJLN: Name or service not known 2020-02-08T15:13:27.499+05:30 [APP/PROC/WEB/0] [OUT] at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method) ~[na:1.8.0_242] 2020-02-08T15:13:27.499+05:30 [APP/PROC/WEB/0] [OUT] at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:929) ~[na:1.8.0_242]

application.properties as below:

spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.jpa.database-platform=org.hibernate.dialect.Oracle10gDialect
spring.jpa.hibernate.ddl-auto=update
security.require-ssl=false
spring.datasource.url=jdbc:oracle:thin:AVINASH_DB/oracle@DESKTOP-659FJUK:1522:xe

I tried using cups in PCF but its not working.Kindly let me know how to connect local databse from PCF. note: i dont want to use database services in pcf market place.trying to figureout how to connect external db from pcf. Thanks in advance

Rashed Hasan
  • 3,721
  • 11
  • 40
  • 82
Avinash Jethy
  • 803
  • 2
  • 10
  • 25
  • The name of your database server is not resolvable from your PCF installation (that's what the error means). In order for your app to reach the database, it needs to be able to first resolve the DNS name you use (or you can just use the direct IP) and then IP of your database needs to be routable from your PCF environment. If it's not routable, the traffic won't make it from PCF to your database. I don't know what you mean by "running locally", but if your database is running on your laptop it's almost certainly not accessible from PCF. Anything else, talk to your network admin. – Daniel Mikusa Feb 09 '20 at 21:15

1 Answers1

0

Add DNS information to the network at opsmanager dashboard-> bosh director tile to let PAS identify the host in the DB. Temporarily you can use oracle DB's IP in your app.

leedh
  • 11
  • 3