[Lazarus] TPQConnection.CreateDB: ENCODING, OWNER, TEMPLATE, LC_CTYPE, TABLESPACE

silvioprog silvioprog at gmail.com
Tue Oct 28 02:03:56 CET 2014


On Wed, Oct 8, 2014 at 12:44 PM, Michael Van Canneyt <michael at freepascal.org
> wrote:
>
> On Wed, 8 Oct 2014, silvioprog wrote
>
>> Hello,
>>
>> I need to create a PostgreSQL database from my application. The
>> TPQConnection.CreateDB works fine, but I need to configure some properties
>> of my
>> database in your creation.
>>
>> In pgAdmin, I execute:
>>
>> CREATE DATABASE myuser
>>   WITH ENCODING='UTF8'
>>        OWNER=myowner
>>        TEMPLATE=template1
>>        LC_CTYPE='Portuguese_Brazil.1252'
>>        CONNECTION LIMIT=-1
>>        TABLESPACE=pg_default;
>>
>> But, how to create a database with TPQConnection passing the ENCODING,
>> OWNER, TEMPLATE, LC_CTYPE and TABLESPACE properties?
>>
>
> Try setting them as 'Name=Value' pairs in the Params property of the
> connection component.
>
> Michael.


Hello buddy, sorry for my long delay.

Thanks for the great tip, I tried it too, but unfortunately the postgre
rejected that talking something like "unrecognized param for this
operation".

Today I fixed that using a "mix of codes": creating the database using the
original postgre driver for Java, and calling "java -jar create_mydb
<params>" via TProcess. Now it worked like a charm!

Thank a lot!

-- 
Silvio Clécio
My public projects - github.com/silvioprog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20141027/3144c179/attachment-0003.html>


More information about the Lazarus mailing list