The way you execute the SET TEMPORARY OPTION statement that sets the authentication option depends on the programming interface you are using. The signatures listed here are not valid signatures. Examples are provided for setting the authentication option using the following interfaces:
If your company name has quotation marks, apostrophes, or other special characters (for example, Joe's Garage) you need to be careful about how you construct the authentication statement. The entire set of authentication options (Company=...;Application=...;Signature=...) is a SQL string. The rules for strings in SQL dictate that if you include a quotation mark inside the string, it must be doubled to be accepted. For example:
SET TEMPORARY OPTION connection_authentication= 'Company = Joe''s Garage; Application = Joe''s Program; Signature = 0fa55157edb8e14d818e...'; |
Use the following statement:
SQLExecDirect( hstmt, "SET TEMPORARY OPTION connection_authentication= 'Company=MyCo; Application=MyApp; Signature=0fa55159999e14d818e...';", SQL_NTS ); |
The string must be entered on a single line, or you must build it up by concatenation.
Use the following PowerScript statement:
EXECUTE IMMEDIATE "SET TEMPORARY OPTION connection_authentication= 'Company=MyCo; Application=MyApp; Signature=0fa551599998e14d818e...';" USING SQLCA |
Use the following statement:
Statement Stmt1 = con.createStatement(); Stmt1.executeUpdate( "SET TEMPORARY OPTION connection_authentication= 'Company=MyCo; Application=MyApp; Signature=0fa55159999e14d818e...';" ); |
The string must be entered on a single line, or you must build it up by concatenation.
Use the following statement:
SACommand cmd=new SACommand( "SET TEMPORARY OPTION connection_authentication= 'Company=MyCo; Application=MyApp; Signature=0fa551599998e14d818e...';", con ); cmd.ExecuteNonQuery(); |
The string must be entered on a single line, or you must build it up by concatenation.
Use the following statement: EXEC SQL SET TEMPORARY OPTION connection_authentication= 'Company=MyCo; Application=MyApp; Signature=0fa551599998e14d818e...'; |
The string must be entered on a single line, or you must build it up by concatenation.
When connecting to an authenticated database, the connection and authentication steps are performed separately. However, some objects, such as the Visual Basic Grid object can attempt a separate, implicit connection, which does not automatically include authentication. In such cases, the connection is not authenticated and the database operation can fail. You can avoid this problem by including the InitString connection parameter in the connection string. The following example illustrates how you can modify a Visual Basic application to include the InitString connection parameter so that every connection is immediately followed by authentication:
mConnectionString = "Provider=SAPROV.11; UID=DBA; PWD=sql; ENG=test11; InitString=SET TEMPORARY OPTION connection_authentication= 'Company=MyCo; Application=MyApp; Signature=0fa55157edb8e14d818e...'" mdbName.ConnectionString = mConnectionString mdbName.Open mIsSQL = True |
Send feedback about this page via email or DocCommentXchange | Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0 |