Let's take a look at how various popular Databases can be configured using Spring Boot.
1. MySQL
applications.propertiesspring.datasource.url=jdbc:mysql://localhost:3306/mysqldb
spring.datasource.username=root
spring.datasource.password=msqyl-server-password
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.26</version>
</dependency>
2. PostgreSQL
applications.propertiesspring.datasource.url=jdbc:postgresql://localhost:5432/postgredb
spring.datasource.username=user
spring.datasource.password=postgresql-server-password
Maven dependency pom.xml
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>43.0.1</version>
</dependency>
3. Oracle Server
applications.propertiesspring.datasource.url=jdbc:oracle:thin:@localhost:1521:oracledb
spring.datasource.username=oracle-db-user
spring.datasource.password=oracle-server-password
Maven dependency pom.xml
<dependency>
<groupId>com.oracle.ojdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>9.3.0.0</version>
</dependency>
4. Microsoft SQL Server
applications.propertiesspring.datasource.url=jdbc:sqlserver://localhost:1433;databaseName=sqldb
spring.datasource.username=sql-db-user
spring.datasource.password=sql-db-password
Maven dependency pom.xml
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>9.4.0.jre8</version>
</dependency>
We took a look at some Relational Databases configurations, now lets take a look at some NoSQL database configurations with Spring Boot.
1. DynamoDB
applications.propertiesspring.data.mongodb.uri=mongodb://localhost:27017/dynamodb
Maven dependency pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
<version>2.6.3</version>
</dependency>
2. Cassandra
applications.propertiesspring.data.cassandra.contact-points=localhost
spring.data.cassandra.port=9042
spring.data.cassandra.keyspace-name=cassandradb
Maven dependency pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-cassandra</artifactId>
<version>2.6.3</version>
</dependency>
3. Redis
applications.propertiesspring.redis.host=localhost
spring.redis.port=6379
Maven dependency pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
<version>2.6.3</version>
</dependency>
4. Apache HBase
applications.propertiesspring.data.hbase.quorum=localhost
spring.data.hbase.zk-port=2181
Maven dependency pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-hadoop</artifactId>
<version>2.6.3</version>
</dependency>
5. Couchbase
applications.propertiesspring.couchbase.bootstrap-hosts=localhost
spring.couchbase.bucket.name=bucket-name
spring.couchbase.bucket.password=server-password
Maven dependency pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-couchbase</artifactId>
<version>2.6.3</version>
</dependency>
Have Questions? Post them here!
- Fix NVIDIA GeForce Experience ERROR CODE 0x0003
- How to convert byte array to String [Kotlin]
- Unzip a Zip file from Terminal Command
- How to write hello world different languages syntax
- [Error] zsh: command not found: mvn
- How to know the version of OpenSSL
- [Solution] IDEA IntelliJ System.out.println function shortcut (sysout alternative for eclipse IDE)
- The default username and password for RabbitMQ
- ChatGPT Outage: Hmm...something seems to have gone wrong. Maybe try me again in a little bit.
- How to check the version of NodeJS installed
- Gmail Unable to upload because it is a folder or a package (like an application bundle or RTFD document)
- How to remove password from pdf file
- BSNL Broadband upgrades speed to minimum 2MBps for all users 512Kbps 1Mbps
- MongoDB: Failed to connect to 127.0.0.1:27017 reason: Connection refused
- Turn off Focus Mode on Mac
- Steps to Delete or Deactivate Instagram Account
- [IRCTC] Indian railways official eRail API 1.1 for developers to get train info
- CentOS Cannot find a valid baseurl for repo base7x86_64 yum
- Why I see Download pre-built shared indexes in IntelliJ
- Copy file from a remote server to current local directory system using SCP command
- [Fix] Minecraft Error: A JNI error has occurred, please check your installation and try again
- How to install Zsh shell
- Merge multiple zip files without unzipping (extracting)
- How to find someone on Instagram
- How to get an embed code from Vimeo?
- List of Java Keywords - Java
- Use Google Chrome Canvas to create drawings - Chrome
- Android : Prevent App for rotation landscape or portrait - Android
- Fix Windows Update Error Code: 0x80070643 - Windows
- Microsoft Teams enable or disable Spell check - Teams
- Toast not getting displayed Android App - Android
- SharePoint workflow Canceled - Coercion Failed: Unable to transform the input lookup data into the requested type - SharePoint
- [Fix] Cannot connect to Microsoft SQL Server, Error: 18456 - Microsoft