Xojo Conferences

ODBCDatabase crashing (Real Studio network user group Mailinglist archive)

Back to the thread list
Previous thread: Format, Double, Str, CDbl and data exchange
Next thread: Graphics Class in a Service App

FW: Special Valentine's Offer for Valentina - Beat the Price Increase!   -   Lynn Fredricks
  ODBCDatabase crashing   -   E.Tejkowski

ODBCDatabase crashing
Date: 29.11.07 23:11 (Thu, 29 Nov 2007 16:11:58 -0600)
From: E.Tejkowski
I'm working on a large RB database project which was previously
working correctly in RB5.5.5 on Mac OX 10.4.8 PPC and Intel. With
the upgrade to OS 10.4.9 we could no longer connect to the database
and upgraded to RB2007. We are talking to our Sybase iAnywhere 9.02
database via ODBC with the latest Actual Tech driver. We also
installed a Sybase fix for 10.0.8+. We can now connect to the
database but are experiencing a major crashing problem when creating
recordsets in succession that we've narrowed down somewhat. The first
couple of times the recordset will return the accurate number of
records and the Move functions work correctly. Intermittently, a
subsequent recordset incorrectly returns only one record and the
first MoveNext positions at EOF. Immediately afterwards we receive
an Unexpected Error crash. We've built a small test project that
repeats the problem. I'm wondering if anyone else has experience with
this issue, and if so, if there is any sort of workaround for this?
Below are snippets that show the code we're using when we experience
this crash. It crashes more readily on Intel over PPC for some
reason. Is there a bug in the ODBC plugin?

Intel Mac, Tiger

SNIPPET 1: The db checks out as not nil and the connection is
db = New ODBCDatabase
db.DataSource =
"dsn=somedsn;UID=someuser;PWD=somepwd;LINKS=ShMem,tcpip;DBN=" + dbName

if db<>nil then
MsgBox "db<>nil"
If db.Connect() then
msgbox "connection is successful"
msgbox "connection failed"
end if
MsgBox "db=nil"
end if

SNIPPET 2: We run this function for hundreds of iterations to stress
test the code. This is where we crash. We can sometimes loop maybe
thirty times before it crashes on Intel. Sometimes we simply get one
record returned (when we should be getting far more).
Dim rs as RecordSet

If EmptyRS("SELECT Title,ArtistDisplay FROM Works" ) then
MSgBox "No RecordSet"
rs = db.SQLSelect("SELECT Title,ArtistDisplay FROM Works" )
Do Until rs.EOF
Window1.ListBox1.AddRow rs.Field("Title").StringValue
Window1.ListBox1.cell(Window1.ListBox1.LastIndex,1) = rs.Field
End if

SNIPPET 3: This function returns true. Helper function for SNIPPET 2
Function EmptyRS(sql as String) As Boolean
Dim rs as RecordSet

rs = db.SQLSelect(sql)
If rs = Nil Then
Return True
ElseIf rs.FieldCount = 0 then
Return true
Return False
End If
End Function


PID: 12740
Thread: 0

Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x00000000

Thread 0 Crashed:
0 libSystem.B.dylib 0x900031c8 strlen + 8
1 libSystem.B.dylib 0x901302e8 _simple_vdprintf + 3688
2 libSystem.B.dylib 0x90130b28 _simple_dprintf + 52
3 libSystem.B.dylib 0x9012b79c malloc_printf + 132
4 libSystem.B.dylib 0x90006ee8 szone_free + 1628
5 libtdsodbc-ppc.dylib 0x065aacc4 tds_dstr_free + 52
6 libtdsodbc-ppc.dylib 0x065874a0 desc_alloc_records + 408
7 libtdsodbc-ppc.dylib 0x06587508 desc_free_records + 72
8 libtdsodbc-ppc.dylib 0x06587714 desc_free + 28
9 libtdsodbc-ppc.dylib 0x06582c40 SQLFreeEnv + 488
10 libtdsodbc-ppc.dylib 0x06582c9c SQLFreeStmt + 20
11 atsqlsrv.so 0x0654d064 SQLFreeHandle + 472
12 atsqlsrv.so 0x0654cf00 SQLFreeHandle + 116
13 org.iodbc.core 0x00fb4150 SQLFreeStmt_Internal
+ 304
14 org.iodbc.core 0x00fb42fc SQLFreeStmt + 260
15 ODBC Plugin 2007.rbx_0.dylib 0x00f6ae3c ODBCCloseCursor
(dbCursor*) + 40 (odbcDatabase.cpp:2020)
16 rbframework.dylib 0x018e8a80 cursorClose + 116
17 0x00042798 DatabaseCursor.Close%%
o<DatabaseCursor> + 56
18 0x007e16fc DataCtl.EmptyRS%b%s + 1136
19 0x0027d798
o<frmMainToolbar.frmMainToolbar> + 1328
20 0x0067fdd4
o<mdiArtsystems.mdiArtsystems> + 5068
Unsubscribe or switch delivery mode:

Search the archives: