Skip to content
Advertisement

Tag: postgresql

setReadOnly not working on PostgreSQL Connection

I have a problem setting a read-only connection with a PostgreSQL database using JDBC. I’m creating an application which loads queries to execute from a file, and I want to execute only SELECT (read-only) queries. Setting permissions on users who will run the application is not an option, so setting permissions at code level through the Connection.setReadOnly(boolean) method was the

Jooq Java CTE wrong render

I have CTE that is been creating from DSL.values: Then i am trying use it to get needed values from DB But i have only the next error I suppose it happens because of (select * from (values(cast(? as varchar)) How to fix it? Other methods without cte work fine. Answer The problem was there: “Id” is needed to be

Using 0 as Primary Key

I use lookup tables commonly and sometimes I have some default record in the Lookup table and I think for this record I can use 0 as Primary Key a as shown below: Project: By doing this I can start from 1 for the actual project values (A, B, C…) and on the other hand I can easily distinguish general/default

spring.jpa.properties.hibernate.jdbc.time_zone applied on writes but not on reads?

I’m using: spring boot 2.0.4.RELEASE spring-data-jpa 2.0.9.RELEASE hibernate-core 5.2.17.Final hibernate-jpa-2.1-api 1.0.0.Final postgres jdbc driver 42.2.9 I have the following entity: and the following property set in application.yaml: Regardless of what the JVM timezone/default timezone is, I want to save and return timestamps in UTC. For testing purposes, I have set the timezone of my application code to US/Hawaii: When I

How to deserialize BigDecimal value received from kafka broker through debezium CDC mechanism?

I have a couple of microservices developed using spring boot and each has its own Postgres database. These microservices exchange data with a CDC mechanism provided by debezium platform through kafka broker and kafka connect. I have a microservice A that stores some entities with a BigDecimal attribute. Another microservice B depends on the data stored by A so it

Create schema if does not exist by using spring Jpa with hibernate

I’m working on spring boot 2 application and trying to establish connection with postgresql database with configuring hikari datasource and spring Jpa. I’m succeed in that and i’m using hibernate.hbm2ddl.auto as update so it is creating table if not exists, but only the problem is it is throwing an exception when schema does not exist Error I configured everything manually

Can I specify *source* IP address for a JDBC connection?

I have a Java application that connects to a database with a JDBC driver. It happens to be a Postgres instance, but I’m looking for a general solution if it exist. The server on which the application runs has multiple IP address, all in the same subnet. The JDBC connection is established using the ‘primary’ IP of the server. I

Advertisement