comp.lang.ada
 help / color / mirror / Atom feed
* Again CONSTRAINT_ERROR
@ 2017-12-01  7:13 Distant Worlds
  2017-12-01  7:35 ` briot.emmanuel
  0 siblings, 1 reply; 2+ messages in thread
From: Distant Worlds @ 2017-12-01  7:13 UTC (permalink / raw)


Сode from example: 

with gnatcoll.SQL.Postgres;  
with gnatcoll.SQL.Exec;      
with Ada.Text_IO;            
 
procedure Main is
   DB_Descr : GNATCOLL.SQL.Exec.Database_Description;
   DB       : GNATCOLL.SQL.Exec.Database_Connection;
   IsOpen   : Boolean;
begin
   DB_Descr := GNATCOLL.SQL.Postgres.Setup(Database => "postgres",
                     User => "postgres",
                     Host => "localhost",
                     Password => "12345678",
                     Port => 5432
                    );
   DB := DB_Descr.Build_Connection;
 
   IsOpen := DB.Check_Connection;
   if IsOpen then
      Ada.Text_IO.Put_Line("Connection is open.");
   else
      Ada.Text_IO.Put_Line("Last Db error = " & DB.Error);
   end if;
 
   -- reset state of connection for reuse
   GNATCOLL.SQL.Exec.Reset_Connection(DB);
 
   GNATCOLL.SQL.Exec.Free (DB);
   GNATCOLL.SQL.Exec.Free (DB_Descr);
 
end Main;

It is compiled!

At runtime: raised CONSTRAINT_ERROR : main.adb:16 access check failed

What's wrong here?

Thanks!

P.S. Linux x64(Centos 7) GNAT GPS 2017

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Again CONSTRAINT_ERROR
  2017-12-01  7:13 Again CONSTRAINT_ERROR Distant Worlds
@ 2017-12-01  7:35 ` briot.emmanuel
  0 siblings, 0 replies; 2+ messages in thread
From: briot.emmanuel @ 2017-12-01  7:35 UTC (permalink / raw)


> At runtime: raised CONSTRAINT_ERROR : main.adb:16 access check failed
> 
> What's wrong here?


Your GNATCOLL was not compiled with support for postgres (that's the case of
the default GNATCOLL install that comes along with GNAT). You'll need to
recompile locally first.

Emmanuel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-12-01  7:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-01  7:13 Again CONSTRAINT_ERROR Distant Worlds
2017-12-01  7:35 ` briot.emmanuel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox