Database programming guide : Accessing database management systems : Database connection concepts

Database connection concepts
Some terms and concepts that you need to understand before connecting to a database include: "database manager," "connection specification," "alias," and "access set."
Database managers
The interface between VA Smalltalk and a DBMS is called a database manager. To use VA Smalltalk's database support, you connect to a database through a VA Smalltalk database manager. VA Smalltalk uses the following database managers:
IBM Database -- CLI
The interface between VA Smalltalk and the IBM DB2 DBMS. This is available when you load the IBM Database feature.
ODBC
The ODBC interface between VA Smalltalk and your DBMS. This is available when you load the ODBC Support feature.
Oracle - Native
The native interface between VA Smalltalk and your ORACLE DBMS. This is available when you load the Native Oracle Database feature.
SQLite - Native
The native interface between VA Smalltalk and your SQlite DBMS. This is available when you load the ST: Database, SQLite feature.
Connections, connection specifications, aliases, and logon specifications
A database connection is a connection from VA Smalltalk to a database through a database manager. You can establish more than one database connection at a time if your DBMS allows multiple connections.
To keep track of your database connections, VA Smalltalk uses something called connection specifications. A connection specification associates an alias, which is a name that you make up to refer to your database, with a VA Smalltalk database manager and a database name or ODBC data source. You might use the alias SampleConSpec, for example, to refer to a connection to the SAMPLE database through DB2. A connection specification serves several purposes:
You can define a connection specification once and use it over and over again in more than one application. If you change the database that an alias points to, then you can automatically update all parts that use that alias.
Note:
You should be careful about changing the database manager associated with an alias. VA Smalltalk can manage a change in databases more easily than a change in database managers. You may need to migrate your application to the new database manager if you change the database manager that a connection specification points to. See the VA Smalltalk User's Guide for information on using the VA Smalltalk database application migration tool.
When you connect to a database, you can pass the connection specification a logon specification, which consists of a user ID and a password. If you connect to a database with a logon specification, then VA Smalltalk handles the database logon automatically. Otherwise, it prompts you with a database logon window, which you can use to enter your user ID and password.
Access sets
An access set is a special part that you define and package with your application to store connection specifications, database query definitions, and stored procedure definitions. An access set tells your application which connection specifications, queries, and stored procedures it can use.
Note:
VA Smalltalk stores all specifications (connection, query, and stored procedure) in an access set with method categories that are used by VA Smalltalk. Do not change a method category for a connection, query, or stored procedure specification. You can add the selector to other categories if you want.
Access sets are used in VA Smalltalk only. The VA Smalltalk User's Guide explains how to create an access set.
Before you can start working on a database application, you need to establish a database connection as follows. Each of these tasks are explained in the following sections:
1.
2.
3.
Send the connect message to the connection specification.
 
Note:
You need to establish a database connection each time you start VA Smalltalk.