Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DB Connections (db address only) #639

Open
kkehl-usgs opened this issue Oct 29, 2021 · 3 comments
Open

DB Connections (db address only) #639

kkehl-usgs opened this issue Oct 29, 2021 · 3 comments

Comments

@kkehl-usgs
Copy link

Hi,

We'd like to be able to swap databases without redeploying FROST server. For other servers we typically create a CNAME record and supply that as the database address to the server, then we can modify the CNAME record as desired.

However, it seems like this would not be doable with FROST server since we are using org.postgresql.Driver and it seems like it cannot resolve:

jdbc:postgresql://:/sensorthings

Is it possible to add the ability to just configure a database address and database port and connect that way? Thanks!

@hylkevds
Copy link
Member

I don't really see how a piece of software is supposed to make a connection to :, since that contains no hostname nor a port number. How is that supposed to be resolved to an IP address?

You'd need at least a name and port number in there, hence the default jdbc:postgresql://database:5432/sensorthings that makes the driver resolve the name database to an IP address, and connect to that on port 5432.

Is the actual problem that the name is only resolved once, and when the name is changed in the DNS server, the name is not resolved again when the connection is lost?

@kkehl-usgs
Copy link
Author

kkehl-usgs commented Oct 29, 2021

sorry I don't know why that was blank, I think I had hostname and ports in brackets, it must have been stripped out. What I mean is just to provide the hostname, port, username, and password and that's it.

The problem is that frost server won't connect when the 'database' portion is a CNAME record, although I can connect to the database just fine with a CNAME record when I use pg_admin. FROST Server connects fine when I use an RDS endpoint, but not when I use a CNAME record that redirects to an RDS endpoint. So somehow passing the jdbc string with an embedded CNAME record doesn't resolve (presumably in the org.postgresgrl.Driver). Thanks!

And trying again on the formatting, here is what doesn't work when I put it into a FROST Server variable:

jdbc:postgresql://CNAME_record:port/sensorthings

@hylkevds
Copy link
Member

I don't see what that wouldn't work. Do any other Java programs have an issue with CNAMEs?
You might want to ask on the PGJDBC github, or break out WireShark to see what's actually happening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants