![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello, I came across this very strange behaviour on Sybase 12.5, ODBC drivers 4.10. Say you have an active statement, if you start/commit a transaction, the active statement will stop working. Consider the following: rec = open_rec("SELECT * FROM a_table") While Not rec.EOF Call BeginTran 'Nothing here Call CommitTran Call rec.MoveNext End While The call to rec.MoveNext *will* crash with "odbc call failed" |
#3
| |||
| |||
|
|
On Thu, 05 Aug 2004 21:47:31 -0700, TomTom wrote: Hello, I came across this very strange behaviour on Sybase 12.5, ODBC drivers 4.10. Say you have an active statement, if you start/commit a transaction, the active statement will stop working. Consider the following: rec = open_rec("SELECT * FROM a_table") While Not rec.EOF Call BeginTran 'Nothing here Call CommitTran Call rec.MoveNext End While The call to rec.MoveNext *will* crash with "odbc call failed" I don't know ODBC, or VB (assuming that's the language you use). However - why would you want to start a transaction in a loop where you fetch rows from the server? If the idea is to use a different connection to make changes to the database using data from the original SELECT then you should probably try to explicitly use a different connection, as Sybase doesn't support multiple command streams on the same connection (*except* when using client-side cursors) Michael |
#4
| |||
| |||
|
|
Thanks for your answer Michael, So I understand now I should use a separate connection... But why I do not get is why the previous excerpt does not work while this one poses no problem: rec = open_rec("SELECT * FROM a_table") While Not rec.EOF Call db.Execute("UPDATE another_table SET a_column = a_value") Call rec.MoveNext End While Any clue? Regards, Serge Michael Peppler <mpeppler (AT) peppler (DOT) org> wrote On Thu, 05 Aug 2004 21:47:31 -0700, TomTom wrote: Hello, I came across this very strange behaviour on Sybase 12.5, ODBC drivers 4.10. Say you have an active statement, if you start/commit a transaction, the active statement will stop working. Consider the following: rec = open_rec("SELECT * FROM a_table") While Not rec.EOF Call BeginTran 'Nothing here Call CommitTran Call rec.MoveNext End While The call to rec.MoveNext *will* crash with "odbc call failed" I don't know ODBC, or VB (assuming that's the language you use). However - why would you want to start a transaction in a loop where you fetch rows from the server? If the idea is to use a different connection to make changes to the database using data from the original SELECT then you should probably try to explicitly use a different connection, as Sybase doesn't support multiple command streams on the same connection (*except* when using client-side cursors) Michael |
![]() |
| Thread Tools | |
| Display Modes | |
| |