I am using a PostgreSQL database.
After each query to the database, I call db.close and then when the database needs to be queried again I call something like:
db.Host = "123.456.0.789"
db.UserName = "postgres"
db.Password = "dbexample"
db.DatabaseName = "postgres"
Return db.connect
I was wondering what db.connect is actually doing.
Does it:
Test the connection:
if connected, returns True
if Not connected, tries to reconnect (and then returns the result of the attempt to reconnect)
Or does it just reconnect to the database each time.
It just seems that the database does not lose the connection instantly when db.close is called, and calls to the database within a certain period of time seem to happen faster than the time it takes for the initial connect.
Just wondering.