Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 5 additions & 37 deletions docs/using-the-jdbc-driver/Frameworks.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,7 @@
# The AWS JDBC Driver Integration with 3rd Party Frameworks

## Hibernate

If you are using [Hibernate](https://hibernate.org/orm/), you can configure database access in the `hibernate.cfg.xml` XML configuration file. If you are using a connection pooler with Hibernate, please review [the Hibernate documentation](https://docs.jboss.org/hibernate/orm/current/quickstart/html_single/#hibernate-gsg-tutorial-basic-config) for configuration information.

```hibernate.cfg.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">software.amazon.jdbc.Driver</property>
<property name="hibernate.connection.url">aws-jdbc-wrapper:postgresql://localhost/mydatabase</property>
<property name="hibernate.connection.username">myuser</property>
<property name="hibernate.connection.password">secret</property>
</session-factory>
</hibernate-configuration>
```

## Spring Framework

If you are using Spring, you can use the following sample code as a reference to configure DB access in your application. For more information about Spring, [visit the project website](https://spring.io/).

```SpringJdbcConfig.java
@Configuration
@ComponentScan("com.myapp")
public class SpringJdbcConfig {
@Bean
public DataSource mysqlDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("software.amazon.jdbc.Driver");
dataSource.setUrl("jdbc:postgresql://localhost:5432/testDatabase");
dataSource.setUsername("guest_user");
dataSource.setPassword("guest_password");

return dataSource;
}
}
```
The AWS Advanced JDBC Driver works with multiple 3rd party frameworks.
Here are some examples of configuring the driver to work with these frameworks:
- [Spring and Hibernate](../../examples/SpringHibernateExample/README.md)
- [Spring and Wildfly](../../examples/SpringWildflyExample/README.md)
- [Spring and Hikari](../../examples/SpringBootHikariExample/README.md)
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
The AWS Advanced JDBC Driver supports usage of database credentials stored as secrets in the [AWS Secrets Manager](https://aws.amazon.com/secrets-manager/) through the AWS Secrets Manager Connection Plugin. When you create a new connection with this plugin enabled, the plugin will retrieve the secret and the connection will be created with the credentials inside that secret.

## Enabling the AWS Secrets Manager Connection Plugin
> :warning: **Note:** To use this plugin, you must include the runtime dependencies [Jackson Databind](https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind) and [AWS Secrets Manager](https://mvnrepository.com/artifact/software.amazon.awssdk/secretsmanager) in your project. These parameters are required for the AWS JDBC Driver to pass database credentials to the underlying driver.
> :warning: **Note:** To use this plugin, you must include the runtime dependencies [Jackson Databind](https://central.sonatype.com/artifact/com.fasterxml.jackson.core/jackson-databind) and [AWS Secrets Manager](https://central.sonatype.com/artifact/software.amazon.awssdk/secretsmanager) in your project. These parameters are required for the AWS JDBC Driver to pass database credentials to the underlying driver.

To enable the AWS Secrets Manager Connection Plugin, add the plugin code `awsSecretsManager` to the [`wrapperPlugins`](../UsingTheJdbcDriver.md#connection-plugin-manager-parameters) value, or to the current [driver profile](../UsingTheJdbcDriver.md#connection-plugin-manager-parameters).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
AWS Identity and Access Management (IAM) grants users access control across all Amazon Web Services. IAM supports granular permissions, giving you the ability to grant different permissions to different users. For more information on IAM and it's use cases, please refer to the [IAM documentation](https://docs.aws.amazon.com/IAM/latest/UserGuide/introduction.html).

## AWS IAM Database Authentication
**Note:** To preserve compatibility with customers using the community driver, IAM Authentication requires the [AWS Java SDK RDS v2.x](https://mvnrepository.com/artifact/software.amazon.awssdk/rds) to be included separately in the classpath. The AWS Java SDK RDS is a runtime dependency and must be resolved.
**Note:** To preserve compatibility with customers using the community driver, IAM Authentication requires the [AWS Java SDK RDS v2.x](https://central.sonatype.com/artifact/software.amazon.awssdk/rds) to be included separately in the classpath. The AWS Java SDK RDS is a runtime dependency and must be resolved.

The Advanced JDBC Wrapper supports Amazon AWS Identity and Access Management (IAM) authentication. When using AWS IAM database authentication, the host URL must be a valid Amazon endpoint, and not a custom domain or an IP address.
<br>ie. `db-identifier.cluster-XYZ.us-east-2.rds.amazonaws.com`
Expand Down