I've not been able to make Windows Authentication work in the past, but I'll
keep that in mind and try it again sometime. So far, my clients have been
accommodating in terms of creating SQL Credentials. I also only need
Read/Only rights for the work I do, so that helps with their security
concerns as well. 

Thanks!

Paul H. Tarver
Tarver Program Consultants, Inc.


-----Original Message-----
From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of Richard
Kaye
Sent: Thursday, February 11, 2021 12:05 PM
To: profoxt...@leafe.com
Subject: RE: sql server connection

Really? All you have to do is set trusted=yes in the conn string, afaik. But
I could be wrong. We only use SQL security accounts in our environment.

I'm sure it's been mentioned before but this is a good resource for
connection strings - https://www.connectionstrings.com/sql-server/

--

rk

-----Original Message-----
From: ProfoxTech <profoxtech-boun...@leafe.com> On Behalf Of Paul H. Tarver
Sent: Thursday, February 11, 2021 12:49 PM
To: profoxt...@leafe.com
Subject: RE: sql server connection

I do this with multiple applications and we handle it using a DSN-less
connection. The only requirement for the pc is a 32-bit MS SQL ODBC driver
must be installed, but no DSN needs to be created on the computer. Also, you
must have SQL Credentials configured on the SQL Server as you cannot use
Windows Authentication over ODBC. 

Here's a short clip of the important parts of the SQLConnect.prg I use:

        lcDSNLess = 'Driver=' + ALLTRIM(lcDriver) + ';' + ;
                'Server=' + ALLTRIM(lcServer) + ';' + ;
                'Uid=' + ALLTRIM(lcUid) + ';' + ;
                'Pwd=' + ALLTRIM(lcPWD) + ';' + ;
                'Database=' + ALLTRIM(lcDbName) 

        * Set SQL TimeOut Wait
        =SQLSETPROP(0,"ConnectTimeOut",3)

        * Suppress ODBC error dialog
        =SQLSETPROP(0,"DispWarnings",.f.)

        * Suppress login dialog 
        =SQLSETPROP(0,"DispLogin",3)

        CLEAR ERROR 
        lnConnection = SQLSTRINGCONNECT(lcDSNLess,.T.)
        lnErrorRows = AERROR(laError)

Then check to see if lnErrorRows is greater than 0 to catch any errors. 

If the lnConnection value is greater than 1, then you can start sending pass
through commands and getting results. 

Hope that helps!

Paul H. Tarver
Tarver Program Consultants, Inc.


[excessive quoting removed by server]

_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message: 
https://leafe.com/archives/byMID/01f601d700af$bc3dc300$34b94900$@tpcqpc.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to