DSN-less connections are more secure too.

If you create a DSN, you can look in the registry and get the password in plain 
text.
DOH!

Dennis McGrath

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of claudinerobbins
Sent: Friday, November 04, 2005 2:26 PM
To: RBG7-L Mailing List
Subject: [RBG7-L] - Re: SATTACH sample

Jan,

I use DSN-less connections exclusively now because they are so maintenance free.

In your case you would have to install R:Base just once on each user's machine 
to install the ODBC driver.  Then Sconnect and Sdisconnect to your heart's 
content!

Examples 01 (Using R:BASE 7.5 ODBC Driver): 

   SCONNECT ';driver=R:BASE 7.5 Database Driver (*.rb1);dbq=d:\71d\rrbyw8' 

Examples 02 (Using Oterro 3.0 ODBC Driver): 

   SCONNECT ';driver=Oterro 3.0 Database Driver (*.rb1);dbq=d:\71d\rrbyw8'

Claudine

________________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Jan Johansen
Sent: Friday, November 04, 2005 1:13 PM
To: RBG7-L Mailing List
Subject: [RBG7-L] - Re: SATTACH sample

David,
 
That's what I thought. I need to stew on this awhile. I was hoping to make one 
ODBC on the server so that no matter where I was (using the web) or a the -A 
option from a shortcut would work. 
 
Jan
----- Original Message -----
From: David M. Blocker
To: RBG7-L Mailing List
Sent: Friday, November 04, 2005 11:03 AM
Subject: [RBG7-L] - Re: SATTACH sample

Yes!!
 
David Blocker
[EMAIL PROTECTED]
781-784-1919
Fax: 781-784-1860
Cell: 339-206-0261
----- Original Message -----
From: Jan Johansen
To: RBG7-L Mailing List
Sent: Friday, November 04, 2005 1:59 PM
Subject: [RBG7-L] - Re: SATTACH sample

David,
 
Thanks!!!
 
Based on your sample a quick question ( I think ). Does each machine that 
access the file need to be set up with ODBC before I can use something like 
this?
 
Jan
----- Original Message -----
From: David M. Blocker
To: RBG7-L Mailing List
Sent: Friday, November 04, 2005 10:54 AM
Subject: [RBG7-L] - Re: SATTACH sample

Jan
 
Here are two subroutines (7.1) that attach to another R:Base database, then 
detach at the end:
 
----------------------------------------------------------------------------
-- FILENAME                : PAYATTCH.RMD
-- CREATED BY              : David M. Blocker
-- DATE INITIALLY CREATED  : 06/08/03
-- PURPOSE                 : Attach ODBC source PAYROLL to PAYDIST
-- CALLED BY               : PAYACCRU.RMD
-- CALLS rmds              :
--       forms             : ErrorMessage
--       reports           :
-- EXTERNAL VARS REFERENCED:
-- INTERNAL VARS CLEARED   :
-- VARIABLES PASSED TO OTHERS:  vAttOK: Yes = attached to Payroll, No = not
--                                attached
----------------------------------------------------------------------------
 
SET ERROR VAR gerrvar
SET VAR vAttOK = 'Yes'
SET VAR fMLine1 = 'Please wait; attaching to Payroll Database and creating + 
copy of Payroll data for maximum report speed. . .'
PAUSE 4 USING .fMLine1 CAPTION .vCaption
 
