Skip to content

Commit 82c595f

Browse files
authored
Update UCPDBTokenSample.java
1 parent be6367e commit 82c595f

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

java/jdbc/ConnectionSamples/UCPDBTokenSample.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
/*
33
DESCRIPTION
44
The code sample shows how to use the JDBC driver and UCP to establish a
5-
connection to the Autonomous Database (ADB) using database token
5+
connection to the Autonomous Database (ADB) using access token
66
issued by the OCI Identity service.
77
88
Step 1: Enter the DB_URL to pointing to your Autonomous Database (ADB)
99
Step 2: Make sure to have either 21.4.0.0.1 or 19.13.0.0.1 or later versions of
1010
JDBC driver and UCP (ucp.jar) in the classpath. Both must be from the same version.
11-
Step 2: Compile and Run the sample UCPDBTokenSample
11+
Step 3: Compile and run the sample UCPDBTokenSample
1212
1313
NOTES
1414
Use JDK8 and above
@@ -36,9 +36,17 @@ public class UCPDBTokenSample {
3636
// Note that you need to pass the property oracle.jdbc.tokenAuthentication=OCI_TOKEN for token authentication
3737
final static String DB_URL="jdbc:oracle:thin:@dbname_high?TNS_ADMIN=/Users/test/Walet/Wallet_dbname&oracle.jdbc.tokenAuthentication=OCI_TOKEN";
3838

39-
// If mutla TLS(mTLS) is disabled then, ADB connection does not require wallets.
39+
// If mutual TLS(mTLS) is disabled then, ADB connection does not require wallets.
4040
// Copy the connection string from "DB Connection" tab from "Connection Strings" section choosing "TLS" in the dropdown
41-
//final static String DB_URL="jdbc:oracle:thin:@(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1521)(host=adb.us-phoenix-1.oraclecloud.com))(connect_data=(service_name=gebfdferevpozhjbqbs_dbname_medium.adb.oraclecloud.com)))?oracle.jdbc.tokenAuthentication=OCI_TOKEN";
41+
//final static String DB_URL="jdbc:oracle:thin:@(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1521)(host=adb.us-phoenix-1.oraclecloud.com))(connect_data=(service_name=gebqererpozhjbqbs_dbname_medium.adb.oraclecloud.com)))?oracle.jdbc.tokenAuthentication=OCI_TOKEN";
42+
43+
// Enable IAM token authentication using long form connection string.
44+
/*
45+
final static String DB_URL="jdbc:oracle:thin:@(description="
46+
+ "(retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1521)(host=adb.us-phoenix-1.oraclecloud.com))"
47+
+ "(security=(token_auth=OCI_TOKEN))"
48+
+ "(connect_data=(service_name=gebfdferevpozhjbqbs_dbname_medium.adb.oraclecloud.com)))";
49+
*/
4250

4351
final static String CONN_FACTORY_CLASS_NAME="oracle.jdbc.pool.OracleDataSource";
4452

0 commit comments

Comments
 (0)