PostgresqlConnectionFactory host not resolved on linux

48 views
Skip to first unread message

Stefan Schöning

unread,
Jul 6, 2023, 7:26:10 AM7/6/23
to r2dbc
Hi all,

i have a strange behavior  with my example code ich have no problems to connect to my DB in mac os 64bit/amd and 64bit/arm 
when i use native-packager to deploy to kubernetes i got a host/<unresolved> error and i cannot conncet to db

So i wrote a little codeexample and run ist on a nativ linux 64bit machine and got the same error there!

Cannot connect to myhostlocation.../<unresolved>:5433

val config = PostgresqlConnectionConfiguration
.builder()
.host("myhostlocation...")
.port(5433)
.database("yugabyte")
.username("someuser")
.password("mysecretpassword")
.build()


val connection = connectionFactory.create()

val mono: Mono[Connection] = Flux.from(connection).next()

mono.flatMapMany(connection => {
println("Connection established")
connection.createStatement("INSERT INTO person (id, first_name, last_name) VALUES ($1, $2, $3)")
.bind("$1", 1)
.bind("$2", "Walter")
.bind("$3", "White")
.execute()
}).flatMap(result => {
println("Statement executed")
result.getRowsUpdated
}).subscribe(rowsUpdated => {
println("Inserted " + rowsUpdated + " row(s)")

})

Reply all
Reply to author
Forward
0 new messages