Page 1 of 1

How do I define a connection with ADO

Posted: 24.10.2006, 18:40
by Jay
How do I define a connection with ADO and specify the parameters? I would prefer to specify the parameters without having to actually store the ODBC datasource. This way the machine that connects only has to have the driver installed but not the actual ODBC definition.

Regards
Jay

Posted: 24.10.2006, 19:28
by fduenas
Hola.

Have you tried this?:

1) Select in TZConnection component the ado protocol
2) Click the '...' button in the DataBase property and it will throw the ADO connection wizard.
3) Follow the same steps you do when creating an ADO connection.
4) Once finished, the ADO connection string will be stored in the DataBase property.

NOTE: AS Long As I Know and unless i'm not updated, there is no implementation done to pass parameters to an ADO connection string that will be replaced automatically when connecting. This have to be an implmentation done for you by replacing the user, host and password values by special strings like %USER%, %PASSWORD%, %HOST% and using StringReplace function (for example) to replace them before connect.

Posted: 24.10.2006, 20:27
by Jay
I tried that and selected "Microsoft OLE DB Provider for ODBC Drivers" and on the next page selected "Use conection string" and pressed the <Generate> button and the normal ODBC wizard appeared. However, when I finish defining the ODBC and press the <Accept> button, it does not respond and I can't close the ODBC window in any way. I had to terminade the Delphi IDE so there must be a bug there somewhere.

Anyway, I kind of understand more or less how to define the string even if I have to manually write it. For now I guess I will have to write it directly and test the conection until it works.

It would be convenient if some basic documentation existed on what has to be specified on the diferent TZConnection properties to make a conection for the diferent drivers.

Thanks for your help.

Regards
Jay

Posted: 03.11.2006, 02:13
by fduenas
HI There is an already documentation for the parameters in the TZConnection. Also there is a CHM file. Take a look for the realased zips and find the parameters.html

It tells there what params you can use for each type of protocol

Posted: 03.11.2006, 02:28
by fduenas
Jay wrote:I tried that and selected "Microsoft OLE DB Provider for ODBC Drivers" and on the next page selected "Use conection string" and pressed the <Generate> button and the normal ODBC wizard appeared. However, when I finish defining the ODBC and press the <Accept> button, it does not respond and I can't close the ODBC window in any way. I had to terminade the Delphi IDE so there must be a bug there somewhere.

Anyway, I kind of understand more or less how to define the string even if I have to manually write it. For now I guess I will have to write it directly and test the conection until it works.

It would be convenient if some basic documentation existed on what has to be specified on the diferent TZConnection properties to make a conection for the diferent drivers.

Thanks for your help.

Regards
Jay
Well it seems strange. i donĀ“t have this kind of problems.

Well, There is an already documentation for the parameters in the TZConnection. Also there is a CHM file. Take a look for the realased zips and find the parameters.html

It tells there what params you can use for each type of protocol.

I have attached the old parameters.html file so you can read it. It's a little bit old but it's quite valid to use with ZeosDBO 6.6

BTW You can use User and Password properties of TZConnection to use them in the ADO protocol. it seems it replaces or add the correct strings to the ConnectionString