Wow. Eight months since my last post. It is now apparent the impact over that time of my 60-70 hour work week onsite at a mine expansion.
This post summarises the result of discussion on the pharo-project mailling list where I sought assistance getting ODBC working on Pharo 1.3. Credit goes to Mariano Peck and Eliot Mirranda for assistance troubleshooting, providing a slightly older configuration that worked, and then the latest VM build. I am happy to report that ODBC appears to be working with the Pharo 1.3 image on MS Windows 7 using CogVM version 2522.
The purpose of this is that I have a UML design an application has stored in a Microsoft Access database. I want to use Pharo to implement that design directly into Smalltalk classes since I could not find a common export/import format. ConfigurationOfODBC looked promising so I followed instructions at http://www.pharocasts.com/2010/12/access-database-through-odbc.html, except that rather than using SQLLite I started with a blank Microsoft Access database. This worked well on Pharo 1.2.1 but not out of the box Pharo 1.3.
Here is the method to get ODBC working and tested with Pharo 1.3.
1. With this TestMDB.mdb in a local folder, set up the ODBC data source using
Start > Control Panel > Administrative Tools > Data Sources (ODBC)
Clicked <Add…> and choose the Microsoft Access Driver
and <Select…> the TestMDB.mdb file configured as Data Source Name “TestMDB”
2. Unzip Pharo-1.3-13315-OneClick.zip and then delete all files from
folder “Pharo-1.3-13315-OneClick.app”, leaving just the Contents folder.
3. Extract the files from VM.r2522/cogwin.zip into folder “Pharo-1.3-13315-OneClick.app”
4. Copy the “ImageFile=Contents\Resources\pharo.image” line from the old pharo.ini into Croquet.ini and then run Croquet.exe.
5. Load the ODBC package from within Pharo. I had some trouble accessing Squeaksource, but I found success using a mirror (you might skip the first two lines…)
Gofer new url: ‘http://dsal.cl/squeaksource/MonticelloRedirect’; package: ‘MontiRedirect’; load.
MRManager redirectFrom: ‘http://www.squeaksource.com/’ to: ‘http://dsal.cl/squeaksource/’.
package: ‘ConfigurationOfODBC’; load.
(Smalltalk at: #ConfigurationOfODBC) load.
6. And then finally, the successful test of ODBC…
connection := ODBCConnection dsn: ‘TestMDB’ user: ” password: ”.
table := (connection query: ‘select * from user;’) execute asTable.
Thats all. Now time to explore that UML design….
Here are some links to the full discussion and a backup cache of the files
Update 24 Dec 2011…
7. Just recording an example for the next part of actually processing the database. Following on from the previous step…
( row := table first ) inspect.
( name := row at: #name ) inspect.
( age := row at: #age ) inspect.
( allNames := table collect: [:each | each at: #name] ) inspect.
To go with the above example I have also uploaded a new file TestMDB – 2011-12-24.zip with a few additional rows of data.