@@ -55,7 +55,8 @@ public class ADBQuickStart {
55
55
public static void main (String args []) throws Exception {
56
56
// Make sure to have Oracle JDBC driver 18c or above
57
57
// to pass TNS_ADMIN as part of a connection URL.
58
- // TNS_ADMIN - Should be the path where the client credentials zip file is downloaded.
58
+ // TNS_ADMIN - Should be the path where the client credentials zip (wallet_dbname.zip) file is downloaded.
59
+ // dbname_medium - It is the TNS alias present in tnsnames.ora.
59
60
final String DB_URL ="jdbc:oracle:thin:@dbname_medium?TNS_ADMIN=/Users/test/wallet_dbname/" ;
60
61
// Update the Database Username and Password to point to your Autonomous Database
61
62
final String DB_USER = "admin" ;
@@ -100,16 +101,13 @@ public static void main(String args[]) throws Exception {
100
101
System .out .println ("Available connections after checkout: "
101
102
+ pds .getAvailableConnectionsCount ());
102
103
System .out .println ("Borrowed connections after checkout: "
103
- + pds .getBorrowedConnectionsCount ());
104
-
104
+ + pds .getBorrowedConnectionsCount ());
105
105
// Perform a database operation
106
- try {
107
106
doSQLWork (conn );
108
107
} catch (SQLException e ) {
109
108
System .out .println ("ADBQuickStart - "
110
109
+ "doSQLWork()- SQLException occurred : " + e .getMessage ());
111
- }
112
- }
110
+ }
113
111
114
112
System .out .println ("Available connections after checkin: "
115
113
+ pds .getAvailableConnectionsCount ());
@@ -124,15 +122,15 @@ private static void doSQLWork(Connection conn) throws SQLException {
124
122
String queryStatement = "SELECT CUST_ID, CUST_FIRST_NAME, CUST_LAST_NAME, CUST_CITY,"
125
123
+ "CUST_CREDIT_LIMIT FROM SH.CUSTOMERS WHERE ROWNUM < 20 order by CUST_ID" ;
126
124
127
- System .out .println ("Query is " + queryStatement );
125
+ System .out .println ("\n Query is " + queryStatement );
128
126
129
127
conn .setAutoCommit (false );
130
128
// Prepare a statement to execute the SQL Queries.
131
129
try (Statement statement = conn .createStatement ();
132
130
// Select 20 rows from the CUSTOMERS table from SH schema.
133
131
ResultSet resultSet = statement .executeQuery (queryStatement )) {
134
- System .out .println (" \n CUST_ID" + " " + "CUST_FIRST_NAME" + " " + "CUST_LAST_NAME"
135
- + " " + "CUST_CITY" + " " + "CUST_CREDIT_LIMIT" );
132
+ System .out .println (String . join ( " " , " \n CUST_ID" , "CUST_FIRST_NAME" ,
133
+ "CUST_LAST_NAME" , "CUST_CITY" , "CUST_CREDIT_LIMIT" ) );
136
134
System .out .println ("-----------------------------------------------------------" );
137
135
while (resultSet .next ()) {
138
136
System .out .println (resultSet .getString (1 ) + " " + resultSet .getString (2 ) + " " +
0 commit comments