Why doesn't a query return recently inserted data?
The issue reported to us is: "INSERT
statements seem to work OK and an immediate SELECT
with the same cursor displays the data, but when I retry the query, the data is gone."
Some ODBC-enabled languages have autocommit
set to off
by default. There are two ways to ensure that INSERT
statements are committed:
- Turn on the relevant
autocommit
flag in your connection. - Use appropriate
commit
androllback
methods in your script.
Refer to the following resources for detailed information on how to do this:
- Python
- mxODBC
- pyodbc
- perldoc DBI or Perl
- PHP