RISE to Bloome Software
Log In    
Home
RISE
Marshal
Download
 
 
r2bsoftware.se r2bsoftware.se
 
 
 
Click to hide navigation tree

Database Connection Strings


ODBC Data Sources

For ODBC it's generally a good idea to specify the connection information as a Data Source (System DSN) on the computer. This reduces connection string complexity and hides sensitive info such as passwords. How to create a System DSN differs from database to database. However, the starting point is always the same, select Start menu | Administrative Tools | Data Sources (ODBC) to create your DSN. The connection string needed to use a DSN is:
DSN=myDataSourceName;
To point out another database than the one configured for the data source:
DSN=myDataSourceName;DATABASE=myDatabase;

Note, for MySQL, Marshal requires you to set the "Return matched rows instead of affected rows" flag found under "Details" when configuring the data source.

ODBC for SQL Server

If you're not using a data source, a SQL Server connection string could look like:
Driver={SQL Server}; SERVER=myServerAddress; DATABASE=myDatabase;
A connection based on the above string will use the credentials of the user account running the code (single sign on). If, instead, you'd like to explicitly provide the credentials the connection string could look like:
Driver={SQL Server}; Server=myServerAddress; Database=myDatabase; Uid=myUserID; Pwd=myPassword;

ODBC for MySQL

The best option for MySQL is to create a data source, see above. An explicit connection string could look like:
Driver={MySQL ODBC 5.1 Driver}; Server=myServerAddress; charset=UTF8; Database=myDatabase; User=myUserID; Password=myPassword; Option=2

ODBC for PostgreSQL
For PostgreSQL you should use a data source, see above, based on the PostgreSQL unicode driver. For your data source, click on the Options Datasource button an uncheck the "bool as char" checkbox on Page 1, then click the Page 2 button and check the "bytea as lo" checkbox.
 
For further assistance on connection strings in general, please, visit ConnectionStrings.com.