Hang after Delete Statement ODBC database layer Topic is solved

Talk here about issues with one of the components hosted at wxCode, or suggest features for it.
Post Reply
manteez
Experienced Solver
Experienced Solver
Posts: 58
Joined: Fri Dec 07, 2007 7:54 am

Hang after Delete Statement ODBC database layer

Post by manteez »

hello everybody,

I have a problem with databaselayer ODBC connecting to SQL Server. After a SQL DELETE statement execution, the application is hang. (the INSERT statement is okay)

Here is the snippet of codes (very simple SQL statement)

Code: Select all

wxString query = _("DELETE FROM employee WHERE name = ?");

PreparedStatement* statement = dbControl->PrepareStatement(query);
statement->SetParamString(1, employeeName);

statement->RunQuery();
dbLayer->CloseStatement(statement);
and my databaselayer object declaration

Code: Select all

dbLayer = NULL;
dbLayer = new OdbcDatabaseLayer();
((OdbcDatabaseLayer*)dbLayer)->Open("vman_dsn", wxEmptyString, wxEmptyString);
after the SQL execution, the application becomes hang.

it is really weird problem because I've tried this statement using mysql database layer and it works fine.

anybody has a same problem with me?


thanks for your help
vtararin
Knows some wx things
Knows some wx things
Posts: 37
Joined: Thu May 24, 2007 4:43 pm
Location: Ukraine
Contact:

Re: Hang after Delete Statement ODBC database layer

Post by vtararin »

Looks like it is not a DatabaseLayer problem. You have a lock in the database.

For figure it out you can turn on ODBC logging and check the log files .
Attachments
This is a screen where to turn on tracing.
This is a screen where to turn on tracing.
scrreen.png (13.4 KiB) Viewed 2114 times
cofounder of LogicLand Ltd.
my interest Kamenets-Podolskiy Online
manteez
Experienced Solver
Experienced Solver
Posts: 58
Joined: Fri Dec 07, 2007 7:54 am

Post by manteez »

how to unlock the database?

I used SQL SERVER EXPRESS 2005.

actually, I've almost figured out the problem. It was because of the compiler. When running on GCC, the query works well but not with Microsoft Compiler.

With Microsoft Compiler, the data was deleted but my application wasn't able to exit. I was able to turn it off via task manager.
It seemed that the query did loop continuously.

This problem is really strange because I also used mysql databaselayer compiled with microsoft compiler and works well.

Hope it can be solved soon...:(
manteez
Experienced Solver
Experienced Solver
Posts: 58
Joined: Fri Dec 07, 2007 7:54 am

Post by manteez »

I got the problem solved...

It is caused of replacing original OdbcPreparedStatement with this source in this thread http://forums.wxwidgets.org/viewtopic.php?t=19174

After replacing back to original file, the problem went away.

Thanks
Post Reply