« Previous  |  Next »

MySQL with Pharo

13 November 2019

I needed connectivity to MySQL (really MariaDB). Here's what I found.

On Squeaksource, following projects were registered in 2011:

DBXTalk adapted the above into the DBXTalk MysqlDriver, to work with the DBXTalk API.

Then Garage incorporated above as Garage-Mysql.

To connect to MySQL using Pharo 7, the Garage driver is the best bet.

Metacello new
    baseline: 'Garage';
    repository: 'github://pharo-rdbms/garage';
    load: 'Garage-Mysql'.

Here's a simple test with a MariaDB 10 database:

| drv |
drv := GADriver fromConnectionString: (GAConnectionString fromString: 'mysql://localhost:3306/mysql?user=root&password=toor').
drv connect.
[ (drv execute: 'show databases') inspect ] ensure: [ drv close ]

Assuming no connectivity problem, an Inspector pops up with a GAMysqlResultSet.

Blog comments powered by Disqus