Page 1 of 1

Hang after Delete Statement ODBC database layer

Posted: Thu Jan 15, 2009 7:47 am
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);

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

Re: Hang after Delete Statement ODBC database layer

Posted: Thu Jan 15, 2009 8:42 am
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 .

Posted: Wed Jan 21, 2009 4:06 am
by manteez
how to unlock the database?


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...:(

Posted: Thu Jan 22, 2009 4:03 am
by manteez
I got the problem solved...

It is caused of replacing original OdbcPreparedStatement with this source in this thread

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