Page 1 of 1

EPgError permission denied to create database

Posted: Sat 13 Dec 2014 18:52
by piopio1
Hello there,

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

Code: Select all

function TDMDBConnection.CreateNewDB(aNewDBName: string): Boolean;
begin
  PgConnection1.ExecSQL('CREATE DATABASE '+aNewDBName+';');
end;
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'
  end
  object ScSSHClient1: TScSSHClient
    HostKeyAlgorithms = <
      item
        Algorithm = aaRSA
      end
      item
        Algorithm = aaDSA
      end>
    HostName = 'xxxxxxx'
    Port = 7822
    User = 'xxxxxxx'
    Password = 'xxxxxxx'
    Timeout = 10
    KeyStorage = ScFileStorage1
    OnServerKeyValidate = ScSSHClient1ServerKeyValidate
    Left = 136
    Top = 85
  end
  object ScFileStorage1: TScFileStorage
    Password = 'xxxxxxx'
    Left = 208
    Top = 77
  end
  object ScSSHChannel1: TScSSHChannel
    Client = ScSSHClient1
    SourcePort = 5440
    DestHost = 'xxxxxxx'
    DestPort = 5432
    Timeout = 10
    Left = 296
    Top = 77
  end
Do you know what the issue may be ?

Many thanks

Pio Pio

Re: EPgError permission denied to create database

Posted: Fri 19 Dec 2014 12:06
by azyk
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.