A class in an object-oriented language serves as a template: it defines a certain interface and behavior. The object created when you instantiate the class can be thought of as the physical implementation of the class.

Stonefield Query treats databases in a similar manner. A logical database is similar to a class: it defines what tables belong to the database and the structure of those tables. A physical database is the actual database on disk. The logical database doesn't concern itself with location or type of access; those are issues for the physical database. For example, you may have both SQL Server and Access versions of the same logical database; the Northwind sample database that comes with both of these is one such set of physical databases that have the same logical database structure.

A Database object in the Stonefield Query data dictionary contains information about a logical database. A DataSource object represents a physical instance of the logical database. It's also responsible for communicating with the database engine: connecting to it, retrieving the necessary data for a report, disconnecting from it, and so on.

Because different database engines have different properties that determine how to access a specific database, there are different versions of DataSource objects in Stonefield Query. The available versions are:

When you add a DataSource object to the DataSources collection, you must pass the type to the AddItem method.

Each type of DataSource object has its own set of properties which define how to connect to the data source. All also share a common set of properties.

Common Properties

NameData TypeDescription
DatabaseCharacterThe name of the physical database this data source connects to. In the case of file-based database engines such as Visual FoxPro and Access, this must include the path to the database. In the case of text files, this must contain the path for the files.
DataSourceCharacterThe name of the DataSource object.
DescriptionCharacterThe descriptive name for the data source (the name the user sees in the Open Database dialog).
TypeCharacterThe type of data source: "ODBC", "ADO", "VFP", "WebService", "SQLXML", or "Text".

ODBC Properties

The properties of an ODBC DataSource object define how to connect to the data source.

NameData TypeDescription
ConnectionHandleIntegerThe ODBC connection handle for the connection.
DriverCharacterThe name of the ODBC driver to use. This must be the exact name as displayed in the ODBC Administrator dialog.
DSNCharacterA user or system data source name (DSN) defined on the user's system that connects to the data source. Leave this property blank if you want to use a "DSN-less" connection, one that doesn't require a DSN on the user's system.
OtherConnectInfoCharacterAdditional information to pass to the ODBC driver. For example, for protected Access databases, you have to specify "SystemDb=path for MDW file."
PasswordCharacterThe password to access the database.
ServerCharacterThe server the database is located on.
UserNameCharacterThe user name to access the database.

ADO Properties

The properties of an ADO DataSource object define how to connect to the data source and provide a reference to the ADO Connection object.

NameData TypeDescription
CommandTimeoutNumericSpecifies the command timeout setting for the ADO Connection object. Set this to a higher value to avoid timeout issues with queries on large tables.
ConnectionObjectA reference to the ADO Connection object used to connect to the database.
ConnectionStringCharacterThe connection string to connect to the database using an ADO Connection object.
ConnectionTimeoutNumericSpecifies the connection timeout setting for the ADO Connection object.

Web Service Properties

The properties of a Web Service DataSource object define where the Web service is located and what method to call.

NameData TypeDescription
MethodCharacterThe method of the Web service to call. If desired, specify "<<select>>" as a placeholder to tell Stonefield Query to insert the SQL statement it created for a particular table. See the GetDataSources help topic for an example.
SOAPClientObjectA reference to the SOAP client object. One use for this object is to set properties of the SOAP client using the ConnectorProperty member. For example:
DataSource.SOAPClient.ConnectorProperty('Timeout') = 60000
Note this object only exists once the connection has been made to the Web service, so call the datasource object's Connect method manually if you want to access this object before the connection is normally made (such as in a GetDataSources script).
WSDLURLCharacterThe URL of the WSDL file for the Web service.

SQLXML Properties

NameData TypeDescription
BaseURLCharacterThe base URL queries are sent to.
UseTemplateBooleanTrue if queries are sent to a template; False (the default) to include the SQL statement in the URL.

Methods

NameDescription
ConnectConnects to the data source.
DisconnectDisconnects from the data source.

See Also
Database Object | DataSources Collection