Jump to content
t232006

ODBC script for SQLite

Recommended Posts

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

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 by programmerdelphi2k
  • Thanks 1

Share this post


Link to post
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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×