Connection string – 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 – SQL Native Client Transaction Persistance https://anvil-of-time.com/powerbuilder/powerbuilder-sql-native-client-transaction-persistance/ Tue, 17 Dec 2013 15:08:42 +0000 http://anvil-of-time.com/wordpress/?p=1641 There can be an issue with transactions not being disconnected from SQL Server when using the SQL Native Driver (SQLNCLIxx driver). In my case when the application was closed, the transactions were held open for up to four minutes. This may not be an issue with a small number of connections but with a large user base it can be problematic.

To correct this you need to add an Extended Property to the Database Profile Setup. The entry is “OLE DB Services=-4”.

This changes your connection string to something like:

SQLCA.DBParm = “Provider=’SQLNCLI10′,Database=’myDB’,ProviderString=’OLE DB Services=-4′

]]>
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.

]]>