public static Dialect Dialects = EnvironmentVariable("ORMLITE_DIALECT", Dialect.Sqlite);
public static Dialect Dialects = EnvironmentVariable("ORMLITE_DIALECT", Dialect.AnyPostgreSql);
If you cannot connect and getting a connection refused or server timed out error (No connection could be made because the target machine actively refused it), please note that the connection string in the App.config gets overwritten.
Most notably the Port is overridden (if you use the same user/password).
To combat this (b/c I"m using ReSharper GUI) and as a quick fix (e.g. stupid, don’t commit this)…
In ServiceStack.OrmLite\OrmLiteConnectionFactory.cs in method CreateDbConnection() add the following line.
this.ConnectionString = this.ConnectionString.Replace("Port=48301", "Port=5432");
this.ConnectionString = this.ConnectionString.Replace("Port=48302", "Port=5432");
this.ConnectionString = this.ConnectionString.Replace("Port=48303", "Port=5432");
// Note: Port 5432 is the default PostgreSql port.
If you now get a permission denied for user test then
-- using a superuser account
-- assumes db test is already created
GRANT ALL PRIVILEGES ON DATABASE test TO test;
Basically you need to specify which RDBMS dialect you want to run by setting:
Generally the only external setup I can recall is needing to create a Schema called “Schema” for RDBMS’s that support schemas, otherwise you just need to modify TestConfig above to specify which RDBMS + version you want to use.
If you pull the latest from OrmLite you will be able to run just your single version of PostgreSQL, e.g: