Environment
A Database
Before you can use GLORP you need to have a relational database to work with. This tutorial does not cover installing and running a relational database. You also need to have the drivers for that database loaded in the Smalltalk image.
Loading GLORP
To use GLORP with ODBC, use the VA ST Feature Loader to load the 'ST: Database, ODBC Glorp' and 'ST: Database, ODBC Glorp Testing'. To use GLORP with DB2, use the VA ST Feature Loader to load the 'ST: Database, DB2 Glorp' and 'ST: Database, DB2 Glorp Testing'. The latter contains many unit tests that are useful in learning about GLORP features. The examples in this tutorial are slight variations on examples found in the unit tests.
Running GLORP Unit Tests
Before you can run the GLORP unit tests you need to configure them to use your database. To do this you need to edit the correct class method in the class GlorpDatabaseLoginResource, which is in the GlorpDBTests application. The accessing protocol of the class methods in GlorpDatabaseLoginResource contains methods for default logins for different databases. Find the correct one for your database edit it with the correct database information. For this tutorial was tested using an Oracle database on the same machine as the GLORP tutorial, so ‘GlorpDatabaseLoginResource class>>#defaultOracleODBCLogin’ was edited as below. Once the method contains the correct username, password and connection data execute the comment in the method assigning DefaultLogin. Now you are ready to run the GLORP unit tests. The tests are regular SUnit tests, and SUnit was loaded when the tests were loaded. Open the SUnit window from the ‘Tools’ menu of the Transcript to run them. There are over 300 tests so it will take a while to run them all.
GlorpDatabaseLoginResource class>>defaultOracleODBCLogin
"
To set the default database login to Oracle, execute the following statement.
DefaultLogin := self defaultOracleODBCLogin.
"
^(Login new)
database: OracleODBCPlatform new;
username: 'taylor';
password: 'aSecret';
connectString: 'orcl'
Last modified date: 01/29/2015