• Welcome, Guest. Please login.
 
November 21, 2019, 03:47:10 pm

News:

Welcome to the SQLitening support forums!


Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - cj

736
Refreshing the FACT does not disconnect clients (which is very cool.) :D
Tried several times while changing timeout.
737
SQLiteningServer.log
111022102117 Dcon #16317 TimeOut

If nothing is sent to server within timeout period error 18's appear (as they should) on client.

738
I have a program for processing statements that works great, but wondered
if I am dropping recordsets which mix statements with SELECT statements.
All calls are using remote server.


BEGIN;
DROP TABLE IF EXISTS CLIENT;
CREATE TABLE IF NOT EXISTS CLIENT (NUMBER);
INSERT INTO CLIENT VALUES("HOW");
INSERT INTO CLIENT VALUES("NOW");
INSERT INTO CLIENT VALUES("BROWN");
INSERT INTO CLIENT VALUES("COW");
SELECT * FROM CLIENT;
END;


If the above code does return a recordset, I'm not processing it.
Perhaps more code is needed in my function executor below.
If a recordset is not processed, what happens the next time a recordset is returned?


FUNCTION Execute(OPTIONAL sTemp AS STRING) AS LONG
  LOCAL COL, columns, result AS LONG,s, sRow AS STRING

  IF VARPTR(sTemp) THEN 'passing something so skip reading from dialog
     s = LTRIM$(sTemp,ANY CHR$(0 TO 32))
  ELSE
    CONTROL GET TEXT ghDlg, %TEXTBOX1 TO s 'get text
    s = LTRIM$(s,ANY CHR$(0 TO 32))
    'CONTROL SET TEXT ghDlg, %TEXTBOX1, s  'put stripped string back into textbox

    IF LEN(s) = 0 THEN
      'nothing in dialog so add a select statement
      CONTROL GET TEXT ghDlg, %TEXTBOX2 TO s
      CONTROL SET TEXT ghDlg, %TEXTBOX1, "SELECT * FROM " + s
      EXIT FUNCTION
    END IF
  END IF

  IF UCASE$(LEFT$(s,7))= "SELECT " THEN
    IF slSel(s) THEN
      DisplayError
      FUNCTION = slGetErrorNumber
      EXIT FUNCTION  'select error
    END IF
  ELSEIF slEXE(s) THEN
      DisplayError
      FUNCTION = slGetErrorNumber
      EXIT FUNCTION 'other statment error
  END IF

  'LISTBOX RESET ghDlg, %LISTBOX
  LISTBOX ADD ghDlg, %LISTBOX, STRING$(60,"-")
  IF ISFALSE slGetRow THEN
    LISTBOX ADD ghDlg,%LISTBOX,"Success, but nothing to return"
    EXIT FUNCTION
  END IF

  columns = SlGetColumnCount
  IF columns=0 THEN
    ? "No columns"
    FUNCTION = slGetErrorNumber
    EXIT FUNCTION
  END IF

  DIM rowcount AS LONG
  DO
    INCR rowcount
    sRow= FORMAT$(rowcount) + "   "
    FOR COL = 1 TO columns
      sRow = sRow + slF(COL)+ $Delimiter
    NEXT
    LISTBOX ADD ghDlg, %LISTBOX, LEFT$(sRow,LEN(sRow)-1)
  LOOP WHILE slGetRow

  REM Listbox1.ListIndex = Listbox1.ListCount - 1  'VB6 way
  LOCAL ListboxCount AS LONG
  LISTBOX GET COUNT ghDlg, %LISTBOX TO ListboxCount
  LISTBOX SELECT    ghDlg, %LISTBOX,   ListboxCount
  LISTBOX UNSELECT  ghDlg, %LISTBOX,   ListboxCount
  'CONTROL HANDLE  ghDlg, %LISTBOX TO hList
  'ListboxCount = SendMessage(hList, %LB_GETCOUNT,  0, 0) 'Ask listbox for items count
  'SendMessage hList, %lb_setcaretindex, ListboxCount+1, 0  'yay!!
END FUNCTION

                           

739
No newer version than 1.53 at this time.  10/22/2011
740
ConnectionTimeOut = Number Minutes --- Control the number of minutes the server will wait to receive a message from an active connection.  Default is 30. Set to -1 if you want to never timeout.

Have you tried setting ConnectionTimeOut to -1  in SqliteningServer.Cfg
Is the server software up to date, size 125,440 bytes?

Don't test here with XP.


741
%SQLitening_SendOrReceiveError  = -18 - Error sending or receiving message"
742
Do you write a SQL statement to replace each Tsunami or Btrieve call statement or is there a more universal  way or function that could be used?   

743
I hear ya.  If anyone is interested, I will add them and put into a separate file.
I don't want to modify the original source to cause any problem when updating.
I have been running non-stop for days and have never seen the server lockup.
I would make some suggestions, but for security reasons will not do them here.
744
Recently had trouble connecting from another folder.
It turned out to be an outdated SQLiteningClient.DLL attempting to access newer software on the server.
Looking in SQLiteningServer.Log showed "Eror First request not Connect" so it was at least getting there.

Fredrick,
Curious, what was the problem?

745
It was only a suggestion to use the same include files and dll files.
SQLiteningS.Inc and SQLiteningS.dll would not be needed with VB6.


746
Fred,
Hope you consider this method so the same code is shared with PB and VB.


