I've developed a number of applications using Delphi against a SQL Server database. Each time I come up against the same problem but always use a work-around (as I know it works). I'm trying to get a better solution to the issue.
I make use of a TDatabase component.
I set up an ODBC connection (call it 'ODBC_1') to the required SQL Server database (call it 'DATABASE_1')
If I set the 'AliasName' property of the TDatabase component to be 'ODBC_1', not entering any additional parameters and not setting the 'Driver Name' (mutually exclusive with the setting of the 'AliasName'), the application operates fine on the machine it was developed on. If I move the compiled program to another machine, with SQL Server database running and ODBC connection 'ODBC_1' set up in the same way I sometimes get the error that the connection is not trusted and the connection fails - causing my application to fail.
How can I set up the TDatabase such that I can run the application on any machine (which has access to the appropriate database and has the ODBC connection set up) when I move the executable between machines.
I currently have a procedure that sets up the TDatabase component according to a password (for access of SQL Server) as entered by the user. I set the 'Driver Name' of the TDatabase to be 'SQL Server' and then set the parameters 'DATABASE NAME=DATABASE_1', 'USER NAME=sa', 'ODBC DSN=ODBC_1', 'PASSWORD=' + password entered.
This then allows the application to be run on any machine as required but its not as simple as I would like.
What settings do I need to apply in the TDatabase component to allow me to achieve this ?
Thanks in advance
Steve
I make use of a TDatabase component.
I set up an ODBC connection (call it 'ODBC_1') to the required SQL Server database (call it 'DATABASE_1')
If I set the 'AliasName' property of the TDatabase component to be 'ODBC_1', not entering any additional parameters and not setting the 'Driver Name' (mutually exclusive with the setting of the 'AliasName'), the application operates fine on the machine it was developed on. If I move the compiled program to another machine, with SQL Server database running and ODBC connection 'ODBC_1' set up in the same way I sometimes get the error that the connection is not trusted and the connection fails - causing my application to fail.
How can I set up the TDatabase such that I can run the application on any machine (which has access to the appropriate database and has the ODBC connection set up) when I move the executable between machines.
I currently have a procedure that sets up the TDatabase component according to a password (for access of SQL Server) as entered by the user. I set the 'Driver Name' of the TDatabase to be 'SQL Server' and then set the parameters 'DATABASE NAME=DATABASE_1', 'USER NAME=sa', 'ODBC DSN=ODBC_1', 'PASSWORD=' + password entered.
This then allows the application to be run on any machine as required but its not as simple as I would like.
What settings do I need to apply in the TDatabase component to allow me to achieve this ?
Thanks in advance
Steve