EPgError permission denied to create database

Discussion of open issues, suggestions and bugs regarding PgDAC (PostgreSQL Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Posts: 32
Joined: Thu 10 Jan 2013 23:13

EPgError permission denied to create database

Post by piopio1 » Sat 13 Dec 2014 18:52

Hello there,

I can create DBs on my local PG with the following code:

Code: Select all

function TDMDBConnection.CreateNewDB(aNewDBName: string): Boolean;
  PgConnection1.ExecSQL('CREATE DATABASE '+aNewDBName+';');
but the same code doesn't work if the DB is remote and I connect via SSH tunnel. What I get is "EPgError permission denied to create database"
I can confirm I can create remote DB via pgAdmin III and Putty via SSH tunnel.
I suppose the issue is one or more properties I have to set for one or more of these three components:

Code: Select all

  object PgConnection1: TPgConnection
    Username = 'xxxxxxx'
    Server = 'localhost'
    LoginPrompt = False
    Database = 'xxxxxxx'
    Port = 5440
    Options.UseUnicode = True
    Left = 232
    Top = 8
    EncryptedPassword = 'xxxxxxx'
  object ScSSHClient1: TScSSHClient
    HostKeyAlgorithms = <
        Algorithm = aaRSA
        Algorithm = aaDSA
    HostName = 'xxxxxxx'
    Port = 7822
    User = 'xxxxxxx'
    Password = 'xxxxxxx'
    Timeout = 10
    KeyStorage = ScFileStorage1
    OnServerKeyValidate = ScSSHClient1ServerKeyValidate
    Left = 136
    Top = 85
  object ScFileStorage1: TScFileStorage
    Password = 'xxxxxxx'
    Left = 208
    Top = 77
  object ScSSHChannel1: TScSSHChannel
    Client = ScSSHClient1
    SourcePort = 5440
    DestHost = 'xxxxxxx'
    DestPort = 5432
    Timeout = 10
    Left = 296
    Top = 77
Do you know what the issue may be ?

Many thanks

Pio Pio

Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: EPgError permission denied to create database

Post by azyk » Fri 19 Dec 2014 12:06

We tried to reproduce the error 'permission denied to create database', according to your recommendations, but the problem wasn't reproduced. Please make sure that when connecting to the server using pgAdmin and PgDAC, you use the same credentials and connect to the same database.

Post Reply