Today's Smalltalk 4 You starts making use of Glorp against Oracle with a simple query - about as simple a query as you can make, as it happens. If you have trouble viewing it here in the browser, you can also navigate directly to YouTube. To watch now, click on the image below:
You can also watch it on YouTube:
Today we'll get started with using Glorp in VA Smalltalk with Oracle. We've already set up basic connectivity; today we'll have a look at one of the classes (DatabaseAccessor) that you'll end up using in VA Smalltalk.
To start doing queries, you need to login and get things set up:
"login" login := Login new. database: OracleODBCPlatform new; username: username; password: password; connectString: 'orcl11g'; yourself. "login and logout" accessor := DatabaseAccessor forLogin: login.
Next, use the basic API, #basicExecuteSQLString:
"simple query using basic database facilities" result := accessor basicExecuteSQLString: 'select 1 + 1 from dual'. result next first.
That uses basic Oracle facilities to do the simple math problem. The more important thing from our perspective is the API: #basicExecuteSQLString:. We'll be using this, and other facilities of DatabaseAccessor over the next few screencasts. Once you execute and inspect that, you should see this:
"logout" accessor logout.
Next time we'll start taking a real look at creating database descriptors, so that we can start interacting with tables using GLORP.
Need more help? There's a screencast for other topics like this which you may want to watch. Questions? Try the "Chat with James" Google gadget over in the sidebar.
[st4u158-iPhone.m4v ( Size: 3459116 )]