Views: 2158 (Data available since 06.02.2017)
Last Modified: 10.10.2012
Nowadays, it is almost impossible to create a more or less valuable web project without a database, which is the storage of news, forum messages, commercial catalogues, web store orders and more.
Bitrix Site Manager supports the following database types.
- MSSQL Express 2005
- MSSQL 2005
Database is an independent client-server application running on an operation system. External applications connect to the database via TCP/IP or internal pipes; they send SQL queries and obtain the required data from the database.
In most cases, database runs on the same machine as PHP and a web server. At the same time, it is also possible that the database is located on a different machine or even on a machine of another hosting provider.
It is significant that there are two possible types of connection between the database and a web application:
- simple connection;
- persistent connection.
A simple connection is established each time a page is executed at a first query to the database. This connection closes after the page is completed.
A persistent connection (PHP has special functions with the *_pconnect suffix for such connections) is established only once at a first query to the database. All the subsequent queries, even from other pages, use the already open connection.
Taking into account the fact that establishing a connection is a time and resource consuming process (a TCP/IP connection is created; memory buffers are allocated; authorization is performed; converters are initialized; other operations are performed), the persistent connections are more preferable if it does not exceed the limit of concurrent database connections.
Note! When establishing a connection to the database, PHP usually tries to connect to the local socket (if "localhost" or "localhost:port"is specified as a server parameter) without opening a TCP/IP connection. If you prefer to use a remote connection for local addresses, use 127.0.0.1 instead of localhost. Connections without TCP/IP are more preferable in terms performance, especially when transferring large amounts of information from the database. But when a database is located on remote machine which makes the TCP/IP connection inevitable, persistent connections are even more desirable.
In Bitrix Site Manager, the connection type is specified in /bitrix/php_interface/dbconn.php.
This file can have the following instructions:
$DBType = "mysql";
$DBHost = "localhost:31006";
$DBLogin = "root";
$DBPassword = "";
$DBName = "bsm_demo";
$DBDebug = false;
$DBDebugToFile = false;
DBPersistent constant to specify the connection type.
define("DBPersistent", false); - disables persistent connections.
The usage of persistent connections may require changing certain settings in Apache and MySQL. Ensure that you do not exceed maximum allowed connections. You will find more information about your database in the PHP documentation.