Reputation: 16795
There are 2 URL syntax, old syntax which will only work with SID and the new one with Oracle service name.
Old syntax
jdbc:oracle:thin:@[HOST][:PORT]:SID
New syntax
jdbc:oracle:thin:@//[HOST][:PORT]/SERVICE
What is correct JDBC URL syntax if Oracle wallets are used?
According to this article following URL syntax should be used:
jdbc:oracle:thin:/@db_alias
But as I can see following URL works too:
jdbc:oracle:thin:@db_alias
Which of these syntaxes are correct?
Upvotes: 11
Views: 31479
Reputation: 1472
When you are using Oracle Wallet with a JDBC string, both syntax's are allowed, so long as your "db_alias" is setup in your Wallet store obviously.
Now, as far as using SQL*Plus with Oracle Wallet, the only format allowed with Oracle Wallet is:
/@db_alias
By the way, that article you referenced (and others) specifies you can only connect using JDBC if you use the OCI drivers, and not the thin client. This is/was typically because Java had no knowledge of the Oracle TNS and SQLNET files. This is in fact not true; you can connect using the JDBC thin driver with the latest Oracle Client & JDBC Drivers, but it just requires some setup. See http://tech.shopzilla.com/2011/09/oracle-wallet-with-thin-driver-with-connection-pool-with-database-timeouts/ for info on that, and below for a short summary.
Using Oracle Wallet with JDBC Thin Driver
ojdbc6.jar
oraclepki.jar
osdt_cert.jar
osdt_core.jar
-Doracle.net.tns_admin=C:\myTNSdir
-Doracle.net.wallet_location=C:\mywalletdir
jdbc:oracle:thin:/@MY_WALLET_DB_ENTRY
Upvotes: 25