Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides
New in version: 5.4   6.0   6.1   6.2   6.3   6.4   6.5   7.0   7.1   7.2    Statistic  


Sets a string value of a specific connection or command option.

Component: SQL
Version: 2.6
Mac OS X: Yes
Windows: Yes
Server: Yes
FileMaker Cloud: Yes

MBS( "SQL.SetConnectionOption"; Connection; Key; Value )


Parameter Description Example value
Connection The connection reference number gained with SQL.NewConnection. $Connection
Key A string key of the connection or command option. ""
Value The new option value. ""


Returns "OK" or error message.


Sets a string value of a specific connection or command option.

Call this method to set value(s) of server specific connection or command options. See Server specific notes.
SetOption method is safe to use in cross-server applications. An option related to a particular server does not affect others.

see also:


Set Oracle client library path:

MBS( "SQL.SetConnectionOption"; $Connection; "OCI8.LIBS"; "c:\Oracle\oci.dll" )

Set Microsoft SQL Server client database provider:

MBS( "SQL.SetConnectionOption"; $Connection; "UseAPI"; "OLEDB" )
MBS( "SQL.SetConnectionOption"; $Connection; "SQLNCLI.LIBS"; "sqlsrv32.dll" )

Set Sybase Database libraries:

MBS( "SQL.SetConnectionOption"; $Connection; "SYBINTL.LIBS"; "/sybase/" )
MBS( "SQL.SetConnectionOption"; $Connection; "SYBCOMN.LIBS"; "/sybase/" )
MBS( "SQL.SetConnectionOption"; $Connection; "SYBTCL.LIBS"; "/sybase/" )
MBS( "SQL.SetConnectionOption"; $Connection; "SYBCT.LIBS"; "/sybase/" )
MBS( "SQL.SetConnectionOption"; $Connection; "SYBCS.LIBSS"; "/sybase/" )

Set MySQL library:

# Windows
Set Variable [ $r; MBS( "SQL.SetConnectionOption"; $Connection; "MYSQL.LIBS"; "c:\MySQL\libmySQL.dll" ) ]
# Mac OS X
Set Variable [ $r; MBS( "SQL.SetConnectionOption"; $Connection; "MYSQL.LIBS"; "/test/libmysqlclient.16.dylib" ) ]

Set DB2 libraries:

MBS( "SQL.SetConnectionOption"; $Connection; "DB2CLI.LIBS"; "c:\DB2\db2cli.dll" )

Set Informix libraries:

MBS( "SQL.SetConnectionOption"; $Connection; "INFCLI.LIBS"; "c:\Informix\ICLIT09B.DLL" )

Set InterBase/Firebird libraries:

MBS( "SQL.SetConnectionOption"; $Connection; "IBASE.LIBS"; "c:\Firebird\fbclient.dll" )

Set SQLBase libraries:

MBS( "SQL.SetConnectionOption"; $Connection; "SQLBASE.LIBS"; "c:\SQLBase\sqlwntm.dll" )

Set PostgreSQL libraries:

MBS( "SQL.SetConnectionOption"; $Connection; "LIBPQ.LIBS"; "/usr/lib/libpq.dylib" )

Set ODBC libraries:

MBS( "SQL.SetConnectionOption"; $Connection; "ODBC.LIBS"; "odbc32.dll" )

Set SQLite libraries:

MBS( "SQL.SetConnectionOption"; $Connection; "SQLITE.LIBS"; "/usr/lib/libsqlite3.dylib" )

For SQLite, set flag to open database file read only:

MBS( "SQL.SetConnectionOption"; $Connection; "SQLiteVFSFlags"; "1")

Set MySQL Timeouts:

MBS( "SQL.SetConnectionOption"; $Connection; "MYSQL_OPT_CONNECT_TIMEOUT"; 10 )
MBS( "SQL.SetConnectionOption"; $Connection; "MYSQL_OPT_READ_TIMEOUT"; 10 )
MBS( "SQL.SetConnectionOption"; $Connection; "MYSQL_OPT_WRITE_TIMEOUT"; 10 )

Connect to Microsoft SQL Server from Mac via FreeTDS library:

Set Variable [$Connection; Value:MBS("SQL.NewConnection")]
#Tell plugin we want to use Microsoft SQL Server via ODBC
Set Variable [$result; Value:MBS("SQL.SetClient"; $Connection; "ODBC")]
#Tell plugin where freetds library is
Set Variable [$result; Value:MBS( "SQL.SetConnectionOption"; $Connection; "ODBC.LIBS"; "/Users/cs/Desktop/libtdsodbc.dylib")]
#Connect to database
Set Variable [$result; Value:MBS("SQL.Connect"; $Connection; "DRIVER={FREETDS};Server=;UId=SA;PWD=test;Database=test;TDS_VERSION=7.2;Port=1433")]
# or TDS_VERSION=8.0;
If [$result  ≠  "OK"]
    Show Custom Dialog ["Error: " & $result]
    Set Variable [$result; Value:MBS("SQL.FreeConnection"; $Connection)]
    Halt Script
End If

Set an option we need for ODBC to FileMaker:

MBS( "SQL.SetConnectionOption"; $Command; "ODBCAddLongTextBufferSpace"; "false" )

// newer plugins automatically set it right when connecting to FileMaker

The MySQL SSL Cipher:

MBS( "SQL.SetConnectionOption"; $Connection; "MYSQL_SSL_CIPHER"; "DHE-RSA-AES256-SHA" )

See also

SQL.SetCommandText   -   SQL.SetConnectionTag

Feedback: Report problem or ask question.

MBS Real Studio Plugins - Pfarrgemeinde Ministranten Nickenich