ODBC – Anvil of Time https://anvil-of-time.com Nature Forges Everything on the Anvil of Time Thu, 11 Mar 2021 01:32:03 +0000 en-US hourly 1 PowerBuilder – Connect to SQLite version 3 database (ODBC) https://anvil-of-time.com/powerbuilder/powerbuilder-connect-to-sqlite-version-3-database-odbc/ Wed, 15 Jun 2011 01:20:02 +0000 http://anvil-of-time.com/wordpress/?p=786 If you are interested in doing PowerBuilder development with an SQLite database here is the DSN Less connection string to get you going.

string ls_dbparm, ls_dbfile, ls_exepath, ls_file[]

ls_dbfile = c:\temp\sqlite.db3'

IF Fileexists(ls_dbfile) THEN
	// do nothing
ELSE
	IF GetFileOpenName('Select Data File',ls_dbfile, ls_file,'db3','SQLite files (*.db3),*.db3') < 1 THEN
		Messagebox('No Data File Chosen','Application will close')
		HALT CLOSE
	END IF
END IF
// SQLite connection
ls_dbparm = "ConnectString='"
// Driver installed with SQLite2009 Pro Enterprise Manager
ls_dbparm = ls_dbparm + "DRIVER=SQLite2010 Pro ODBC Driver;" 
ls_dbparm = ls_dbparm + "Database=" + ls_dbfile + "'" 
ls_dbparm = ls_dbparm + "UID=" + "admin" + ";PWD="
ls_dbparm = ls_dbparm +  "'" 
sqlca.DbParm=ls_dbparm 

sqlca.DBMS = "ODBC"

CONNECT USING SQLCA;
IF (sqlca.sqlcode) <> 0 THEN 
	MessageBox("Database Log On Error","Failed to Connect to Database" +string(sqlca.sqlcode)+" "+sqlca.DBparm  + sqlca.sqlerrtext)
  	HALT CLOSE
END IF

You can download the database and a pretty good manager application here:
SQLite2009 Pro Enterprise Manager (FREE)

Yes, yes, I know there are other tools which may ‘kick SQLite to the curb’ but that’s up to you to decide.

]]>