Recent

Author Topic: Problem with ODBC + Informix 11. Exceptions takes 2 minutes paused.  (Read 2021 times)

derles

  • New Member
  • *
  • Posts: 35
Hello.
I have Lazarus 1.0.10 + FPC 2.6.2 on win32.
Also, Informix 11 Developer.

Database:
* Base

Table:
* Places
    . ID int   (PK)
    . sDesc char(80)

Controls:
* TODBCConnection
   . Name: Conn1
   . FileDSC: c:\App\Inf01.dsn
   . User & Password setted ok.
   . Transaction: Trans1

* TSQLTransaction
   . Name: Trans1
   . Database: Conn1

* TSQLScript (to insert some new registers)
   . Name: sqlSC
   . Database: Conn1
   . Transaction: Trans1
   . Script: My insert sentence

I have a function with this code section to execute my insert sentence:

try
    Trans1.StartTransaction;
    sqlSC.Execute;
    Trans1.Commit;
    ShowMessage('Inserted OK');
except
    on E:Exception do
    begin
        Trans1.Rollback;
        ShowMessage('Error:'#13#10#10+E.Message);
end;


My insert sentence is very simple, like this:

*  INSERT INTO Places (ID, sDesc) values (3,'Place 1');

Ok. When I insert a new row whithout a problem (whithout syntax errors, with no PK conflicts, etc, it work just fine.
But if I make a syntax error, or when y try to insert a duplicated ID, the program freezes for 2 minutes waiting for the exception. In 2 minutes an EODBCException is thrown.

Also, sometimes I make an INSERT with ID conflict just to try, and no exception is thrown as if the sentence INSERT would work ok. But actually no insert occurs, of course.

Any clue ??

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Problem with ODBC + Informix 11. Exceptions takes 2 minutes paused.
« Reply #1 on: July 09, 2013, 02:39:35 pm »
(Note: have never used Informix)

Why use sqlscript? You could use
http://www.freepascal.org/docs-html/fcl/sqldb/tsqlconnection.executedirect.html
or an sqlquery, setting the .SQL.Text property and running .Execute.

SQLScript is meant for running batched/multiple statements from e.g. a file. I don't know if you're using it correctly here, you could look it up in the sqldb documentation.

Perhaps there is some sort of timeout that needs to be configured server side or on the ODBC connector?
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

derles

  • New Member
  • *
  • Posts: 35
Re: Problem with ODBC + Informix 11. Exceptions takes 2 minutes paused.
« Reply #2 on: July 09, 2013, 04:40:37 pm »
Thanks.

I tried with ODBCConnection.ExecuteDirect, with the same result. Anyway, is a better choice that I didn't know. I'm new in Lazarus and ODBC. I always previously worked with Delphi and ADO.

As you said, perhaps there is some sort of timeout server side or on the ODBC connector.

On Informix server, I tried some on the onconfig file, but nothing went better. Sadly I don't have many documentation about it.

On ODBC connectos I can't find any property or parameter about timeouts.

I'll keep looking.


 

TinyPortal © 2005-2018