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

Author: Paul H. Tarver

Posted: 2017-11-15 at 18:14:04

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

---

_______________________________________________

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/05cd01d35e6f$d017d540$70477fc0$@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