RISE to Bloome Software
Log In    
Home
RISE
Marshal
Download
 
 
Site Map Site Map
Link to Us Link to Us
r2bsoftware.se r2bsoftware.se
 
 
RISE Version 4.5RISE Version 4.5
RISE Visual ModelingRISE Visual Modeling
AJAX Code GeneratorAJAX Code Generator
 
 
Bookmark and Share
 
Click to hide navigation tree
Database Connection Strings
Database connection strings are used by RISE in the following scenarios:
  • During development, when the RISE Editor connects directly, using ODBC, to a database server to generate, or update, a database model.
  • During development, when the RISE Editor connects to a RISE Server that connects, using ODBC, to a database server to generate, or update, a database model.
  • In run-time, when the generated application connects to its database for working with the information inside. In this, the type of connection depends on the generated code and, thus, it might not be ODBC, see PHP below
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, RISE 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. This way you don't need to put your password into an configuration file. 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.

c# web services
RISE generated c# web services retrieves the connection string from the AppSettings section of the web.config file of the web service. The source code will look for an AppSettings property having its Key attribute set to prefix of the RISE model.
  <appSettings>
    <add key="myPrefix" value="myConnectionString"/>
  </appSettings>

 
PHP web services
RISE generated PHP web services doesn't use ODBC and retrieves their connection information from a separate PHP configuration file. The file should be named <myPrefix>.config.php, where myPrefix is the RISE model prefix. This file is automatically included, using require_once, in the generated PHP files. It must define a set of constants used by the PHP code, see example for MySQL below.
<?php
define("myPrefix_Username", "my userid");
define("myPrefix_Password", "my password");
define("myPrefix_Host", "my db host");
define("myPrefix_Database", "my database name");
define("myPrefix_Port", NULL);
define("myPrefix_Socket", NULL);
when connecting to PostgreSQL the PHP connection info should be provided in a single constant looking like:
<?php 
define('myPrefix_ConnectionString', 'host=myDbHost port=5432 dbname=myDbName user=myUserId password=myPassword');

 
For further assistance on connection strings in general, please, visit ConnectionStrings.com.