{"id":786,"date":"2011-06-14T20:20:02","date_gmt":"2011-06-15T01:20:02","guid":{"rendered":"http:\/\/anvil-of-time.com\/wordpress\/?p=786"},"modified":"2021-03-10T20:32:03","modified_gmt":"2021-03-11T01:32:03","slug":"powerbuilder-connect-to-sqlite-version-3-database-odbc","status":"publish","type":"post","link":"https:\/\/anvil-of-time.com\/powerbuilder\/powerbuilder-connect-to-sqlite-version-3-database-odbc\/","title":{"rendered":"PowerBuilder &#8211; Connect to SQLite version 3 database (ODBC)"},"content":{"rendered":"<p>If you are interested in doing PowerBuilder development with an SQLite database here is the DSN Less connection string to get you going.<\/p>\n<pre name=\"code\" class=\"VB\">string ls_dbparm, ls_dbfile, ls_exepath, ls_file[]\n\nls_dbfile = c:\\temp\\sqlite.db3&#039;\n\nIF Fileexists(ls_dbfile) THEN\n\t\/\/ do nothing\nELSE\n\tIF GetFileOpenName(&#039;Select Data File&#039;,ls_dbfile, ls_file,&#039;db3&#039;,&#039;SQLite files (*.db3),*.db3&#039;) &lt; 1 THEN\n\t\tMessagebox(&#039;No Data File Chosen&#039;,&#039;Application will close&#039;)\n\t\tHALT CLOSE\n\tEND IF\nEND IF\n\/\/ SQLite connection\nls_dbparm = &quot;ConnectString=&#039;&quot;\n\/\/ Driver installed with SQLite2009 Pro Enterprise Manager\nls_dbparm = ls_dbparm + &quot;DRIVER=SQLite2010 Pro ODBC Driver;&quot; \nls_dbparm = ls_dbparm + &quot;Database=&quot; + ls_dbfile + &quot;&#039;&quot; \nls_dbparm = ls_dbparm + &quot;UID=&quot; + &quot;admin&quot; + &quot;;PWD=&quot;\nls_dbparm = ls_dbparm +  &quot;&#039;&quot; \nsqlca.DbParm=ls_dbparm \n\nsqlca.DBMS = &quot;ODBC&quot;\n\nCONNECT USING SQLCA;\nIF (sqlca.sqlcode) &lt;&gt; 0 THEN \n\tMessageBox(&quot;Database Log On Error&quot;,&quot;Failed to Connect to Database&quot; +string(sqlca.sqlcode)+&quot; &quot;+sqlca.DBparm  + sqlca.sqlerrtext)\n  \tHALT CLOSE\nEND IF<\/pre>\n<p>You can download the database and a pretty good manager application here:<br \/>\n<a title=\"SQLite2009 Pro Enterprise Manager (FREE)\" href=\"https:\/\/sqlite2009-pro.software.informer.com\/3.7\/\" target=\"_blank\" rel=\"noopener\">SQLite2009 Pro Enterprise Manager (FREE)<\/a><\/p>\n<p>Yes, yes, I know there are other tools which may &#8216;kick SQLite to the curb&#8217; but that&#8217;s up to you to decide.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#039; IF Fileexists(ls_dbfile) THEN \/\/ do nothing ELSE IF GetFileOpenName(&#039;Select Data File&#039;,ls_dbfile, ls_file,&#039;db3&#039;,&#039;SQLite files (*.db3),*.db3&#039;) &lt; 1 THEN Messagebox(&#039;No Data File Chosen&#039;,&#039;Application will close&#039;) HALT&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,10,51],"tags":[53,52,12,16],"_links":{"self":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts\/786"}],"collection":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/comments?post=786"}],"version-history":[{"count":8,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts\/786\/revisions"}],"predecessor-version":[{"id":1959,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts\/786\/revisions\/1959"}],"wp:attachment":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/media?parent=786"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/categories?post=786"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/tags?post=786"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}