Creating Database from App using Zeos

Forum related to PostgreSQL

Moderators: gto, cipto_kh, EgonHugeist, olehs

Post Reply
sandeep_c24
Expert Boarder
Expert Boarder
Posts: 158
Joined: 06.11.2005, 01:43

Creating Database from App using Zeos

Post 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
skaw
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: 03.12.2007, 18:27

Post 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
sandeep_c24
Expert Boarder
Expert Boarder
Posts: 158
Joined: 06.11.2005, 01:43

Post by sandeep_c24 »

Thanks skaw. That worked.

Regards

Sandeep
Post Reply