Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Connection to Backend
Message
General information
Forum:
Visual FoxPro
Category:
Client/server
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
MS SQL Server
Miscellaneous
Thread ID:
01343807
Message ID:
01343822
Views:
28
>>I am using ODBC to connect my APP to the Backend along with a Connection on the DBC
>>The Connection points to the System ODBC, now here is my Issue
>>
>>When I am in developer machine I provided the user and password to the connection in order to retrieve the data, however, I wouldnt do this on the Client side since this compromises the security of the data. Now my question
>>
>>In my scenario, what would I have to do in order to dynamically pass the user and password to the connection so the only one knowing this is my APP?
>>
>>What I want to avoid is to store the user and passw on the conection and somebuddy open the project using VFP and read this information.
>>
>>TIA
>
>
>You could ALWAYS invoke connection dialog when you connect to SQL Server (or other databases):
>
>
>SQLSETPROP(0,"DispLogin",1)
>lnHandle = SQLCONNECT([DSNNameHere]) && The DSN should not contain username and/or password
>* or lnHandle = SQLSTRINGCONNECT([Driver=SQL Server;DataBase=YourDB;Server=SomeServer])
>....
>
>
>
>Other way is to use Trusted connections always :-)

here is what I meant
OPEN DATABASE C:\sample\Data\myDBC.dbc
PUBLIC lnConn
lnConn = SQLCONNECT("myConn","sa","myPass")
?lnConn     *:returns 1, so the connection succeeded 
SELECT 0
USE myDBC!myRemoteView  *:here the login screen displays asking me for user and pass
Now, mybe I am mistaking, but isn't it supouse that the RV takes the opened connection when I performe this
lnConn = SQLCONNECT("myConn","sa","myPass")
i think the only thing i have to do is to tell the Remote View to share the conection, right?
DBSetProp('ICLOC', 'View', 'ShareConnection', .T.)
what i am missing?

here is my dbc in code for you to take a look
CREATE CONNECTION ACCPACCON ; 
   DATASOURCE "Sample" ; 
   USERID "sa" ; 
   PASSWORD ""

****
DBSetProp('ACCPACCON', 'Connection', 'Asynchronous', .F.)
DBSetProp('ACCPACCON', 'Connection', 'BatchMode', .T.)
DBSetProp('ACCPACCON', 'Connection', 'Comment', '')
DBSetProp('ACCPACCON', 'Connection', 'DispLogin', 1)
DBSetProp('ACCPACCON', 'Connection', 'ConnectTimeOut', 15)
DBSetProp('ACCPACCON', 'Connection', 'DispWarnings', .F.)
DBSetProp('ACCPACCON', 'Connection', 'IdleTimeOut', 0)
DBSetProp('ACCPACCON', 'Connection', 'QueryTimeOut', 0)
DBSetProp('ACCPACCON', 'Connection', 'Transactions', 1)
DBSetProp('ACCPACCON', 'Connection', 'Database', '')
DBSetProp('ACCPACCON', 'Connection', 'PacketSize', 4096)
DBSetProp('ACCPACCON', 'Connection', 'WaitTime', 100)

***************** View setup for ICLOC ***************

CREATE SQL VIEW "ICLOC" ; 
   REMOTE CONNECT "AccpacCON" ; 
   AS SELECT Icloc.LOCATION, Icloc.ADDRESS1, Icloc.ADDRESS2, Icloc.ADDRESS3, Icloc.CITY, Icloc.STATE FROM  dbo.ICLOC Icloc

DBSetProp('ICLOC', 'View', 'UpdateType', 1)
DBSetProp('ICLOC', 'View', 'WhereType', 3)
DBSetProp('ICLOC', 'View', 'FetchMemo', .T.)
DBSetProp('ICLOC', 'View', 'SendUpdates', .F.)
DBSetProp('ICLOC', 'View', 'UseMemoSize', 255)
DBSetProp('ICLOC', 'View', 'FetchSize', 100)
DBSetProp('ICLOC', 'View', 'MaxRecords', -1)
DBSetProp('ICLOC', 'View', 'Tables', 'dbo.ICLOC')
DBSetProp('ICLOC', 'View', 'Prepared', .F.)
DBSetProp('ICLOC', 'View', 'CompareMemo', .T.)
DBSetProp('ICLOC', 'View', 'FetchAsNeeded', .F.)
DBSetProp('ICLOC', 'View', 'Comment', "")
DBSetProp('ICLOC', 'View', 'BatchUpdateCount', 1)
DBSetProp('ICLOC', 'View', 'ShareConnection', .T.)
DBSetProp('ICLOC', 'View', 'AllowSimultaneousFetch', .F.)

*!* Field Level Properties for ICLOC
* Props for the ICLOC.location field.
DBSetProp('ICLOC.location', 'Field', 'KeyField', .T.)
DBSetProp('ICLOC.location', 'Field', 'Updatable', .F.)
DBSetProp('ICLOC.location', 'Field', 'UpdateName', 'dbo.ICLOC.LOCATION')
DBSetProp('ICLOC.location', 'Field', 'DataType', "C(6)")
* Props for the ICLOC.address1 field.
DBSetProp('ICLOC.address1', 'Field', 'KeyField', .F.)
DBSetProp('ICLOC.address1', 'Field', 'Updatable', .T.)
DBSetProp('ICLOC.address1', 'Field', 'UpdateName', 'dbo.ICLOC.ADDRESS1')
DBSetProp('ICLOC.address1', 'Field', 'DataType', "C(60)")
* Props for the ICLOC.address2 field.
DBSetProp('ICLOC.address2', 'Field', 'KeyField', .F.)
DBSetProp('ICLOC.address2', 'Field', 'Updatable', .T.)
DBSetProp('ICLOC.address2', 'Field', 'UpdateName', 'dbo.ICLOC.ADDRESS2')
DBSetProp('ICLOC.address2', 'Field', 'DataType', "C(60)")
* Props for the ICLOC.address3 field.
DBSetProp('ICLOC.address3', 'Field', 'KeyField', .F.)
DBSetProp('ICLOC.address3', 'Field', 'Updatable', .T.)
DBSetProp('ICLOC.address3', 'Field', 'UpdateName', 'dbo.ICLOC.ADDRESS3')
DBSetProp('ICLOC.address3', 'Field', 'DataType', "C(60)")
* Props for the ICLOC.city field.
DBSetProp('ICLOC.city', 'Field', 'KeyField', .F.)
DBSetProp('ICLOC.city', 'Field', 'Updatable', .T.)
DBSetProp('ICLOC.city', 'Field', 'UpdateName', 'dbo.ICLOC.CITY')
DBSetProp('ICLOC.city', 'Field', 'DataType', "C(30)")
* Props for the ICLOC.state field.
DBSetProp('ICLOC.state', 'Field', 'KeyField', .F.)
DBSetProp('ICLOC.state', 'Field', 'Updatable', .T.)
DBSetProp('ICLOC.state', 'Field', 'UpdateName', 'dbo.ICLOC.STATE')
DBSetProp('ICLOC.state', 'Field', 'DataType', "C(30)")
hope you can help me up?
.......
DO WHILE .T.
      ME.Work()
ENDDO
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform