I am learning Springboot and wanted to make an application that lets me use postgres to make simple APIs. I have been trying to establish the connection to the JDBC to be able to create a table, however it will not show me a successful connection. I don't know if this is part of the problem but I downloaded postgres through postgres.app on mac.
This is the logging that I am receiving:
Database JDBC URL [Connecting through datasource 'HikariDataSource (HikariPool-1)'] Database driver: undefined/unknown Database version: 17.2 Autocommit mode: undefined/unknown Isolation level: undefined/unknown Minimum pool size: undefined/unknown Maximum pool size: undefined/unknown
My Applications.properties file
spring.application.name=amigoscode-demospring.datasource.url=jdbc:postgresql://localhost:5432/studentspring.datasource.username=beckyspring.datasource.password=spring.jpa.hibernate.dll-auto=create-dropspring.jpa.show-sql=truespring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialectspring.jpa.properties.hibernate.format_sql=truespring.jpa.generate-ddl = true
My pom.xml:
<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>3.4.1</version><relativePath/> <!-- lookup parent from repository --></parent><groupId>com.example</groupId><artifactId>amigoscode-demo</artifactId><version>0.0.1-SNAPSHOT</version><name>amigoscode-demo</name><description>Demo project for Spring Boot Using https://www.youtube.com/watch?v=9SGDpanrc8U&t=424s</description><url/><licenses><license/></licenses><developers><developer/></developers><scm><connection/><developerConnection/><tag/><url/></scm><properties><java.version>17</java.version></properties><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-jpa</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.postgresql</groupId><artifactId>postgresql</artifactId><version>42.7.4</version><scope>runtime</scope></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency></dependencies><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build></project>
Based on the youtube tutorial I should see this in my console when the application starts
Things I have tried/other information:
- My postgres server does not currently have a password and I have checked that I can access it without one.
- I have tried adding properties such as these, but they have not changed anything:
spring.datasource.hikari.maximum-pool-size=10 spring.datasource.hikari.minimum-idle=5 spring.datasource.hikari.connection-timeout=30000 spring.datasource.hikari.idle-timeout=600000 spring.datasource.hikari.max-lifetime=1800000
- I have verified there is a connection with mvn dependency:tree and it shows a connection
- I have verified that the local host is accepting connections with: pg_isready -d postgresql://localhost:5432/student