Hello all,
Can anyone direct me as to how to connect to a remote PostsgreSQL database? To connect to a server on the same computer, I use the following code:
host() = "localhost"
port() =DbPortNo
DatabaseName() = DbName
DatabaseUserName() = DbUser
DatabasePassword() = DbPW
If db.connect then
//proceed with database operations
#If TargetConsole Then
Print DbName + " PostgreSQL Database Opened and Connected Properly."
#Elseif TargetDesktop then
//ModuleInterface.Update_Display(DbName + " PostgreSQL Database Opened and Connected Properly.")
#endif
return 0
else
#If TargetConsole Then
Print DbName + " PostgreSQL Database Did Not Open or Connected Properly. " + Cstr(db.ErrorCode) + " " + db.ErrorMessage
#Elseif TargetDesktop then
//ModuleInterface.Update_Display(DbName + " PostgreSQL Database Did Not Open or Connected Properly. " + Cstr(db.ErrorCode) + " " + db.ErrorMessage)
#endif
return db.ErrorCode
end if
Do I just change the “host” to show the IP of the remote database (if on a LAN)? If so what is the syntax to do so? What about a WAN based server instance?
Thanks,
Tim