Hi
Sorry, can’t find how to pass connect_timeout=10 to the SqlDatabaseMBS class for PostgreSQL.
In xojo it is possible to do like:
PostgreSQLDatabase.Connect ( Optional additionalOptions As String = "" ) As Boolean
so in code it looks like:
inDb.Connect("connect_timeout=10")
Thank you!
you can include it as part of the connection string “;timeout=1000;”
everything start with first semicolon is options in connection string.
Sorry, not clear.
db = new mySQLDatabaseMBS
// this is path for a Mac, your path will be different!
dim libPath as string = "/Library/PostgreSQL/9.1/lib/libpq.5.4.dylib"
db.Option(db.kOptionLibraryPostgreSQL) = libPath
// connect to database
// in this example it is Postr,
// but can also be Sybase, Oracle, Informix, DB2
// SQLServer, InterBase, SQLBase and ODBC
db.DatabaseName="PostgreSQL:127.0.0.1,5432@postgres"
db.UserName="postgres"
db.Password="xxx"
if db.Connect then
// tell server to send notifications to us
db.SQLExecute "LISTEN test;"
// listen for notifications
db.Listen
else
MsgBox db.ErrorMessage
quit
end if
Where is the connection string in this case? db.DatabaseName?
try:
db.DatabaseName="PostgreSQL:127.0.0.1,5432@postgres;timeout=1000"
FATAL: invalid command-line argument for server process: connect_timeout=10
HINT: Try “postgres --help” for more information.
connect_timeout is correct option
Tried:
db.DatabaseName="PostgreSQL:127.0.0.1,5432@postgres;connect_timeout=10"
This is strange. Maybe someone else has an idea?
it works perfectly with xojo’s PostgreSQLDatabase.
Looks like MBS passes it in wrong way
It is not a command-line option, it is a connection option
Please try this:
"db.DatabaseName="PostgreSQL:127.0.0.1,5432@dbname=postgres connection_timeout=10"
Seems like it is a space instead of a ; for parameter.
Works perfectly.
Thank you very much!