Consultor Eletrônico



Kbase P2899: How to avoid writing the owner of the table (schema) before referencing the table name in the SQL co
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/12/2007
Status: Verified

GOAL:

How to avoid writing the owner of the table (schema) before referencing the table name in the SQL commands

GOAL:

How to set a default schema for a specific owner in SQL-92?

GOAL:

How to avoid prefixing table names with PUB when using SQL-92

FIX:

Option #1
Use the following statement in the same SQL session prior to running any SQL statements:

set schema 'owner'; (where 'owner' is the owner name, E.g. 'pub')

It will be valid until the end of the session or until it is changed.

Option #2
If using an ODBC DSN, set the default schema to the owner in the DSN settings

Windows:
Add the "DefaultSchema" string value set to the owner of the schema (for example, "PUB") in the registry:

HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\<your DSN name>
or
HKEY_LOCAL_MACHINE\Software\ODBC\ODBC.INI\<your DSN name>

UNIX:
Add following in the ODBC.INI file (in the desired DSN section):

DefaultSchema=owner (where 'owner' is the owner name, E.g. 'pub')

(There is no space.)

Option #3
Using JDBC add defaultSchema connection parameter to the URL:

jdbc:datadirect:openedge//myhost:6718;databaseName=sports2000;defaultSchema= pub