Java JDBC - How to connect to Oracle using tnsnames.ora

后端 未结 5 2060
再見小時候
再見小時候 2020-11-29 08:41

tnsnames.ora file contains the Databases and the their description (host + port).

  • Is it possible to esta

5条回答
  •  有刺的猬
    2020-11-29 09:17

    You can also try the following

    Try this, after some hours of troubleshooting came across a sample which I modified and it works like a gem.

    jdbc:oracle:thin:@(description=(address_list=(address=(protocol=tcp)(port=1521)(host=19.16.200.12)) (address=(protocol=tcp)(port=1521)(host=19.16.200.10)))(load_balance = yes)(connect_data=(SERVICE_NAME=stackdb)))
    

    A none load balance sample is given Below:

    jdbc:oracle:thin:@(description=(address_list=(address=(protocol=tcp)
    (port=1521)(host=prodHost)))(connect_data=(INSTANCE_NAME=ORCL)))
    

    Here is the URL that helped https://docs.oracle.com/cd/E11882_01/java.112/e16548/jdbcthin.htm#JJDBC28202

提交回复
热议问题