SCONNECT PAYROLL IDENTIFIED BY BASSPAY BASSPAY IF gerrvar <> 0 THEN
  SET VAR fMLine1 = ('Unable to make ODBC connection to PAYROLL + database!  
Call David Blocker and notify him of this problem immediately!  + Click on OK 
to cancel.')
  EDIT USING ErrorMessage CAPTION .vCaption
  SET VAR vAttOK = 'No'
  GOTO BOTTOM
ENDIF
 
SATTACH TOTBYID
IF gerrvar <> 0 THEN
  SET VAR fMLine1 = ('ODBC connection to PAYROLL database successful, but + 
unable to attach the TotByID view!  Call David Blocker and notify him of
this')
  SET VAR fMLine1 = (.fMLine1 & 'problem immediately!  Click on OK to + 
disconnect from PAYROLL and cancel.')
  EDIT USING ErrorMessage CAPTION .vCaption
  SDETACH TOTBYID
  SDISCONNECT PAYROLL
  SET VAR vAttOK = 'No'
  GOTO BOTTOM
ENDIF
 
SATTACH PayRollNum
IF gerrvar <> 0 THEN
  SET VAR fMLine1 = ('ODBC connection to PAYROLL database successful, but + 
unable to attach the PayRollNum table!  Call David Blocker and notify him
of')
  SET VAR fMLine1 = (.fMLine1 & 'this problem immediately!  Click on OK to + 
disconnect from PAYROLL and cancel.')
  EDIT USING ErrorMessage CAPTION .vCaption
  SDETACH TOTBYID
  SDETACH PAYROLLNUM
  SDISCONNECT PAYROLL
  SET VAR vAttOK = 'No'
  GOTO BOTTOM
ENDIF
 
LABEL BOTTOM
CLS
RETURN
 
 
----------------------------------------------------------------------------
-- FILENAME                : PAYDETCH.RMD
-- CREATED BY              : David M. Blocker
-- DATE INITIALLY CREATED  : 06/09/03
-- PURPOSE                 : Detach ODBC source PAYROLL
-- CALLED BY               : PAYACCRU.RMD
-- CALLS rmds              :
--       forms             : ErrorMessage
--       reports           :
-- EXTERNAL VARS REFERENCED:
-- INTERNAL VARS CLEARED   :
-- VARIABLES PASSED TO OTHERS:  vDetOK: Yes = detached from Payroll, No = not
--                                detached
----------------------------------------------------------------------------
SET ERROR VAR gerrvar
SET VAR vDetOK = 'Yes'
 
CLS
SET VAR fMline1 = 'Please wait; discarding Payroll Accrual Reports data. .
.'
PAUSE 4 USING .fMLine1 CAPTION .vCaption
 
SDETACH TOTBYID NOCHECK
IF gerrvar <> 0 THEN
  SET VAR fMLine1 = 'Unable to detach the TotByID view for some reason! + Call 
David Blocker and notify him of this problem immediately!  + Click on OK to 
cancel.'
  EDIT USING ErrorMessage CAPTION .vCaption
  SET VAR vDetOK = 'No'
  GOTO BOTTOM
ENDIF
 
SDETACH PAYROLLNUM NOCHECK
IF gerrvar <> 0 THEN
  SET VAR fMLine1 = 'Unable to detach the PayRollNum view for some reason! + 
Call David Blocker and notify him of this problem immediately!  + Click on OK 
to cancel.'
  EDIT USING ErrorMessage CAPTION .vCaption
  SET VAR vDetOK = 'No'
  GOTO BOTTOM
ENDIF
 
SDISCONNECT PAYROLL
IF gerrvar <> 0 THEN
  SET VAR fMLine1 = 'Unable to CLOSE ODBC connection to PAYROLL + database!  
Call David Blocker and notify him of this problem immediately!  + Click on OK 
to cancel.'
  EDIT USING ErrorMessage CAPTION .vCaption
  SET VAR vDetOK = 'No'
  GOTO BOTTOM
ENDIF
 
DISCONNECT
--CLOSEWINDOW Form1
CLS
CONNECT &vDatabase1
-- DMB 07/31/03
SET MESSAGES OFF
SET ERROR MESSAGES OFF
LABEL BOTTOM
RETURN
 
David Blocker
[EMAIL PROTECTED]
781-784-1919
Fax: 781-784-1860
Cell: 339-206-0261
----- Original Message -----
From: Jan Johansen
To: RBG7-L Mailing List
Sent: Friday, November 04, 2005 12:53 PM
Subject: [RBG7-L] - SATTACH sample

Hello all,
 
Does anyone have a good sample of code using SATTACH and SCONNECT (and their 
opposites)? 
The help file says that once you issue an SATTACH you don't need to do it 
again. How do you manage that in some startup code?
 
TIA
 
Jan

Reply via email to