MySQL-Driver Status: integrated into 2.0b!

Another useful thing (with a different scope than the gdbm-driver) would be a MySQL-driver. Here is a smalltalk MySQL-driver available at: It is reengineered from the c-source of the native MySQL-client lib, so it has no need for bindings.

I tried to work with the squeak version of the driver, but I needed too much code from squeak, so I decided to start from the original driver by Josh Miller. Here they are: (VisualWorks 3.0 Version) (VisualWorks 3.0 Version) (VisualWorks 3.0 Version)

Here is my first working version. Unpack it, then adjust the parameters in Then run it with

gst -Q


The hardest translation was done in JdmWriteStream (look below). The rest was relatively simple (Adjusting socket-methods, conversion from ByteStream to Integer, etc). An impressive example for smalltalk's power!

!JdmWriteStream methodsFor: 'accessing'!

setWritePosition: aPosition

"original code"

position _ (aPosition > writeLimit

ifTrue: [writeLimit]

ifFalse: [aPosition])! !"

"here's the trick involved:"

ptr := aPosition + 1! !

Here is a simple testscript:

| value resultSet statement spec connection |

FileStream fileIn: ''.

FileStream fileIn: ''.

spec := (Jdm JdmConnectionSpec new initialize

user: 'root'; password: ;

host: 'localhost';

database: 'mysql';

port: 3306).

connection := Jdm MySQL JdmConnection on: spec.

JdmStatement initialize.

statement := connection createStatement.

resultSet := (statement executeQuery: 'select * from db') value.

Transcript cr; show: (resultSet columns collect: [:col | col name]) printString

[resultSet next]



value := resultSet valueNamed: 'Db'. "get column named Db"

Transcript cr; show: value printString.


Transcript cr.

connection close.

ObjectMemory quit!

The hierarchy has been refactored with respect to the original driver by Josh. His initials now are the acronym for `Just a Database Manager', so the DBMS-independent classes have been moved to the `Jdm' namespace, while the MySQL driver proper resides in `Jdm MySQL'.

Markus Fritsche and Paolo Bonzini

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.