#IF 0
FUNCTION slConnect ALIAS "slConnect" (OPTIONAL BYVAL rsServer AS STRING, _
                                      OPTIONAL BYVAL rlPort AS LONG, _
                                      OPTIONAL BYVAL rsModChars AS STRING, _
                                      OPTIONAL wsOutData AS STRING)EXPORT AS LONG
#ENDIF

FUNCTION slConnect ALIAS "slConnect" (OPTIONAL rsServerTemp     AS STRING, _
                                      OPTIONAL BYVAL rlPort     AS LONG, _
                                      OPTIONAL rsModCharsTemp   AS STRING, _
                                      OPTIONAL wsOutDataTemp    AS STRING) EXPORT AS LONG

  LOCAL rsServer,rsModChars,wsOutData AS STRING
  IF VARPTR(rsServerTemp)   THEN rsServer    = rsServerTemp
  IF VARPTR(rsModCharsTemp) THEN rsModChars  = rsModCharsTemp
  IF VARPTR(wsOutDataTemp)  THEN wsOutData   = wsOutDataTemp
.
.
   ' Set returning data
      REM IF ISFALSE ISMISSING(wsOutData) THEN wsOutData = lsA
      wsOutData = lsA
   
                                                                     
747
TCP  Open failed.
IPCONFIG at a command prompt on server and see if an IP address changed or firewall started blocking?
Somebody changed SQLiteningServer.CFG the Port line or the Hosts line?
Just brainstorming.
Check SQLiteningServer.log and see if any strange entries at the bottom.
Router, server and modem need to be restarted.
See if server can be restarted through control panel, admin, computer management ...
748
1) If BYVAL is removed from calls with strings then VB6 could use the same calls as PowerBASIC.
Example:

FUNCTION slConnect ALIAS "slConnect" (OPTIONAL rsServerTemp AS STRING, _
                                      OPTIONAL BYVAL rlPort AS LONG, _
                                      OPTIONAL rsModChars AS STRING, _
                                      OPTIONAL wsOutData AS STRING)Export AS LONG
    LOCAL rsServer AS STRING
    rsServer = rsServerTemp         
END FUNCTION


Trival, but while testing with VB6 found this:
If a connection fails
result = slGetFile(sFile,sData,"E1") will terminate program
One solution is to just use slSetProcessMods "E1"

Passing a nul or "" instead of using OPTIONAL would not be a problem for me.
I actually prefer it because then the options are always right there.

With the modication to Sqlitening.Bas in slConnect above this works fine with VB6.
This eliminates the need for SQLiteningS.dll  with this little VB6 test program.

Declare Function slGetFile Lib "SQLitening.Dll" (ByRef rsFileName As String, ByRef wsFileData As String, Optional ByRef rsModChars As String) As Long
Declare Function slConnect Lib "SQLitening.Dll" (Optional rsServer As String, Optional ByVal rlPort As Long, Optional ByRef rsModChars As String, Optional ByRef wsDataOut As String) As Long
Declare Sub slDisconnect Lib "SQLitening.Dll" ()
Sub Main()
  result& = slConnect("192.168.1.2", 51234)
  result& = slGetFile("RemoteFileUploadDownloadExample.txt", sData$)
  slDisconnect
  MsgBox Str$(Len(sData$)) + " bytes"
End Sub


A more complete VB6 example handling all errors without terminating in environment
Requires SQLitening.DLL and SQLiteningClient.DLL


Option Explicit '#DIM ALL in PowerBASIC
'Sqlitening declares
Declare Sub slSetProcessMods Lib "SQLitening.Dll" (ByRef rsModChars As String)
Declare Function slGetFile Lib "SQLitening.Dll" (ByRef rsFileName As String, ByRef wsFileData As String, Optional ByRef rsModChars As String) As Long
Declare Function slConnect Lib "SQLitening.Dll" (Optional rsServer As String, Optional ByVal rlPort As Long, Optional ByRef rsModChars As String, Optional ByRef wsDataOut As String) As Long
Declare Sub slDisconnect Lib "SQLitening.Dll" ()
Declare Function slGetError Lib "SQLitening.Dll" () As String
Declare Sub apiSleep Lib "KERNEL32.DLL" Alias "Sleep" (ByVal Milliseconds As Long)
'Constants to download
Const Ip As String = "192.168.1.2"  'Change 1 of 2
Const PortNumber As Long = 51234    'Change 2 of 2
Const sFile      As String = "RemoteFileUploadDownloadExample.txt"
'Main entry point
Sub Main()
  ReadFileOnServer
End Sub
Sub ReadFileOnServer()
  On Error Resume Next                 'an invalid might be returned by chdir
  Dim sData As String, result As Long  'define variables
  ChDir App.Path                       'useful if program in a temp folder or using VB6 environment
  slSetProcessMods "E0"                'E0=do not allow ExitProcess to terminate VB6 environment
  result = slConnect(Ip, PortNumber)   'attempt connection on local ip,  0=success
  If result = 0 Then                   'success
    result = slGetFile(sFile, sData$)  'attempt getting file, 0=success
    If result = 0 Then                 'success
      MsgBox Format$(Len(sData), "##,###,###,### bytes returned.") 'display bytes returned
    Else                               '
      MsgBox slGetError                'error, unable to get file
    End If                              '
    slDisconnect                       'disconnect if we connected
  Else                                 '
    MsgBox slGetError                  'error, unable to connect
  End If
End Sub








749
Works great!
Running many processes with many threads and unable to cause a problem.
750
Just installed 1.53.