comp.lang.ada
 help / color / mirror / Atom feed
From: Jano <nono@celes.unizar.es>
Subject: GNADE insert problem
Date: Fri, 19 Dec 2003 17:40:45 +0100
Date: 2003-12-19T17:40:45+01:00	[thread overview]
Message-ID: <MPG.1a4d4871a4a0214a9897a2@News.CIS.DFN.DE> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2721 bytes --]

Hello, I'm using GNADE and esql to insert some records in a database. 
Please check the code at the end of this post for exact implementation. 
The database is MSAccess accessed using ODBC.

The thing is that the first record is correctly inserted (I can later 
see the record), but the second call to insert fails with

Line 79 in package Aenea.Db : *** Exception in query ****

SQL State : 42000 SQL Code :-1
---------------
[17:32:38.42] [E] Database insertion failed: Exception name: 
GNU.DB.SQLCLI.INVALID_CURSOR_STATE
Message: [Proc=SQLCloseCursor][Server=hyperion][State=24000][Microsoft]
[Controlador ODBC Microsoft Access]Estado del cursor no v�lido
Call stack traceback locations:
0x438ee3 0x439bf6 0x439ef1 0x43b7cd 0x48c8ef 0x6ba969 0x6d5962

As you can see, it seems as if some cursor were left open and tried to 
be reused. I've found just an example of insertion and I can see 
anything special there.

I don't know if I'm doing something wrong or it is the fault of MSAccess 
or esql. Any hints? This is my first look at GNADE and I'm somewhat 
lost.

Thanks,

Alex.

--------8<---------- Code begins here --
-- Init is called once, Insert_row is called periodically.

with Aenea.Net;
with Aenea.Trace;

with Sql_standard; use Sql_standard;

package body Aenea.Db is

   -- Database
   EXEC SQL DECLARE DB DATABASE;
   
------------------------------------------------------------------------
-- Init                                                               --
------------------------------------------------------------------------
   procedure Init is
   begin
      EXEC SQL WHENEVER SQLERROR RAISE DB_Error;
      
      -- Connect
      EXEC SQL 
      CONNECT BY DB 
              TO "hyperion";

      Trace.Log ("Connection with database successful.", 		
	Trace.Informative);
   end Init;

------------------------------------------------------------------------
-- Insert_row                                                         --   
------------------------------------------------------------------------
   procedure Insert_row is
      EXEC SQL BEGIN DECLARE SECTION;
      Hubs, Leaves : INT;
      EXEC SQL END   DECLARE SECTION;
   begin
      Hubs   := INT (Net.Counter.Avg_hubs);
      Leaves := INT (Net.Counter.Avg_leaves);
      
      EXEC SQL AT DB 
         insert into g2crawl (hubs, leaves, fecha)
         values (:Hubs, :Leaves, Now ());

      EXEC SQL AT DB COMMIT;

   exception
      when E : DB_Error =>
         Trace.Log ("Database insertion failed: " & Trace.Report (E),
            Trace.Error);
      when E : others =>
         Trace.Log ("Database insertion failed: " & Trace.Report (E),
            Trace.Error);
   end Insert_row;
   
end Aenea.Db;



             reply	other threads:[~2003-12-19 16:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-19 16:40 Jano [this message]
2003-12-20  1:55 ` GNADE insert problem Stephen Leake
2003-12-20  9:47   ` Jano
2003-12-20 18:35     ` Robert I. Eachus
2003-12-21  9:41       ` Jano
2003-12-21 10:37         ` Jano
2003-12-21 20:32           ` Robert I. Eachus
2003-12-31 12:12         ` Michael Erdmann
2003-12-31 15:42           ` Robert I. Eachus
2004-01-01  9:17             ` Michael Erdmann
replies disabled

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