Page 1 of 1

SQLite UNIDAC Question

Posted: Thu 07 Jan 2010 03:03
by joepasquariello
Hello,

I'm using UNIDAC for the first time. I have a licensed version of UNIDAC Pro. The installation file is unidac300d14pro.exe.

I have a TUniConnection, TUniQuery, TUniDataSource, and TDBGrid on my form. I specify the database name in the Connection object, and I can set Connected=true, but the TUniQuery does not report any tables in the database. I have found that I can put any name in the Database property and the Connected property is true even though no such database exists. Can you explain how to connect to an SQLite3 database?

Also, when I try to build the program, I get the link error below. I have searched my disk, and there is no such file. I simply ran the install program. Do I have to do anything else?

[ILINK32 Error] Unable to open file 'SQLITEUNIPROVIDER.OBJ'

Thanks,

Joe

Posted: Mon 11 Jan 2010 12:59
by Challenger
1. UniDAC creates SQLite database automatically if you specified the name of the database that does not exist.
2. Please add the #pragma link "liteprovider105.lib" line before the #pragma link "SQLiteUniProvider" line.

Posted: Mon 11 Jan 2010 16:57
by joepasquariello
1. I have an existing database named "test.db". UNIDAC seems to be able to open that database, but when I test a query that should work, UNIDAC reports that the table does not exist.

2. I added the #pragma "SQLiteUniProvider105", and now the linker reports that OBJ cannot be found.

[ILINK32 Error] Fatal: Unable to open file 'SQLITEUNIPROVIDER105.OBJ'

3. It would be very helpful if the distribution included at least one working example project for CB2010. Could you please try to make a working example?

Posted: Mon 11 Jan 2010 18:38
by joepasquariello
The problem was that I was not specifying the entire path to the existing database. Even though the database is in the project folder, it seems the database must be specified with an absolute path.

"test.sql" or ".\test.sql" do not work. Only "\...path...\test.sql" will work.

Joe

Posted: Mon 11 Jan 2010 18:53
by joepasquariello
I can open the database at design time, but I still have the linker error (can't find .OBJ file).

Joe

Posted: Mon 11 Jan 2010 20:07
by banita
#pragma link "SQLiteUniProvider" is added automatically when you drop sqlite provider component.

you should add before this line: #pragma link "liteprovider105.lib"

sory for me english

Posted: Mon 11 Jan 2010 20:24
by joepasquariello
Thank you. I didn't read your other response carefully.

I don't have a file named "LiteProvider105.Lib" on my system. I do have "LiteProvider140.Lib", so I added this line, and it works:

#pragma link "LiteProvider140.Lib"

Posted: Tue 12 Jan 2010 10:08
by Plash
Use the following code to set Database:

Code: Select all

UniConnection.Database := ExtractFilePath(Application.ExeName) + 'test.sql';

Posted: Wed 13 Jan 2010 00:12
by joepasquariello
Thanks. That's fine for run-time, but we still must specify the absolute path at design-time. It should at least be possible to use ".\test.sql" at design time. It would also be nice to have an option to _not_ create a database if the specified file does not exist. It's impossible to tell that something is wrong if every value is accepted in the Database field.

Joe

Posted: Wed 13 Jan 2010 08:31
by Plash
At design-time the current directory is the directory with Delphi. So you cannot use the current directory at design-time.

We'll consider the possibility of adding an option not to create database automatically.

Posted: Wed 13 Jan 2010 19:55
by joepasquariello
Thank you.