RE: SQLite Problem - DSN-less Connection Doesn't Create A File

Author: Paul H. Tarver

Posted: 2017-11-15 at 22:58:15

New details.

I rebooted my computer and tried to use SQLSTRINGCONNECT again and this

time, a window opened which is the same window you would see if you try to

create a DSN. So I have no idea why I got a valid handle no matter what I

tried earlier because after the reboot, nothing I try will give me anything

other than the SQLite3 ODBC Driver Connect window.

I simplified the connection string command to this:

liH = SQLSTRINGCONNECT("DRIVER={SQLite3 ODBC

Driver};DBNAME=T:\f1;SyncPragma=NORMAL;Timeout=100000;")

Executing this line immediately opens the SQLite3 ODBC Driver Connect

window. The Data Source Name is blank and the Database Name is blank. The

timeout and the Synch Mode fields are populated with 100000 and NORMAL but I

have no idea if those are defaults or coming from the connection string.

If it helps, I'm using the 32-bit ODBC driver on a 64-bit Windows 7

development box.

PS: T:\ is a valid volume and I have also tried c:\temp\f1.

Paul H. Tarver

Email: paul@tpcqpc.com

-----Original Message-----

From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Paul H.

Tarver

Sent: Wednesday, November 15, 2017 6:14 PM

To: profoxtech@leafe.com

Subject: SQLite Problem - DSN-less Connection Doesn't Create A File

Ok, I give up. I've been using Whil Hentzen's book "Using SQLite to Bypass

The 2GB .DBF Filesize Limit" for a project I'm trying to develop and I have

some weird behavior going on.

I'm trying to use SQLite3 to deal with an import file that will have 350+

columns. I've been using the the examples and doing everything via the

SQLite3.exe command prompt works as documented. I've also worked out a SQL

script using SQLite Expert to drop a table if it exists, create an empty

table and the corresponding indexes. Up to this point everything worked as

expected.

However, now I'm trying to migrate this code into VFP9 using SQL

Pass-Through, but here's what I'm running into:

If I create a DSN using the ODBC drive and then use SQLCONNECT('dsn-name'),

the connection is made and if the database file "trnslate.db" doesn't

already exist it is created in the folder I designated in the Database Name

field of the DSN.

However, if I create DSN-Less connection (SQLSTRINGCONNECT) using the

connection string I get back using SQLGETPROP(lnhandle,"ConnectString") , I

get a handle, but it is to a "trnslate.db" database that doesn't contain the

table I previously created and if the "trnslate.db" table doesn't already

exist in the designated folder, it is NOT created on the hard drive.

However, it apparently IS created in memory. I can create a table and issue

a select command and get back the results I expect, but a database file is

NEVER physically created on the hard drive which I need to do for my

purposes.

Here is some sample code to see if you can tell me where I'm going wrong:

liH = SQLSTRINGCONNECT( "DRIVER=SQLite3 ODBC Driver;" + ;

"DBNAME=T:\trnslate.db;" + ;

"PWD=;" + ;

"StepAPI=0;" + ;

"SyncPragma=;" + ;

"NoTXN=0;" + ;

"Timeout=;" + ;

"ShortNames=0;" + ;

"LongNames=0;" + ;

"NoCreat=0;" + ;

"NoWCHAR=0;" + ;

"FKSupport=0;" + ;

"JournalMode=;" + ;

"OEMCP=0;" + ;

"BigInt=0;" + ;

"JDConv=0;" + ;

"TraceFile=;")

SQLExec(m.liH, "create table EmplImport (id int primary key, dummy

varchar(50));")

SQLExec(m.liH, "insert into EmplImport (id, dummy) values (1,'testing');")

SQLExec(m.liH, "select * from EmplImport;",'dbtest')

SQLDISCONNECT(liH)

I've tried this process about hundred differ ways with different

combinations of paired keys in the connection string without success. I've

used a DSN-less connection program that I wrote which works perfectly with

SQL, MySQL and others and though I never fail to get a handle; the database

file never physically exists in any path on the hard drive. Complete

searches of my hard drive for the database name yield no results

The code above gives me a value for m.liH which is greater than zero, I

never get errors thrown, I always get a valid handle, the table can be

created, the data inserted and I get a cursor back from the select named

'dbtest' with the exact data inserted on the previous line.

I've been on this for about six hours and I'm no closer to making this work

as a DSN-less project even though Whil seemed to imply in the book that this

was his preferred method of doing things.

HELP!

Paul H. Tarver

Email: <mailto:paul@tpcqpc.com> paul@tpcqpc.com

--- StripMime Report -- processed MIME parts --- multipart/alternative

text/plain (text body -- kept)

text/html

---

[excessive quoting removed by server]

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox

OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/00a601d35e97$84340270$8c9c0750$@tpcqpc.com

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2017 Paul H. Tarver