[Newbies] FFI+ODBC Troubles

Victor Metelitsa vvm13ru at gmail.com
Mon Jun 1 04:53:33 UTC 2009

Please help me.
I am trying to switch from VisualWorks to Squeak but I can't connect to any
my DB2 and Oracle databases.

I am using this files:

At first I tried old ODBC code from
and got "Could not coerce arguments" at my win32 (XP and Windows 2003
Server) computers. I can't understand this because all seems right.
At SqueakDebug.log we can see

Error: Could not coerce arguments
28 May 2009 4:18:23 pm

VM: Win32 - a SmalltalkImage
Image: Squeak3.10.2 [latest update: #7179]

SecurityManager state:
Restricted: false
FileAccess: true
SocketAccess: true
Working Dir C:\squeak\1
Trusted Dir C:\squeak\1\vvm
Untrusted Dir C:\My Squeak\vvm

    Receiver: an ODBCLibrary
    Arguments and temporary variables:
        aString:     'Could not coerce arguments'
    Receiver's instance variables:
        handle:     @ 16r4BF70000
        name:     'odbc32'

    Receiver: an ODBCLibrary
    Arguments and temporary variables:
        errCode:     6
    Receiver's instance variables:
        handle:     @ 16r4BF70000
        name:     'odbc32'

    Receiver: an ODBCLibrary
    Arguments and temporary variables:
        statementHandle:     a SQLHSTMT
        columnNumber:     1
        targetType:     1
        targetValue:     an ExternalData
        bufferLength:     8192
        strLenght:     a SQLInteger
    Receiver's instance variables:
        handle:     @ 16r4BF70000
        name:     'odbc32'

    Receiver: an ODBCColumn DUMMY (VarChar 1 nullable)
    Arguments and temporary variables:

sqlBindCol: statementHandle columnNumber: columnNumber targetType:
targetType targetValue: targetValue bufferLength: bufferLength strLength:
 SQLHSTMT StatementHandle,
 SQLPOINTER TargetValue,
 SQLINTEGER BufferLength,
 SQLINTEGER *StrLen_or_Ind);"
 <cdecl: short 'SQLBindCol' (SQLHSTMT ulong short void* long SQLInteger*)>
 ^ self externalCallFailed

I think all types are correct.

Also at Windows 2003 x64 I receive "Error:[Microsoft][ODBC Driver Manager]
Data source name not found and no default driver specified [State:IM002]"
for any datasource.

After that I am trying ODBC code from

| con rs |
con _ ODBCConnection dsn:'somedsn' user:'somename' password:'somepwd'.
rs := con resultSetFor: 'SELECT ''xxx'' manana FROM dual'.
(con query: 'SELECT ''xxx'' manana FROM dual') results do:[:row | Transcript
show: row; cr].
con close.

squeak image crashes somewhere near calling of "con resultSetFor:". No
SqueakDebug.log generated in this case.  Crash.dmp contains:
Mon Jun 01 10:37:54 2009

Exception code: C0000005
Exception addr: 0040BD85
Access violation (read access) at 91233BDA
EAX:91233BDA    EBX:96A4E35C    ECX:00000003    EDX:96A4E35F
ESI:11233B78    EDI:91233BDB    EBP:0000138C    ESP:0006F998
EIP:0040BD85    EFL:00010286
FP Control: FFFF027F
FP Status:  FFFF5061

Hardware information:
    Manufacturer: Unknown
    Model: Unknown
    Number of processors: 1
    Page size: 4096

Memory Information (upon launch):
    Physical Memory Size: 2097151 kbytes
    Physical Memory Free: 1681472 kbytes
    Page File Size: 4194303 kbytes
    Page File Free: 4194303 kbytes
    Virtual Memory Size: 2097151 kbytes
    Virtual Memory Free: 2064020 kbytes
    Memory Load: 40 percent

Processor 0: AMD Athlon(tm) 64 Processor 3400+
    Identifier: x86 Family 15 Model 12 Stepping 0
    ~MHZ: 2411

Operating System: Microsoft Windows Server 2003 (Build 3790 Service Pack 1)
    Registered Owner: unnamed user
    Registered Company: unknown organization
    SP major version: 1
    SP minor version: 0
    Suite mask: 110
    Product type: 3

Display Information:
    Graphics adapter name: NVIDIA GeForce4 Ti 4200
    Primary monitor resolution: 1024 x 768

Device: NVIDIA GeForce4 Ti 4200
    Adapter String: GeForce4 Ti 4200
    Bios String: Version
    Chip Type: GeForce4 Ti 4200
    DAC Type: Integrated RAMDAC
    Memory Size: 0x04000000

Driver Versions:

VM Version: Squeak 3.10.6 (release) from Aug 30 2007
Compiler: gcc 2.95.2 19991024 (release)

Current byte code: 200
Primitive index: 264

Loaded plugins:
    SqueakFFIPrims 1 February 2007 (e)
    LargeIntegers v1.5 1 February 2007 (i)
    Matrix2x3Plugin 1 February 2007 (i)
    FloatArrayPlugin 1 February 2007 (i)
    BitBltPlugin 1 February 2007 (i)
    B2DPlugin 1 February 2007 (i)
    SecurityPlugin 1 February 2007 (i)
    FilePlugin 1 February 2007 (i)
    MiscPrimitivePlugin 1 February 2007 (i)

Stack dump:

(Sorry for my English)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20090601/9b5e71bc/attachment.htm

More information about the Beginners mailing list