Commit b5a9f95 1 parent 6e099f1 commit b5a9f95 Copy full SHA for b5a9f95
File tree 3 files changed +40
-4
lines changed
ojdbc-provider-aws/src/main/java/oracle/jdbc/provider/aws/configuration
ojdbc-provider-samples/src/main/java/oracle/jdbc/provider/aws/configuration
3 files changed +40
-4
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public InputStream getJson(String s3Url) throws SQLException {
29
29
30
30
URI uri = null ;
31
31
try {
32
- uri = new URI (s3Url );
32
+ uri = getURI (s3Url );
33
33
} catch (URISyntaxException uriSyntaxException ) {
34
34
throw new SQLException (uriSyntaxException );
35
35
}
@@ -53,4 +53,11 @@ public InputStream getJson(String s3Url) throws SQLException {
53
53
public String getType () {
54
54
return "awss3" ;
55
55
}
56
+
57
+ private URI getURI (String s3Url ) throws URISyntaxException {
58
+ if (!s3Url .startsWith ("s3://" )) {
59
+ s3Url = "s3://" + s3Url ;
60
+ }
61
+ return new URI (s3Url );
62
+ }
56
63
}
Original file line number Diff line number Diff line change 44
44
import java .sql .SQLException ;
45
45
import java .sql .Statement ;
46
46
47
+ /**
48
+ * A standalone example that configures Oracle JDBC to be provided with the
49
+ * connection properties retrieved from AWS S3.
50
+ */
47
51
public class AwsS3Example {
48
52
private static String url ;
53
+
54
+ /**
55
+ * <p>
56
+ * A simple example to retrieve connection properties from AWS S3.
57
+ * </p><p>
58
+ * For the default authentication, the only required local configuration is
59
+ * to have a valid AWS Config in ~/.aws/config and ~/.aws/credentials.
60
+ * </p>
61
+ * @param args the command line arguments
62
+ * @throws SQLException if an error occurs during the database calls
63
+ */
49
64
public static void main (String [] args ) throws SQLException {
50
65
51
66
// Sample default URL if non present
52
67
if (args .length == 0 ) {
53
- // url = "jdbc:oracle:thin:@config-awss3://s3://{bucket-name}/{key-name}";
54
- url = "jdbc:oracle:thin:@config-awss3://s3://tinglwan-general-bucket/folder1/payload_ojdbc_adb_aws_secret.json" ;
55
- // url = "jdbc:oracle:thin:@config-file:///Users/tinglwang/Notes/ojdbc-plugins/ociobject/payload_ojdbc_wallet_location_base64_sso.json";
68
+ url = "jdbc:oracle:thin:@config-awss3://{bucket-name}/{key-name}" ;
56
69
} else {
57
70
url = args [0 ];
58
71
}
Original file line number Diff line number Diff line change 1
1
package oracle .jdbc .provider .aws .configuration ;
2
2
3
3
import oracle .jdbc .datasource .impl .OracleDataSource ;
4
+ import oracle .jdbc .provider .oci .configuration .ObjectStorageExample ;
4
5
5
6
import java .sql .Connection ;
6
7
import java .sql .ResultSet ;
7
8
import java .sql .SQLException ;
8
9
import java .sql .Statement ;
9
10
11
+ /**
12
+ * A standalone example that configures Oracle JDBC to be provided with the
13
+ * connection properties retrieved from AWS Secrets Manager.
14
+ */
10
15
public class AwsSecretsManagerConfigurationExample {
11
16
private static String url ;
17
+
18
+ /**
19
+ * <p>
20
+ * A simple example to retrieve connection properties from AWS Secrets Manager.
21
+ * </p><p>
22
+ * For the default authentication, the only required local configuration is
23
+ * to have a valid AWS Config in ~/.aws/config and ~/.aws/credentials.
24
+ * </p>
25
+ * @param args the command line arguments
26
+ * @throws SQLException if an error occurs during the database calls
27
+ */
12
28
public static void main (String [] args ) throws SQLException {
13
29
14
30
// Sample default URL if non present
You can’t perform that action at this time.
0 commit comments