Send to Printer

st4u

ST 4U 158: Getting Started with GLORP in VA

November 13, 2011 22:24:53.619

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:

First Glorp Use.

If you have trouble viewing that directly, you can click here to download the video directly. If you need the video in a Windows Media format, then download that here.

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:

Basic Query

Finally, logout:


"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.

Technorati Tags: , ,

Enclosures:
[st4u158-iPhone.m4v ( Size: 3459116 )]

posted by James Robertson

 Share Tweet This