Page 1 of 1

Creating Database from App using Zeos

Posted: 01.12.2007, 08:18
by sandeep_c24
Is it possible to create a new Postgres database from my app using Zeos? If it is possible could someone give an example.

Regards

Sandeep

Posted: 03.12.2007, 18:31
by skaw
Something like this...


auxZSQLProcessor := TZSQLProcessor.Create(Connection);
auxZSQLProcessor.Connection := Connection;
auxZSQLProcessor.Script.Text := 'CREATE DATABASE dbname WITH TEMPLATE = template0 ENCODING = ''UTF8'';';
auxZSQLProcessor.Execute;

First of all you must create a connection with the default postgres database.

Best regards
skaw

Posted: 04.12.2007, 07:01
by sandeep_c24
Thanks skaw. That worked.

Regards

Sandeep