From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Property (As Integer )
aPostgreSQLDatabase.SSLMode = newIntegerValue
IntegerValue = aPostgreSQLDatabase.SSLMode

Supported for all project types and targets.

Specifies the type of SSL connection to use to connect to the database server. Use the constant values SSLDisable, SSLAllow, SSLPrefer, SSLRequire, SSLVerifyCA and SSLVerifyFull.


These PostgreSQL constants are used to specify SSLMode:

  • SSLDisable (default): Only try a non-SSL connection
  • SSLAllow: First try a non-SSL connection; if that fails, try an SSL connection
  • SSLPrefer: First try an SSL connection; if that fails, try a non-SSL connection
  • SSLRequire: Only try an SSL connection. If a root CA file is present, verify the certificate in the same way as if verify-ca was specified
  • SSLVerifyCA: Only try an SSL connection, and verify that the server certificate is issued by a trusted CA
  • SSLVerifyFull: Only try an SSL connection, verify that the server certificate is issued by a trusted CA and that the server hostname matches that in the certificate

For more information about SSL usage with PostgreSQL, refer to Secure TCP/IP Connections with SSL.


This example specifies that the connection should try to use SSL:

Var db As New PostgreSQLDatabase
db.Host = ""
db.SSLMode = PostgreSQLDatabase.SSLAllow
db.Port = 5432
db.DatabaseName = "BaseballLeague"
db.UserName = "broberts"
db.Password = "streborb"
// Use the database
Catch error As DatabaseException
MessageBox("Connection failed. Error: " + error.Message)
End Try

See Also

PostgreSQLDatabase.SSLCertificate, PostgreSQLDatabase.SSLKey