t232006 0 Posted February 23, 2023 Hello, all programming lovers! I decided to use ADO for connection to SQLite database. I installed the driver, used ODBC Data Sources window to create alias and assign folder to database file. Then connected to database using connection string and pointing alias. But when user install my application he hasn't to use ODBC Data Sources window because installation has to be fully automatically. In other words how to white a script by running which alias will enter to ODBC? Share this post Link to post
Markus Kinzler 174 Posted February 23, 2023 If you want to use a alias, then you have to create it on every PC the program is run. (can be done by program or installer) Share this post Link to post
programmerdelphi2k 237 Posted February 23, 2023 (edited) You can try create a new "key" (for your Alias) on "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources" in your registry. then, your app can create a new key with all data necessary for your alias, like: tip: use the same data like in desigtime Quote “Driver”=”sqlsrv32.dll” /// path complete if necessary “Description”=”Test System DSN Connection to local database XXXX” “Server”=”(local)” /// IP ou Local.... “Database”=”XXXX" /// path complete if necessary etc... NOTE: your customer should have ODBC install of course, to complete the task... Another tip: create a manual DSN definition in your PC, and go Registry and "Export it" to text and see how do it!!! Edited February 23, 2023 by programmerdelphi2k 1 Share this post Link to post
t232006 0 Posted February 23, 2023 3 hours ago, Markus Kinzler said: If you want to use a alias, then you have to create it on every PC the program is run. (can be done by program or installer) It is about how to do this that I'm asking Share this post Link to post
Brian Evans 105 Posted February 23, 2023 Note that you don't need a DSN - you can pass all the required connection parameters / information to the ODBC Driver Manager in the in the ADO connection string itself. Using a DSN just provides an extra level of indirection that can be useful in some cases. Share this post Link to post