|
When used, the macro creates a new connection with the information inserted in its parameters. This connection is available throughout the current session Scriptcase and cease to exist when the session is closed.
1º Parameter: Connection name.
Note: If there is a connection created within the Scriptcase with the same name, this macro has no effect. Connections created within the Scriptcase prevail. If you want to edit an existing connection, see the documentation for the macro sc_connection_edit.
2º Parameter: Array of items containing the connection information. Check out the indices of the array:
Indice
|
Description |
Example |
['drive'] |
Driver of the database used for the connection (see table below) |
$arr_conn['drive'] = "oci8" |
| ['server'] |
Database server (host) |
$arr_conn['server'] = "127.0.0.1" |
| ['user'] |
Database username |
$arr_conn['user'] = "root" |
| ['password'] |
Database password |
$arr_conn['password'] = "secretpass123" |
| ['database'] |
Database name used in the connection |
$arr_conn['database'] = "sc_samples" |
| ['persistent'] |
Defines if the connection is persistent or not |
$arr_conn['persistent'] = "Y" / "N" |
| ['encoding'] |
Configure the connection encoding |
$arr_conn['encoding'] = "utf8" |
Note: It is required that all items are filled, with the exception of items ['persistent'] and ['encoding'].
See below the driver's list:
Driver
|
Descrição
|
| access |
MS Access |
| ado_access |
MS Access ADO |
| odbc |
Generic ODBC |
| db2 |
DB2 |
| db2_odbc |
DB2 Native ODBC |
| odbc_db2 |
DB2 Generic ODBC |
| odbc_db2v6 |
DB2 Generic ODBC 6 or Lower |
| firebird |
Firebird |
| borland_ibase |
Interbase 6.5 or Higher |
| ibase |
Interbase |
| pdo_informix |
Informix PDO |
| informix |
Informix |
| informix72 |
Informix 7.2 or Lower |
| ado_mssql |
MSSQL Server ADO |
| pdo_sqlsrv |
MSSQL Server NATIVE SRV PDO |
| mssqlnative |
MSSQL Server NATIVE SRV |
| odbc_mssql |
MSSQL Server ODBC |
| mssql |
MSSQL Server |
| pdo_mysql |
MySQL PDO |
| mysqlt |
Mysql (Transactional) |
| mysql |
MySQL (Non-Transactional) |
| oci805 |
Oracle 8.0.5 or Higher |
| odbc_oracle |
Oracle ODBC |
| oci8 |
Oracle 8 |
| oci8po |
Oracle 8 Portable |
| oracle |
Oracle 7 or Lower |
| postgres7 |
PostgreSQL 7 or Higher |
| pdo_pgsql |
PostgreSQL PDO |
| postgres64 |
PostgreSQL 6.4 or Higher |
| postgres |
PostgreSQL 6.3 or Lower |
| pdosqlite |
SQLite PDO |
| sqlite |
SQLite |
| sybase |
Sybase |
Example:
$arr_conn = array();
$arr_conn['drive'] = "mysqlt";
$arr_conn['server'] = "127.0.0.1";
$arr_conn['user'] = "root";
$arr_conn['password'] = "pass123";
$arr_conn['database'] = "sc_samples";
$arr_conn['persistent'] = "Y";
$arr_conn['encoding'] = "utf8";
sc_connection_new("new_conn_mysql", $arr_conn);
|