Setting password and ODBC data extraction

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Setting password and ODBC data extraction

Frank Milthorpe
Hi

Reposting my message from Tue, 24 Oct 2006.

The trick is have the username and password in a file in the same
place
for each user. I suggest the personal area on the network drive. The
alternative is the C:\ drive, but this is less secure.
Here is an example to connect to an Oracle database. The same
principal
can be adapted for other databases.
===  H: drive is home network drive  ===
* Spss Syntax file - "h:\spss\oracle_odbc.sps" .
PRESERVE.
SET PRINTBACK = OFF.
* Create macro variables to connect to Oracle databases.
DEFINE !o_odbc  ( ) 'DSN=ORACLE - SPSS;HOST=DATA_WHAREHOUSE;'
!ENDDEFINE.
DEFINE !o_user  ( ) 'UID=username;PWD=xxxpasswordxxx'
!ENDDEFINE.
SET PRINTBACK = ON.
SET PRINTBACK = ON.
RESTORE.

---
  Note the use of SET PRINTBACK to hide the echoing of the password.


===  Now for the analysis  ===

INCLUDE 'h:\spss\oracle_odbc.sps' .
GET CAPTURE ODBC /
    CONNECT= !o_odbc+!o_user / UNENCRYPTED /
  SELECT
    tour.*
  FROM
    database.table  tour
  WHERE
    (tour.tour_no  < 10)
  ORDER BY
    person_no, tour_no.
DESCRIPTIVES VARIABLES = all /   STATISTICS = MIN MAX SUM MEAN.
*and etc.

Essentially this syntax can be shared between users without disclosing
usernames and passwords. You can even the change the name of the
Oracle
and not have to change every syntax file.

Cheers
Frank
PS
  I give SPSS permission to include this solution in the tech support
database or anyone else to include it in a SPSS FAQ.


Moving on 1-September
The Transport Data Centre will be moving to Level 19, 227 Elizabeth
Street on 1-September. Phone and fax contact details will change. The
new switchboard number will be 9268  2800.

Frank Milthorpe
Senior Manager, Transport Model Development
Transport Data Centre
NSW Ministry of  Transport
Direct:    (02) 9206 8609     TDC Phone: (02) 9206 8611
Fax:       (02) 9206 8691

Street:   Level 7, Tower 2 (TNT Tower East), 1 Lawson Square, Redfern
NSW 2016
Postal:   GPO Box 1620, Sydney NSW 2001
Email:     [hidden email]
Web:      www.transport.nsw.gov.au/tdc





------------------------------------------------------------------------------------------------------------------------------------------------
This message is intended for the addressee named and may contain
confidential/privileged information. If you are not the intended
recipient, please delete it and notify the sender.
Views expressed in this message are those of the individual sender, and
are not necessarily the views of the Department.
You should scan any attached files for viruses.
------------------------------------------------------------------------------------------------------------------------------------------------