Announcement

Collapse
No announcement yet.

program won't run from a batch file

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #21
    Originally posted by Chris Holbrook View Post
    Maybe the ODBC driver is an oldie too. ODBC drivers were not exactly reliable when I first made their acquaintance in the 90s.

    Which version of ODBC does the driver implement?
    CONNX 10.5 is what I use. v13 is the most current.
    Dataflex DF32 does not have a native SQL driver, or native SQL ability, afaik.

    Comment


    • #22
      "CONNX works by accepting SQL commands through the ODBC interface, then converting those calls to navigational commands to the DataFlex DBMS and returning record sets that qualify for the query results. This driver is not a Client/Server product, and navigates the data files directly."

      Whatever that means. I read it as "DataFlex 3.2 doesn't natively do SQL"

      Comment


      • #23
        Originally posted by Shawn Anderson View Post
        "CONNX works by accepting SQL commands through the ODBC interface, then converting those calls to navigational commands to the DataFlex DBMS and returning record sets that qualify for the query results. This driver is not a Client/Server product, and navigates the data files directly."

        Whatever that means. I read it as "DataFlex 3.2 doesn't natively do SQL"
        Correct. Dataflex uses its own proprietary "4GL" language.
        Based on the last bit of that quote, it doesn't use Datraflex's DFQuery engine to retrieve the data.

        It accepts an ODBC connection, receives SQL commands and pulls the requested data directly from the Dataflex data and index tables without going through the DFQuery engine. How well it does that appears to be debatable .


        CONNX seems very similar to FlexODBC - the FlexODBC site has exactly the same wording

        http://www.flextools.com/flexodbc
        "FlexODBC works by accepting SQL commands through the ODBC interface, then converting those calls to navigational commands to the DataFlex DBMS and returning record sets that qualify for the query results. This driver is not a Client/Server product, and navigates the data files directly."
        --
        [URL="http://www.camcopng.com"]CAMCo - Applications Development & ICT Consultancy[/URL][URL="http://www.hostingpng.com"]
        PNG Domain Hosting[/URL]

        Comment


        • #24
          have you ever used FlexODBC?

          Comment


          • #25
            Originally posted by Shawn Anderson View Post

            CONNX 10.5 is what I use. v13 is the most current.
            Dataflex DF32 does not have a native SQL driver, or native SQL ability, afaik.
            I don't think there is an ODBC version > 4.

            Comment


            • #26
              Originally posted by Chris Holbrook View Post

              I don't think there is an ODBC version > 4.
              I mean 10.5 version of CONNX, not ODBC

              Comment


              • #27
                CONNX seems very similar to FlexODBC - the FlexODBC site has exactly the same wording .... "FlexODBC works by accepting SQL commands through the ODBC interface, then converting those calls to navigational commands.."
                Um, er... It's not all that surprising they sound alike...because that's what ODBC drivers DO!

                Michael Mattias
                Tal Systems Inc.
                Racine WI USA
                mmattias@talsystems.com
                http://www.talsystems.com

                Comment


                • #28
                  Originally posted by Michael Mattias View Post

                  Um, er... It's not all that surprising they sound alike...because that's what ODBC drivers DO!
                  Not necessarily true. A lot of ODBC drivers interface to the DBMS, not to the data files. (You need SQL Server to be running on the server for the SQLServer ODBC driver to work. You point the Driver to the Server instance, not to the location of the data files.).

                  The driver(s) in question don't require a DBMS to be running anywhere, they access the Dataflex data and index files directly

                  And they don't just "sound alike". The wording is identical. That IS surprising if they are different products by different companies.
                  --
                  [URL="http://www.camcopng.com"]CAMCo - Applications Development & ICT Consultancy[/URL][URL="http://www.hostingpng.com"]
                  PNG Domain Hosting[/URL]

                  Comment


                  • #29
                    A lot of ODBC drivers interface to the DBMS, not to the data files
                    Huh?

                    An ODBC driver accepts commands (including "execute SQL statement") in the official ODBC format and does - opaquely - whatever it needs to do to match the command n the target database regardless of DBMS structure. HOW it does it or EXACTLY what it does are immaterial.

                    Some drivers may require a service be running ( Oracle; SQL/Server); others don't and access data storage (files) directly (MS-Access).

                    But I'll buy the "identical wording" as an... er, "interesting" observation.
                    '
                    Michael Mattias
                    Tal Systems Inc.
                    Racine WI USA
                    mmattias@talsystems.com
                    http://www.talsystems.com

                    Comment


                    • #30
                      This is rearing it's ugly head again.
                      I'm pretty sure the problem is a corruption in the dataflex table. I'm going to get somebody to re-index that for me and try again.
                      Same problem: program runs from the IDE (I'm using JellyFish), but not from the command line EXE.

                      Comment


                      • #31
                        Same problem: program runs from the IDE (I'm using JellyFish), but not from the command line EXE.
                        Code not shown but I got half a buck says THAT is some kind of relative path issue.
                        Michael Mattias
                        Tal Systems Inc.
                        Racine WI USA
                        mmattias@talsystems.com
                        http://www.talsystems.com

                        Comment


                        • #32
                          MCM I was just going to post something similar but don't have all my marbles found.
                          In using the OS START command. You can provide a directory for the program to run in
                          Shawn. Show us the batch file
                          p purvis

                          Comment


                          • #33
                            Code:
                            c:
                            cd\bas_src\cc\dataFlex
                            towerEmails.exe
                            exit /B 0
                            Admin privileges, virus checker, out of environment space only in command environment , needs manifest?
                            Won't run even when the current directory is correct from command prompt.
                            Nightmare if corrupted registry entry (reinstalling might update needed entry.)
                            Last edited by Mike Doty; 6 Jun 2017, 10:22 AM.

                            Comment


                            • #34
                              It's the same error if I manually navigate to the EXE folder and run it from the command line.

                              Comment


                              • #35
                                Originally posted by Mike Doty View Post
                                [code]
                                Admin privileges
                                I ran from command line using admin privileges, and it worked....I'll do some more testing

                                Comment


                                • #36
                                  nope... now it works everywhere. This isn't a normal problem LOL

                                  Comment


                                  • #37
                                    I ran from command line using admin privileges, and it worked....I'll do some more testing


                                    > .nope... now it works everywhere. This isn't a normal problem LOL

                                    Does nope mean it is still an issue?
                                    Last edited by Mike Doty; 6 Jun 2017, 12:39 PM.

                                    Comment


                                    • #38
                                      here is a program that i use to run programs from an administrator account
                                      here is the command line I use
                                      superdo /C administratorpassword "c:\directory\programname.exe"
                                      I mostly use this program with a program that sets the computer date and time immediately on a computer in a batch file that run when the computer is logged in by a user account.
                                      I have used this program with other programs like services.msc, gpedit.msc, and registry.exe when i do not want to log in as an administrator.
                                      Of course my password is in plain view.
                                      I do not use the START command while running this program SUPERDO.
                                      One of the senior forum helped me with this some years ago in 2012 but I do not remember.

                                      I suggest when using the START command in a batch file, that you check to see if the file exist like
                                      IF EXIST C:\DIRECTORY\MYPROGRAM.EXE START C:\DIRECTORY\MYPROGRAM.EXE
                                      or
                                      IF EXIST C:\DIRECTORY\MYBATCHROUTINE.BAT START C:\DIRECTORY\MYBATCHROUTINE.BAT
                                      I just recently started having problems loading NUANCE DRAGON using the START command and found out that I needed to provide a startup directory location when using START for the software Dragon.
                                      No Dragon does not need administrator rights, I was just trying to be helpful to Shawn in the case he needed to that info on startup directory.

                                      Code:
                                      'RUNASADMIN.BAS
                                      'complied with pbcc 5.05
                                      '
                                      '#COMPILE EXE  "RUNASADMIN.EXE"
                                      #COMPILE EXE  "SUPERDO.EXE"
                                      
                                      %USEMACROS = 1
                                      #INCLUDE "win32api.inc"
                                      
                                      DECLARE FUNCTION CreateProcessWithLogon LIB "ADVAPI32.DLL" ALIAS "CreateProcessWithLogonW" ( _
                                         BYVAL lpUsername AS DWORD, _
                                         BYVAL lpDomain AS DWORD, _
                                         BYVAL lpPassword AS DWORD, _
                                         BYVAL dwLogonFlags AS DWORD, _
                                         BYVAL lpApplicationName AS DWORD, _
                                         BYVAL lpCommandLine AS DWORD, _
                                         BYVAL dwCreationFlags AS DWORD, _
                                         BYVAL lpEnvironment AS DWORD, _
                                         BYVAL lpCurrentDirectory AS DWORD, _
                                         lpStartupInfo AS STARTUPINFO, _
                                         lpProcessInfo AS PROCESS_INFORMATION) AS LONG
                                      
                                      %LOGON_WITH_PROFILE = &H1
                                      
                                      FUNCTION WinErrorMsg (BYVAL ECode AS LONG) AS STRING
                                         LOCAL Buffer AS ASCIIZ * 255
                                         FormatMessage %FORMAT_MESSAGE_FROM_SYSTEM, BYVAL %NULL, ECode, %NULL, buffer, SIZEOF(buffer), BYVAL %NULL
                                         FUNCTION = FORMAT$(ECode, "##### ") & Buffer
                                      END FUNCTION
                                      
                                      
                                      FUNCTION PBMAIN
                                          LOCAL COMMANDLINE AS STRING
                                          LOCAL ADMINPASSWORD AS STRING
                                          LOCAL FINALCOMMANDLINE AS STRING
                                          LOCAL I AS LONG
                                          LOCAL SHELLMODE AS STRING
                                          LOCAL UserName         AS STRING
                                          LOCAL Domain           AS STRING
                                          LOCAL Passw            AS STRING
                                          LOCAL ApplicationName  AS STRING
                                          LOCAL Cmd              AS STRING
                                          LOCAL j AS LONG
                                          LOCAL lpStartupInfo AS STARTUPINFO, ProcessInfo AS PROCESS_INFORMATION
                                          LOCAL K AS LONG
                                          LOCAL DEFINEUSERNAME AS STRING
                                      
                                          COMMANDLINE=TRIM$(COMMAND$)
                                          SHELLMODE="/C"
                                          IF UCASE$(LEFT$(COMMANDLINE,2))="/C" OR UCASE$(LEFT$(COMMANDLINE,2))="/K" THEN
                                             SHELLMODE=UCASE$(LEFT$(COMMANDLINE,2))
                                             COMMANDLINE=TRIM$(RIGHT$(COMMANDLINE+" ",LEN(COMMANDLINE)-2))
                                          END IF
                                          I=INSTR(COMMANDLINE," ")
                                          IF I=0 THEN EXIT FUNCTION
                                          STDOUT COMMANDLINE
                                          WAITKEY$
                                          COMMANDLINE=" "+COMMANDLINE+" "
                                          I=INSTR(UCASE$(COMMANDLINE)," UN:")
                                          IF I THEN
                                                 INCR I
                                                 FOR J=I TO LEN(COMMANDLINE)
                                                 IF MID$(COMMANDLINE,J,1)=" " THEN
                                                     DEFINEUSERNAME=MID$(COMMANDLINE,I,J-I+1)
                                                     COMMANDLINE=REMOVE$(COMMANDLINE,DEFINEUSERNAME)
                                                     DEFINEUSERNAME=TRIM$(DEFINEUSERNAME)
                                                     IF DEFINEUSERNAME=UCASE$("UN:")  THEN
                                                         DEFINEUSERNAME=""
                                                         ELSE
                                                         DEFINEUSERNAME=RIGHT$(DEFINEUSERNAME,(LEN(DEFINEUSERNAME)-3))
                                                     END IF
                                                     EXIT FOR
                                                 END IF
                                                 NEXT J
                                          END IF
                                      
                                          COMMANDLINE=TRIM$(COMMANDLINE)
                                          ADMINPASSWORD=LEFT$(COMMANDLINE,I-1)
                                          FINALCOMMANDLINE=TRIM$(RIGHT$(COMMANDLINE,LEN(COMMANDLINE)-I))
                                          IF LEN(FINALCOMMANDLINE)=0 THEN EXIT FUNCTION
                                          REPLACE $DQ WITH "" IN FINALCOMMANDLINE
                                          FINALCOMMANDLINE=$DQ+TRIM$(FINALCOMMANDLINE)+$DQ
                                      
                                      
                                       '   UserName         = UCODE$("administrator") '<==== change here
                                          IF LEN(DEFINEUSERNAME)>0 THEN Username=UCODE$(DEFINEUSERNAME)
                                          IF LEN(username)=0 THEN UserName         = UCODE$(CHR$(97,100,109,105,110,105,115,116,114,97,116,111,114))
                                          STDOUT username
                                          STDOUT STR$(LEN(username))
                                          STDOUT commandline
                                          STDOUT finalcommandline
                                      
                                          WAITKEY$
                                      
                                          Domain           = UCODE$(".")             '<==== change here
                                      
                                          'Passw            = UCODE$("adminpassword")       '<==== change here
                                          Passw            = UCODE$(ADMINPASSWORD)          '<==== change here
                                      
                                          'ApplicationName  = UCODE$(ENVIRON$("COMSPEC"))    '<==== change here
                                          ApplicationName  = UCODE$(ENVIRON$(CHR$(67,79,77,83,80,69,67)))    '<==== change here
                                      
                                          'Cmd              = UCODE$(" /K ") & UCODE$(COMMAND$)    '<==== change here
                                          'Cmd              = UCODE$(" /C ") & UCODE$(COMMAND$)    '<==== change here
                                          Cmd              = UCODE$(" "+Shellmode+" ") & UCODE$(FINALCOMMANDLINE)    '<==== change here
                                      
                                          lpStartupInfo.cb = SIZEOF(lpStartupInfo)
                                          lpStartupInfo.dwFlags = 0&
                                          lpStartupInfo.wShowWindow = %SW_MINIMIZE
                                      
                                          j = CreateProcessWithLogon( _
                                            STRPTR(UserName), _
                                            STRPTR(Domain), _
                                            STRPTR(Passw), _
                                            %LOGON_WITH_PROFILE, _
                                            STRPTR(ApplicationName), _
                                            STRPTR(Cmd), _
                                            %CREATE_DEFAULT_ERROR_MODE OR %CREATE_NEW_CONSOLE OR %CREATE_NEW_PROCESS_GROUP, _
                                            0&, _
                                            0&, _
                                            lpStartupInfo, _
                                            ProcessInfo)
                                      
                                         IF j THEN
                                            CloseHandle ProcessInfo.hThread
                                            CloseHandle ProcessInfo.hProcess
                                         ELSE
                                          ' j = GetLastError()
                                          ' STDOUT WinErrorMsg(j)
                                         END IF
                                      END FUNCTION
                                      Last edited by Paul Purvis; 6 Jun 2017, 05:57 PM.
                                      p purvis

                                      Comment


                                      • #39
                                        I'd run an ODBC trace (as opposed to a SQL Tools trace). That would log the entry/exit times of all of the ODBC APIs that are called by your program, and if an ODBC trace file ends with "entering API xxx" you know it's a driver issue or something along that line. I'd also try a SQL Tools trace, it might produce clues.

                                        Problem is, your problem seems to be "fragile" (folders, SLEEPs, etc) so adding the overhead of the trace may keep it from failing in trace mode. Only one way to find out.
                                        "Not my circus, not my monkeys."

                                        Comment


                                        • #40
                                          Post 35 says working from Admin command prompt
                                          Post 36 Says, nope now works everywhere.

                                          If it isn't working adding a TowerEmails.exe.manifest might help. Does it shows up anywhere in logs?

                                          Comment

                                          Working...
                                          X