Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CRTSQLCI - precompile error on SQL CONNECT

Status
Not open for further replies.

SkiLift

Programmer
Dec 18, 2003
47
US
Does anyone know why the code below compiles ok on v4r2 but does not compile on v5r1? The error msg is below the code.

It seems to require a USING clause now, when before it did not. BTW, the last else stmt passes compile, ie, you can connect without a user or pw, so the security reason does not make sense.

Code:
SqlConnect:
        EXEC SQL WHENEVER SQLERROR goto SqlCleanup;

        if (gServerName[0] != '\0)
        {
            /* Explicit Connection */
            if (gPassword[0] != '\0')
            {
                EXEC SQL CONNECT TO :gServerName 
                USER :gUserName 
                USING :gPassword;
            }
            else if (gUserName[0] != '\0')
            {
                EXEC SQL CONNECT TO :gServerName 
                USER :gUserName; /* <-- error here */
            }
            else
            {
                EXEC SQL CONNECT TO :gServerName;
            }
        }
        else
        {
            /* Implicit Connection */
            lRetVal = eConnRetCdNone;
        }

    }
                                              DIAGNOSTIC MESSAGES               
 MSG ID  SEV  RECORD  TEXT                                                      
 SQL0104  30     111  Position 32 Token <END-OF-STATEMENT> was not valid.       
                      Valid tokens: USING.
Message Summary                 
 Total    Info    Warning    Error    Severe    Terminal                        
     1      0         0         0         1          0                          
 30 level severity errors found in source                                       
   341 Source records processed                                                 
                                * * * * *  E N D  O F  L I S T I N G  * * * * * 
                                                    LPAR3 - C10608ZM
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top