Skip to content

PostgreSQL SSL Connection


Your Xojo apps can connect to many different databases, including PostgreSQL, MySQL, Oracle, Microsoft SQL Server and ODBC. Learn more about connecting to different database servers here.

We get all sorts of questions about connecting your apps to specific databases. Recently, a developer  asked about connecting his app to the PostgreSQL database using SSL for a secure connection. In Xojo this is simple.

Here’s some example code on how to make that connection:

Dim db As New PostgreSQLDatabase
db.Host = ""
db.SSLMode = PostgreSQLDatabase.SSLAllow
db.Port = 5432
db.DatabaseName = "BaseballLeague"
db.UserName = "broberts"
db.Password = "streborb"
If db.Connect Then
  // Use the database
End If

You can also use the SSLKey property to use a secret key and the SSLCertificate property to specify the SSL Certificate.

To learn more about this, check out the Xojo PostgreSQL documentation page for more details.