{"id":189,"date":"2010-07-07T20:17:10","date_gmt":"2010-07-08T01:17:10","guid":{"rendered":"http:\/\/anvil-of-time.com\/wordpress\/?p=189"},"modified":"2021-03-09T00:29:19","modified_gmt":"2021-03-09T05:29:19","slug":"powerbuilder-single-user-sign-on-verification","status":"publish","type":"post","link":"https:\/\/anvil-of-time.com\/powerbuilder\/powerbuilder-single-user-sign-on-verification\/","title":{"rendered":"PowerBuilder &#8211; Single user sign on verification for SQL Anywhere"},"content":{"rendered":"<p>This method is used with a SQL Anywhere database to ensure that any given user can only sign on the application once.  It uses the <strong>connection_property<\/strong> function so make sure you either give the users permission to execute this or set up a separate connection which uses an id which has the permissions.<\/p>\n<p>There are three Powerbuilder objects, one nvo and two datawindow objects, a stored procedure, and a table.<\/p>\n<p>Table<\/p>\n<pre name=\"code\" class=\"SQL\">CREATE TABLE &quot;dba&quot;.&quot;sec_userconnection&quot; \n(&quot;connectionid&quot; numeric(12,0) NOT NULL DEFAULT NULL\n, &quot;userid&quot; varchar(20) NOT NULL DEFAULT NULL \n, PRIMARY KEY (&quot;connectionid&quot;, &quot;userid&quot;)) ;<\/pre>\n<p>Stored Procedure<\/p>\n<pre name=\"code\" class=\"SQL\">create procedure DBA.Conn_number(out id integer)\nbegin\n  select connection_property(&#039;Number&#039;)\nend<\/pre>\n<p>Datawindow objects<\/p>\n<pre name=\"code\" class=\"VB\">$PBExportHeader$d_conn_number.srd\nrelease 9;\ndatawindow(units=0 timer_interval=0 color=1073741824 processing=0 HTMLDW=no print.printername=&quot;&quot; print.documentname=&quot;&quot; print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 96 print.margin.bottom = 96 print.paper.source = 0 print.paper.size = 0 print.canusedefaultprinter=yes print.prompt=no print.buttons=no print.preview.buttons=no print.cliptext=no print.overrideprintjob=no print.collate=yes hidegrayline=no )\nsummary(height=0 color=&quot;536870912&quot; )\nfooter(height=0 color=&quot;536870912&quot; )\ndetail(height=144 color=&quot;536870912&quot; )\ntable(column=(type=char(254) updatewhereclause=yes name=conn_number dbname=&quot;compute_0001&quot; )\n procedure=&quot;1 execute dba.conn_number;0 id = :id&quot; arguments=((&quot;id&quot;, number)) )\ntext(band=detail alignment=&quot;1&quot; text=&quot;Connection Property(&#039;number&#039;):&quot; border=&quot;0&quot; color=&quot;33554432&quot; x=&quot;37&quot; y=&quot;4&quot; height=&quot;64&quot; width=&quot;809&quot; html.valueishtml=&quot;0&quot;  name=compute_0001_t visible=&quot;1&quot;  font.face=&quot;Arial&quot; font.height=&quot;-10&quot; font.weight=&quot;400&quot;  font.family=&quot;2&quot; font.pitch=&quot;2&quot; font.charset=&quot;0&quot; background.mode=&quot;1&quot; background.color=&quot;536870912&quot; )\ncolumn(band=detail id=1 alignment=&quot;0&quot; tabsequence=32766 border=&quot;0&quot; color=&quot;33554432&quot; x=&quot;864&quot; y=&quot;4&quot; height=&quot;76&quot; width=&quot;4389&quot; format=&quot;[general]&quot; html.valueishtml=&quot;0&quot;  name=conn_number visible=&quot;1&quot; edit.limit=254 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0  font.face=&quot;Arial&quot; font.height=&quot;-10&quot; font.weight=&quot;400&quot;  font.family=&quot;2&quot; font.pitch=&quot;2&quot; font.charset=&quot;0&quot; background.mode=&quot;1&quot; background.color=&quot;536870912&quot; )\nhtmltable(border=&quot;1&quot; )\nhtmlgen(clientevents=&quot;1&quot; clientvalidation=&quot;1&quot; clientcomputedfields=&quot;1&quot; clientformatting=&quot;0&quot; clientscriptable=&quot;0&quot; generatejavascript=&quot;1&quot; encodeselflinkargs=&quot;1&quot; netscapelayers=&quot;0&quot; )\nexport.xml(headgroups=&quot;1&quot; includewhitespace=&quot;0&quot; metadatatype=0 savemetadata=0 )\nimport.xml()\nexport.pdf(method=0 distill.custompostscript=&quot;0&quot; xslfop.print=&quot;0&quot; )<\/pre>\n<p>This second datawindow object is based on the stored procedure <strong>sa_conn_info<\/strong>.  Again, you must have permissions set up for the user to run this.<\/p>\n<pre name=\"code\" class=\"VB\">$PBExportHeader$d_sa_conn_info.srd\nrelease 9;\ndatawindow(units=0 timer_interval=0 color=1073741824 processing=0 HTMLDW=no print.printername=&quot;&quot; print.documentname=&quot;&quot; print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 96 print.margin.bottom = 96 print.paper.source = 0 print.paper.size = 0 print.canusedefaultprinter=yes print.prompt=no print.buttons=no print.preview.buttons=no print.cliptext=no print.overrideprintjob=no print.collate=yes hidegrayline=no )\nsummary(height=0 color=&quot;536870912&quot; )\nfooter(height=0 color=&quot;536870912&quot; )\ndetail(height=2048 color=&quot;536870912&quot; )\ntable(column=(type=long updatewhereclause=yes name=number dbname=&quot;number&quot; )\n column=(type=char(255) updatewhereclause=yes name=name dbname=&quot;name&quot; )\n column=(type=char(255) updatewhereclause=yes name=userid dbname=&quot;userid&quot; )\n column=(type=long updatewhereclause=yes name=dbnumber dbname=&quot;dbnumber&quot; )\n column=(type=char(255) updatewhereclause=yes name=lastreqtime dbname=&quot;lastreqtime&quot; )\n column=(type=char(255) updatewhereclause=yes name=processtime dbname=&quot;processtime&quot; )\n column=(type=long updatewhereclause=yes name=port dbname=&quot;port&quot; )\n column=(type=char(255) updatewhereclause=yes name=reqtype dbname=&quot;reqtype&quot; )\n column=(type=char(255) updatewhereclause=yes name=commlink dbname=&quot;commlink&quot; )\n column=(type=char(255) updatewhereclause=yes name=nodeaddr dbname=&quot;nodeaddr&quot; )\n column=(type=long updatewhereclause=yes name=lastidle dbname=&quot;lastidle&quot; )\n column=(type=long updatewhereclause=yes name=currtasksw dbname=&quot;currtasksw&quot; )\n column=(type=long updatewhereclause=yes name=blockedon dbname=&quot;blockedon&quot; )\n column=(type=decimal(0) updatewhereclause=yes name=lockname dbname=&quot;lockname&quot; )\n column=(type=long updatewhereclause=yes name=uncmtops dbname=&quot;uncmtops&quot; )\n procedure=&quot;1 execute dbo.sa_conn_info;0 connidparm = :connidparm&quot; arguments=((&quot;connidparm&quot;, number)) )\ntext(band=detail alignment=&quot;1&quot; text=&quot;Number:&quot; border=&quot;0&quot; color=&quot;33554432&quot; x=&quot;37&quot; y=&quot;4&quot; height=&quot;64&quot; width=&quot;352&quot; html.valueishtml=&quot;0&quot;  name=number_t visible=&quot;1&quot;  font.face=&quot;Arial&quot; font.height=&quot;-10&quot; font.weight=&quot;400&quot;  font.family=&quot;2&quot; font.pitch=&quot;2&quot; font.charset=&quot;0&quot; background.mode=&quot;1&quot; background.color=&quot;536870912&quot; )\ncolumn(band=detail id=1 alignment=&quot;1&quot; tabsequence=32766 border=&quot;0&quot; color=&quot;33554432&quot; x=&quot;407&quot; y=&quot;4&quot; height=&quot;76&quot; width=&quot;329&quot; format=&quot;[general]&quot; html.valueishtml=&quot;0&quot;  name=number visible=&quot;1&quot; edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0  font.face=&quot;Arial&quot; font.height=&quot;-10&quot; font.weight=&quot;400&quot;  font.family=&quot;2&quot; font.pitch=&quot;2&quot; font.charset=&quot;0&quot; background.mode=&quot;1&quot; background.color=&quot;536870912&quot; )\ntext(band=detail alignment=&quot;1&quot; text=&quot;Name:&quot; border=&quot;0&quot; color=&quot;33554432&quot; x=&quot;37&quot; y=&quot;140&quot; height=&quot;64&quot; width=&quot;352&quot; html.valueishtml=&quot;0&quot;  name=name_t visible=&quot;1&quot;  font.face=&quot;Arial&quot; font.height=&quot;-10&quot; font.weight=&quot;400&quot;  font.family=&quot;2&quot; font.pitch=&quot;2&quot; font.charset=&quot;0&quot; background.mode=&quot;1&quot; background.color=&quot;536870912&quot; )\ncolumn(band=detail id=2 alignment=&quot;0&quot; tabsequence=32766 border=&quot;0&quot; color=&quot;33554432&quot; x=&quot;407&quot; y=&quot;140&quot; height=&quot;76&quot; width=&quot;4389&quot; format=&quot;[general]&quot; html.valueishtml=&quot;0&quot;  name=name visible=&quot;1&quot; edit.limit=255 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0  font.face=&quot;Arial&quot; font.height=&quot;-10&quot; font.weight=&quot;400&quot;  font.family=&quot;2&quot; font.pitch=&quot;2&quot; font.charset=&quot;0&quot; background.mode=&quot;1&quot; background.color=&quot;536870912&quot; )\ntext(band=detail alignment=&quot;1&quot; text=&quot;Userid:&quot; border=&quot;0&quot; color=&quot;33554432&quot; x=&quot;37&quot; y=&quot;276&quot; height=&quot;64&quot; width=&quot;352&quot; html.valueishtml=&quot;0&quot;  name=userid_t visible=&quot;1&quot;  font.face=&quot;Arial&quot; font.height=&quot;-10&quot; font.weight=&quot;400&quot;  font.family=&quot;2&quot; font.pitch=&quot;2&quot; font.charset=&quot;0&quot; background.mode=&quot;1&quot; background.color=&quot;536870912&quot; )\ncolumn(band=detail id=3 alignment=&quot;0&quot; tabsequence=32766 border=&quot;0&quot; color=&quot;33554432&quot; x=&quot;407&quot; y=&quot;276&quot; height=&quot;76&quot; width=&quot;4389&quot; format=&quot;[general]&quot; html.valueishtml=&quot;0&quot;  name=userid visible=&quot;1&quot; edit.limit=255 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0  font.face=&quot;Arial&quot; font.height=&quot;-10&quot; font.weight=&quot;400&quot;  font.family=&quot;2&quot; font.pitch=&quot;2&quot; font.charset=&quot;0&quot; background.mode=&quot;1&quot; background.color=&quot;536870912&quot; )\ntext(band=detail alignment=&quot;1&quot; text=&quot;Dbnumber:&quot; border=&quot;0&quot; color=&quot;33554432&quot; x=&quot;37&quot; y=&quot;412&quot; height=&quot;64&quot; width=&quot;352&quot; html.valueishtml=&quot;0&quot;  name=dbnumber_t visible=&quot;1&quot;  font.face=&quot;Arial&quot; font.height=&quot;-10&quot; font.weight=&quot;400&quot;  font.family=&quot;2&quot; font.pitch=&quot;2&quot; font.charset=&quot;0&quot; background.mode=&quot;1&quot; background.color=&quot;536870912&quot; )\ncolumn(band=detail id=4 alignment=&quot;1&quot; tabsequence=32766 border=&quot;0&quot; color=&quot;33554432&quot; x=&quot;407&quot; y=&quot;412&quot; height=&quot;76&quot; width=&quot;329&quot; format=&quot;[general]&quot; html.valueishtml=&quot;0&quot;  name=dbnumber visible=&quot;1&quot; edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0  font.face=&quot;Arial&quot; font.height=&quot;-10&quot; font.weight=&quot;400&quot;  font.family=&quot;2&quot; font.pitch=&quot;2&quot; font.charset=&quot;0&quot; background.mode=&quot;1&quot; background.color=&quot;536870912&quot; )\ntext(band=detail alignment=&quot;1&quot; text=&quot;Lastreqtime:&quot; border=&quot;0&quot; color=&quot;33554432&quot; x=&quot;37&quot; y=&quot;548&quot; height=&quot;64&quot; width=&quot;352&quot; html.valueishtml=&quot;0&quot;  name=lastreqtime_t visible=&quot;1&quot;  font.face=&quot;Arial&quot; font.height=&quot;-10&quot; font.weight=&quot;400&quot;  font.family=&quot;2&quot; font.pitch=&quot;2&quot; font.charset=&quot;0&quot; background.mode=&quot;1&quot; background.color=&quot;536870912&quot; )\ncolumn(band=detail id=5 alignment=&quot;0&quot; tabsequence=32766 border=&quot;0&quot; color=&quot;33554432&quot; x=&quot;407&quot; y=&quot;548&quot; height=&quot;76&quot; width=&quot;4389&quot; format=&quot;[general]&quot; html.valueishtml=&quot;0&quot;  name=lastreqtime visible=&quot;1&quot; edit.limit=255 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0  font.face=&quot;Arial&quot; font.height=&quot;-10&quot; font.weight=&quot;400&quot;  font.family=&quot;2&quot; font.pitch=&quot;2&quot; font.charset=&quot;0&quot; background.mode=&quot;1&quot; background.color=&quot;536870912&quot; )\ntext(band=detail alignment=&quot;1&quot; text=&quot;Processtime:&quot; border=&quot;0&quot; color=&quot;33554432&quot; x=&quot;37&quot; y=&quot;684&quot; height=&quot;64&quot; width=&quot;352&quot; html.valueishtml=&quot;0&quot;  name=processtime_t visible=&quot;1&quot;  font.face=&quot;Arial&quot; font.height=&quot;-10&quot; font.weight=&quot;400&quot;  font.family=&quot;2&quot; font.pitch=&quot;2&quot; font.charset=&quot;0&quot; background.mode=&quot;1&quot; background.color=&quot;536870912&quot; )\ncolumn(band=detail id=6 alignment=&quot;0&quot; tabsequence=32766 border=&quot;0&quot; color=&quot;33554432&quot; x=&quot;407&quot; y=&quot;684&quot; height=&quot;76&quot; width=&quot;4389&quot; format=&quot;[general]&quot; html.valueishtml=&quot;0&quot;  name=processtime visible=&quot;1&quot; edit.limit=255 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0  font.face=&quot;Arial&quot; font.height=&quot;-10&quot; font.weight=&quot;400&quot;  font.family=&quot;2&quot; font.pitch=&quot;2&quot; font.charset=&quot;0&quot; background.mode=&quot;1&quot; background.color=&quot;536870912&quot; )\ntext(band=detail alignment=&quot;1&quot; text=&quot;Port:&quot; border=&quot;0&quot; color=&quot;33554432&quot; x=&quot;37&quot; y=&quot;820&quot; height=&quot;64&quot; width=&quot;352&quot; html.valueishtml=&quot;0&quot;  name=port_t visible=&quot;1&quot;  font.face=&quot;Arial&quot; font.height=&quot;-10&quot; font.weight=&quot;400&quot;  font.family=&quot;2&quot; font.pitch=&quot;2&quot; font.charset=&quot;0&quot; background.mode=&quot;1&quot; background.color=&quot;536870912&quot; )\ncolumn(band=detail id=7 alignment=&quot;1&quot; tabsequence=32766 border=&quot;0&quot; color=&quot;33554432&quot; x=&quot;407&quot; y=&quot;820&quot; height=&quot;76&quot; width=&quot;329&quot; format=&quot;[general]&quot; html.valueishtml=&quot;0&quot;  name=port visible=&quot;1&quot; edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0  font.face=&quot;Arial&quot; font.height=&quot;-10&quot; font.weight=&quot;400&quot;  font.family=&quot;2&quot; font.pitch=&quot;2&quot; font.charset=&quot;0&quot; background.mode=&quot;1&quot; background.color=&quot;536870912&quot; )\ntext(band=detail alignment=&quot;1&quot; text=&quot;Reqtype:&quot; border=&quot;0&quot; color=&quot;33554432&quot; x=&quot;37&quot; y=&quot;956&quot; height=&quot;64&quot; width=&quot;352&quot; html.valueishtml=&quot;0&quot;  name=reqtype_t visible=&quot;1&quot;  font.face=&quot;Arial&quot; font.height=&quot;-10&quot; font.weight=&quot;400&quot;  font.family=&quot;2&quot; font.pitch=&quot;2&quot; font.charset=&quot;0&quot; background.mode=&quot;1&quot; background.color=&quot;536870912&quot; )\ncolumn(band=detail id=8 alignment=&quot;0&quot; tabsequence=32766 border=&quot;0&quot; color=&quot;33554432&quot; x=&quot;407&quot; y=&quot;956&quot; height=&quot;76&quot; width=&quot;4389&quot; format=&quot;[general]&quot; html.valueishtml=&quot;0&quot;  name=reqtype visible=&quot;1&quot; edit.limit=255 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0  font.face=&quot;Arial&quot; font.height=&quot;-10&quot; font.weight=&quot;400&quot;  font.family=&quot;2&quot; font.pitch=&quot;2&quot; font.charset=&quot;0&quot; background.mode=&quot;1&quot; background.color=&quot;536870912&quot; )\ntext(band=detail alignment=&quot;1&quot; text=&quot;Commlink:&quot; border=&quot;0&quot; color=&quot;33554432&quot; x=&quot;37&quot; y=&quot;1092&quot; height=&quot;64&quot; width=&quot;352&quot; html.valueishtml=&quot;0&quot;  name=commlink_t visible=&quot;1&quot;  font.face=&quot;Arial&quot; font.height=&quot;-10&quot; font.weight=&quot;400&quot;  font.family=&quot;2&quot; font.pitch=&quot;2&quot; font.charset=&quot;0&quot; background.mode=&quot;1&quot; background.color=&quot;536870912&quot; )\ncolumn(band=detail id=9 alignment=&quot;0&quot; tabsequence=32766 border=&quot;0&quot; color=&quot;33554432&quot; x=&quot;407&quot; y=&quot;1092&quot; height=&quot;76&quot; width=&quot;4389&quot; format=&quot;[general]&quot; html.valueishtml=&quot;0&quot;  name=commlink visible=&quot;1&quot; edit.limit=255 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0  font.face=&quot;Arial&quot; font.height=&quot;-10&quot; font.weight=&quot;400&quot;  font.family=&quot;2&quot; font.pitch=&quot;2&quot; font.charset=&quot;0&quot; background.mode=&quot;1&quot; background.color=&quot;536870912&quot; )\ntext(band=detail alignment=&quot;1&quot; text=&quot;Nodeaddr:&quot; border=&quot;0&quot; color=&quot;33554432&quot; x=&quot;37&quot; y=&quot;1228&quot; height=&quot;64&quot; width=&quot;352&quot; html.valueishtml=&quot;0&quot;  name=nodeaddr_t visible=&quot;1&quot;  font.face=&quot;Arial&quot; font.height=&quot;-10&quot; font.weight=&quot;400&quot;  font.family=&quot;2&quot; font.pitch=&quot;2&quot; font.charset=&quot;0&quot; background.mode=&quot;1&quot; background.color=&quot;536870912&quot; )\ncolumn(band=detail id=10 alignment=&quot;0&quot; tabsequence=32766 border=&quot;0&quot; color=&quot;33554432&quot; x=&quot;407&quot; y=&quot;1228&quot; height=&quot;76&quot; width=&quot;4389&quot; format=&quot;[general]&quot; html.valueishtml=&quot;0&quot;  name=nodeaddr visible=&quot;1&quot; edit.limit=255 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0  font.face=&quot;Arial&quot; font.height=&quot;-10&quot; font.weight=&quot;400&quot;  font.family=&quot;2&quot; font.pitch=&quot;2&quot; font.charset=&quot;0&quot; background.mode=&quot;1&quot; background.color=&quot;536870912&quot; )\ntext(band=detail alignment=&quot;1&quot; text=&quot;Lastidle:&quot; border=&quot;0&quot; color=&quot;33554432&quot; x=&quot;37&quot; y=&quot;1364&quot; height=&quot;64&quot; width=&quot;352&quot; html.valueishtml=&quot;0&quot;  name=lastidle_t visible=&quot;1&quot;  font.face=&quot;Arial&quot; font.height=&quot;-10&quot; font.weight=&quot;400&quot;  font.family=&quot;2&quot; font.pitch=&quot;2&quot; font.charset=&quot;0&quot; background.mode=&quot;1&quot; background.color=&quot;536870912&quot; )\ncolumn(band=detail id=11 alignment=&quot;1&quot; tabsequence=32766 border=&quot;0&quot; color=&quot;33554432&quot; x=&quot;407&quot; y=&quot;1364&quot; height=&quot;76&quot; width=&quot;329&quot; format=&quot;[general]&quot; html.valueishtml=&quot;0&quot;  name=lastidle visible=&quot;1&quot; edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0  font.face=&quot;Arial&quot; font.height=&quot;-10&quot; font.weight=&quot;400&quot;  font.family=&quot;2&quot; font.pitch=&quot;2&quot; font.charset=&quot;0&quot; background.mode=&quot;1&quot; background.color=&quot;536870912&quot; )\ntext(band=detail alignment=&quot;1&quot; text=&quot;Currtasksw:&quot; border=&quot;0&quot; color=&quot;33554432&quot; x=&quot;37&quot; y=&quot;1500&quot; height=&quot;64&quot; width=&quot;352&quot; html.valueishtml=&quot;0&quot;  name=currtasksw_t visible=&quot;1&quot;  font.face=&quot;Arial&quot; font.height=&quot;-10&quot; font.weight=&quot;400&quot;  font.family=&quot;2&quot; font.pitch=&quot;2&quot; font.charset=&quot;0&quot; background.mode=&quot;1&quot; background.color=&quot;536870912&quot; )\ncolumn(band=detail id=12 alignment=&quot;1&quot; tabsequence=32766 border=&quot;0&quot; color=&quot;33554432&quot; x=&quot;407&quot; y=&quot;1500&quot; height=&quot;76&quot; width=&quot;329&quot; format=&quot;[general]&quot; html.valueishtml=&quot;0&quot;  name=currtasksw visible=&quot;1&quot; edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0  font.face=&quot;Arial&quot; font.height=&quot;-10&quot; font.weight=&quot;400&quot;  font.family=&quot;2&quot; font.pitch=&quot;2&quot; font.charset=&quot;0&quot; background.mode=&quot;1&quot; background.color=&quot;536870912&quot; )\ntext(band=detail alignment=&quot;1&quot; text=&quot;Blockedon:&quot; border=&quot;0&quot; color=&quot;33554432&quot; x=&quot;37&quot; y=&quot;1636&quot; height=&quot;64&quot; width=&quot;352&quot; html.valueishtml=&quot;0&quot;  name=blockedon_t visible=&quot;1&quot;  font.face=&quot;Arial&quot; font.height=&quot;-10&quot; font.weight=&quot;400&quot;  font.family=&quot;2&quot; font.pitch=&quot;2&quot; font.charset=&quot;0&quot; background.mode=&quot;1&quot; background.color=&quot;536870912&quot; )\ncolumn(band=detail id=13 alignment=&quot;1&quot; tabsequence=32766 border=&quot;0&quot; color=&quot;33554432&quot; x=&quot;407&quot; y=&quot;1636&quot; height=&quot;76&quot; width=&quot;329&quot; format=&quot;[general]&quot; html.valueishtml=&quot;0&quot;  name=blockedon visible=&quot;1&quot; edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0  font.face=&quot;Arial&quot; font.height=&quot;-10&quot; font.weight=&quot;400&quot;  font.family=&quot;2&quot; font.pitch=&quot;2&quot; font.charset=&quot;0&quot; background.mode=&quot;1&quot; background.color=&quot;536870912&quot; )\ntext(band=detail alignment=&quot;1&quot; text=&quot;Lockname:&quot; border=&quot;0&quot; color=&quot;33554432&quot; x=&quot;37&quot; y=&quot;1772&quot; height=&quot;64&quot; width=&quot;352&quot; html.valueishtml=&quot;0&quot;  name=lockname_t visible=&quot;1&quot;  font.face=&quot;Arial&quot; font.height=&quot;-10&quot; font.weight=&quot;400&quot;  font.family=&quot;2&quot; font.pitch=&quot;2&quot; font.charset=&quot;0&quot; background.mode=&quot;1&quot; background.color=&quot;536870912&quot; )\ncolumn(band=detail id=14 alignment=&quot;1&quot; tabsequence=32766 border=&quot;0&quot; color=&quot;33554432&quot; x=&quot;407&quot; y=&quot;1772&quot; height=&quot;76&quot; width=&quot;329&quot; format=&quot;[general]&quot; html.valueishtml=&quot;0&quot;  name=lockname visible=&quot;1&quot; edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0  font.face=&quot;Arial&quot; font.height=&quot;-10&quot; font.weight=&quot;400&quot;  font.family=&quot;2&quot; font.pitch=&quot;2&quot; font.charset=&quot;0&quot; background.mode=&quot;1&quot; background.color=&quot;536870912&quot; )\ntext(band=detail alignment=&quot;1&quot; text=&quot;Uncmtops:&quot; border=&quot;0&quot; color=&quot;33554432&quot; x=&quot;37&quot; y=&quot;1908&quot; height=&quot;64&quot; width=&quot;352&quot; html.valueishtml=&quot;0&quot;  name=uncmtops_t visible=&quot;1&quot;  font.face=&quot;Arial&quot; font.height=&quot;-10&quot; font.weight=&quot;400&quot;  font.family=&quot;2&quot; font.pitch=&quot;2&quot; font.charset=&quot;0&quot; background.mode=&quot;1&quot; background.color=&quot;536870912&quot; )\ncolumn(band=detail id=15 alignment=&quot;1&quot; tabsequence=32766 border=&quot;0&quot; color=&quot;33554432&quot; x=&quot;407&quot; y=&quot;1908&quot; height=&quot;76&quot; width=&quot;329&quot; format=&quot;[general]&quot; html.valueishtml=&quot;0&quot;  name=uncmtops visible=&quot;1&quot; edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0  font.face=&quot;Arial&quot; font.height=&quot;-10&quot; font.weight=&quot;400&quot;  font.family=&quot;2&quot; font.pitch=&quot;2&quot; font.charset=&quot;0&quot; background.mode=&quot;1&quot; background.color=&quot;536870912&quot; )\nhtmltable(border=&quot;1&quot; )\nhtmlgen(clientevents=&quot;1&quot; clientvalidation=&quot;1&quot; clientcomputedfields=&quot;1&quot; clientformatting=&quot;0&quot; clientscriptable=&quot;0&quot; generatejavascript=&quot;1&quot; encodeselflinkargs=&quot;1&quot; netscapelayers=&quot;0&quot; )\nexport.xml(headgroups=&quot;1&quot; includewhitespace=&quot;0&quot; metadatatype=0 savemetadata=0 )\nimport.xml()\nexport.pdf(method=0 distill.custompostscript=&quot;0&quot; xslfop.print=&quot;0&quot; )\n<\/pre>\n<p>This nvo is PFC based but doesn&#8217;t have to be.<br \/>\nnvo_dbconncheck<\/p>\n<pre name=\"code\" class=\"VB\">$PBExportHeader$nvo_dbconncheck.sru\nforward\nglobal type nvo_dbconncheck from n_base\nend type\nend forward\n\nglobal type nvo_dbconncheck from n_base\nend type\nglobal nvo_dbconncheck nvo_dbconncheck\n\ntype variables\nulong\tiul_connection\nend variables\n\nforward prototypes\npublic function boolean uf_checkconnection (string a_userid)\npublic subroutine uf_removeconnection ()\nend prototypes\n\npublic function boolean uf_checkconnection (string a_userid);\/\/ this method looks for any connections for the current user.\n\/\/ If there is a connection number for the user, check to see if \n\/\/ it is current.  \n\/\/\n\/\/ If the connection is current, return false since  users are not \n\/\/ allowed to log on multiple times.\n\/\/\n\/\/ If the connection is not current, update the row with the current\n\/\/ connection number.\n\/\/\n\/\/ If there is no connection number, insert the current user and connection\n\/\/ number into the table.\n\/\/\n\n\nboolean lb_return = TRUE\nulong lul_connection_old\nulong\tlul_connection_new\nlong\tll_conrows, ll_connectionrow\ndatastore lds, lds1\n\nIF IsNull(a_userid) OR (a_userid = &#039;&#039;) THEN RETURN FALSE\n\nlds = create datastore\nlds.dataobject = &#039;d_sa_conn_info&#039;\nlds.settransobject(SQLCA)\n\nlds1 = create datastore\nlds1.dataobject = &#039;d_conn_number&#039;\nlds1.settransobject(SQLCA)\n\/\/ is user already connected?\nSELECT max(connectionid)\nINTO :lul_connection_old\nFROM sec_userconnection \nWHERE userid = :gv_userid;\nIF IsNull(lul_connection_old) THEN lul_connection_old = 0\nlb_return = TRUE\n\/\/ current connection number\nll_connectionrow = lds1.retrieve(1)\nIF ll_connectionrow &gt; 0 THEN\n\tiul_connection = long(lds1.getitemstring(ll_connectionrow,&#039;conn_number&#039;))\n\tlb_return = TRUE\nELSE\n\t\/\/ can&#039;t get current connection, exit\n\tMessagebox(&#039;Access Error&#039;,&#039;Unable to determine database connection number!&#039;)\n\tlb_return = FALSE\n\nEND IF\nIF lb_return THEN\n\t\/\/ check if users other connection number is valid (still connected)\n\tIF (lul_connection_old &gt; 0) THEN\n\t\t\/\/ connection valid, user attempting second log on\n\t\tll_conrows = lds.retrieve(lul_connection_old)\n\t\tIF (ll_conrows &gt; 0) THEN\n\t\t\tMessagebox(&#039;Access Error&#039;,&#039;Multiple logons are not permitted!&#039;)\n\t\t\tlb_return = FALSE\n\t\tELSE\n\t\t\t\/\/ old connection not valid (left over from some fatal error)\n\t\t\t\/\/ update with current connection number\n\t\t\tUpdate sec_userconnection\n\t\t\tset connectionid = :iul_connection\n\t\t\tWHERE connectionid = :lul_connection_old\n\t\t\tusing sqlca;\n\t\t\tcommit;\n\t\t\tlb_return = TRUE\n\t\tEND IF\n\tELSE\n\t\t\/\/ no previous connections so create one\n\t\t\/\/ insert record with connection number and user id\n\t\tinsert into sec_userconnection\n\t\tselect :iul_connection, :gv_userid;\n\t\tlb_return = TRUE\n\tEND IF\nEND IF\n\nIF IsValid(lds) THEN DESTROY lds\nIF IsValid(lds1) THEN DESTROY lds1\nRETURN lb_return\n\nend function\n\npublic subroutine uf_removeconnection ();\/\/ delete users connection number from db\n\/\/ so they are not seen as being logged on more than once.\n\ndelete from sec_userconnection\nwhere\tconnectionid = :iul_connection\nUSING SQLCA;\n\ncommit;\nend subroutine\n\nevent constructor;call super::constructor;\/\/ This object used to validate that a user has only one connection to the database\n\/\/ when they launch the application.\nend event\n\non nvo_dbconncheck.create\ncall super::create\nend on\n\non nvo_dbconncheck.destroy\ncall super::destroy\nend on\n<\/pre>\n<p>Create an instance of the nvo on the application object (again this is PFC based) and create in in the constructor event.  In the pfc_close event on the application object insert the following and override the ancestor:<\/p>\n<pre name=\"code\" class=\"VB\">IF ISVALID(inv_conncheck) THEN \n\tinv_conncheck.uf_removeconnection()\n\tDESTROY inv_conncheck\nEND IF\nsuper::EVENT pfc_close()<\/pre>\n<p>In the event where the user logon is validated add the following:<\/p>\n<pre name=\"code\" class=\"VB\">IF (gnv_app.inv_conncheck.uf_checkconnection(gv_userid) = FALSE) THEN\n\/\/ gv_userid is the user id for the application and database\n\tclose(parent)\n\treturn\nEND IF<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This method is used with a SQL Anywhere database to ensure that any given user can only sign on the application once. It uses the connection_property function so make sure you either give the users permission to execute this or set up a separate connection which uses an id which has the permissions. There are&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,25],"tags":[12,16,83],"_links":{"self":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts\/189"}],"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=189"}],"version-history":[{"count":12,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts\/189\/revisions"}],"predecessor-version":[{"id":1755,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts\/189\/revisions\/1755"}],"wp:attachment":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/media?parent=189"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/categories?post=189"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/tags?post=189"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}