Access violation with ExecSQL

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

Post Reply
belvasis
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 13.11.2006, 08:17

Access violation with ExecSQL

Post by belvasis »

Hi,

i use version 6.5.1 of zeos since five years now and had only little problems. Now i decided to upgrade to version 6.6 stable. I did it and now nothing works anymore :(
Until now is simply used the following in C++ to execute a statement:

TZQuery* pQuery = new TZQuery(Application);
pQuery->SQL->Add("UPDATE TABLE SET FIELD = 1 WHERE ID = 2");
pQuery->ExecSQL();
delete pQuery;

Simple and it works with 6.5.1 as expected. Now i get an access violation everytime ExecSQL is called.
Has anyone an idea why this happens?

Thanks and regards
Wild_Pointer
Expert Boarder
Expert Boarder
Posts: 164
Joined: 18.03.2008, 13:03
Contact:

Post by Wild_Pointer »

Hello belvasis,

I'm not that good familiar with zeos versions before 6.6.X, but should you not assign connection object to pQuery before executing it? How does zeos components know what database you are referring to?
belvasis
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 13.11.2006, 08:17

Yes....

Post by belvasis »

...you are right, of course. I set the connection in code but missed it here in the code fragment of my post . And the connection object ist valid and connected. I switched back to version 6.5.1 now and all works as expected, without changing any code.

The correct code is:

TZQuery* pQuery = new TZQuery(Application);
pQuery->Connection = pConnection;
pQuery->SQL->Add("UPDATE TABLE SET FIELD = 1 WHERE ID = 2");
pQuery->ExecSQL();
delete pQuery;
Wild_Pointer
Expert Boarder
Expert Boarder
Posts: 164
Joined: 18.03.2008, 13:03
Contact:

Post by Wild_Pointer »

belvasis,

please provide some information on what DB you are using. Also have you tried building test application with the source you have provided? Is the result the same as in your older applications?
belvasis
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 13.11.2006, 08:17

Post by belvasis »

I tried it with an SQLServer 2008 Database. I have no separate test application because this is a really simple use case. After the programm starts, it writes a simple status information to a specific table. This is where the error occurs.
Wild_Pointer
Expert Boarder
Expert Boarder
Posts: 164
Joined: 18.03.2008, 13:03
Contact:

Post by Wild_Pointer »

Hello, belvasis,

as zeos does not support protocol to SQLServer you must be using ADO protocol. I have tested on ado protocol and PostgreSql server, and it seems to be ok. On the other hand I'm using Zeos 7 on Delphi. Maybe the error was fixed in v7?... Would you like to try Zeos 7 for your application? I know it is not stable, but we use it in our products with no problems.

Good luck!
belvasis
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 13.11.2006, 08:17

Post by belvasis »

Hm...that's something i don't understand. In Version 6.5.1 there was an protocol "mssql" and there is a driver MSSqlServer7 in the zeos source. Was this protcol removed? ADO is something i don't want to use. So i think i have to use the older version with c++. The funny thing is, that i upgraded my delphi client app also to version 6.6 and there it works without any problem.
Wild_Pointer
Expert Boarder
Expert Boarder
Posts: 164
Joined: 18.03.2008, 13:03
Contact:

Post by Wild_Pointer »

belvasis,

oh sorry. It's totally my fault... Somehow I managed to miss the mssql as I was looking for sqlserver :). I don't have SQL server to play with now, but maybe I will try to find and test zeos 7 with mssql protocol at work.
Post Reply