Você está na página 1de 4

How to Use ODBC to Connect from MS Access on Your PC to the Data Warehouse

ODBC (Open Data Base Connectivity) is a standard database access method that makes it possible to access any data from
any application, regardless of which database management system (DBMS) is handling the data. ODBC inserts a middle
layer, called a database driver, between an application and the DBMS. The purpose of this layer is to translate the
application's data queries into commands that the DBMS understands. For this to work, the application must be capable of
issuing ODBC commands, and the DBMS must be capable of responding to them.

ODBC Connection Setup

1. Check if the Sybase ODBC driver is installed on the PC.


2. Check if a sql.ini file exists on the PC with a reference to the Sybase server housing the Data Warehouse.
3. Create a data set name (DSN) referring to the Data Warehouse server.
4. Connect to Data Warehouse server in Microsoft Access, and link desired Data Warehouse tables into MS Access.
5. Create a query.

Step 1: Check if the Sybase ODBC driver is installed on your PC. Click on the Start button, point to Settings, and then click
on Control Panel. Double-click on Administrative Tools, and then double-click on ODBC Data Source Administrator. Click
on the Drivers tab. Scroll down the list and look for “Sybase System 11, as indicated in Figure 1 below.

This line indicates that the Sybase


ODBC driver is installed.

Figure 1

If you do not see the Sybase Driver, you will need to download the driver from
http://www.columbia.edu/cu/sis/Downloads/downloads.html, which will install SYSYBNT.DLL, the Sybase ODBC driver
on your PC.

Step 2: Check if a “sql.ini” file exists on your PC with a reference to the Data Warehouse Server. The sql.ini is usually
found in the c:\sql\ini folder. (If you downloaded the SDR package, a sql.ini file should have been created.) Once you have
opened the sql.ini file, you will see a number of entries referring to various Columbia servers. The entry for the Data
Warehouse server should look like this:

[drep_pdb]
query=NLWNSCK, drep-pdb.ais.columbia.edu,4100
win3_query=WNLWNSCK, dwr-pdb.ais.columbia.edu,4100

If none of the entries look like the one specified above, then cut and paste it into your sql.ini file.

Step 3: Create a Data Source Name (DSN) referring to the Data Warehouse server. (DSN provides connectivity to a
database through an ODBC driver.) The DSN contains the database name, directory, database driver, User ID, password, and
other information. Once you create a DSN for a particular database, you can use the DSN in an application to call
information from the database.

1. Click on the Start button, point to Control Panel, double-click Administrative Tools, and then double-click Data
Sources(ODBC).
2. Click the System DSN or the User DSN tab, and then click Add.
3. Choose the Sybase System 11 driver and then click Finish.
4. Enter the information on the General tab as shown in Figure 2 below.
5. If you would like to use this DSN to access multiple databases (such as DSS and SIS), click on the Connection tab,
and in the Database List box, enter the database names, separated by commas (for example: DSS, SIS).
6. Click OK and then click OK on the next window.
Figure 2

Step 4: Connect to the Data Warehouse server in MS Access, and link desired Data Warehouse tables into Access.

1. Open MS Access, and either create a new database file or open an existing database file. Go to the Database
window for the open file.
2. On the File menu, point to Get External Data, and then click Link Tables.
3. In the Link dialog box, in the Files of type box, select ODBC Databases().
4. Click either the File Data Source or Machine Data Source tab, and then double-click the ODBC data set name for
the Data Warehouse.
5. Enter your Data Warehouse logon ID and password and then click OK. MS Access will connect to the Data
Warehouse and display a list of the tables you can link to.
6. Click each table that you want to link to, and then click OK. If you’re linking a table and it doesn’t have an index
that uniquely identifies each record, then MS Access displays a list of the fields in the linked table. Click a field or
a combination of fields that will uniquely identify each record, and then click OK.
7. Since MS Access allows you by default to upate data in a table, you should protect Data Warehouse linked tables
so that you or another user will not inadvertently attempt to update the tables. To do this, go to the Tools menu,
point to Security, and click on the User and Group Permissions. For each one of your linked tables, unclick the
check boxes that allow users to update, delete or insert data.

Step 5: Create a query from the tables selected in Step 4.

1. Click on Queries.
2. Double-lick on Create Query in Design View.
3. Select the tables you would like to use in your query and click Add.
4. Once the tables have been added to the query you can begin your table joins. (See Data Warehouse
Database Reference Manual https://dwr.ais.columbia.edu/info/Data%20Warehouse%20Manual.pdf for
complete descriptions of recommended table joins.)
5. Drag and drop the columns from each table into your work area. (Another method would be to click on the
box beside the word “Field”, click on the scroll-down arrow and select the columns you need from each
table.)
6. Select the columns the output should be sorted by.
7. Select columns to be or not to be displayed in the output.
8. Enter the criteria for the query. For example, for Fiscal_Year 2004 enter 2004 in the Fiscal Year column.
9. Click on the Red Exclamation Sign to run the query.
10. To return to the query section, click on view on the toolbar, click Design view and it will return you to your
query page.

Once you have completed the above steps you should have successfully connected to the Data Warehouse server and residing
tables.

Você também pode gostar