AlphaDAO - Connection Strings - PostgreSQL - Specifying the Default Schema


When working with a PostgreSQL database that contains multiple schemas, you can specify the default schema in the connection string. Unfortunately, at this point, the connection string dialog does not let you specify the default schema, but you can easily edit the generated schema to add the necessary directive to set the schema.

For example:

{A5API='PostgreSQL',A5Syntax='PostgreSQL', A5UseServerSidePrepare=Y,A5InitialCommand='SET SCHEMA''TestSchema''', Database='Alphasports', Password='alpha',Port='5432',Server='localhost',UserName='postgres'}

In this example, the following directive has been added to the connection string:

A5InitialCommand='SET SCHEMA ''TestSchema'''

Notice that the entire argument to the A5SetInitialCommand is enclosed in single quotes. Therefore the schema name, which must also be enclosed in single quotes uses escaped single quotes (a double single quote).