Implementation code for connecting phpadodb to different databases.
The code is as follows:
Include ("adodb/adodb. inc. php"); // contains the adodb class library file
$ Conn = NewADOConnection ('seconds s ');
$ Conn-> Connect ('localhost', 'root', 'pass', 'mydb'); // Connect to the PostgreSQL database
?>
The code is as follows:
Include ("adodb/adodb. inc. php"); // contains the adodb class library file
$ Conn = NewADOConnection ('MySQL: // root: 1981427 @ localhost/test'); // connect to the mysql database
?>
The code is as follows:
Include ("adodb/adodb. inc. php"); // contains the adodb class library file
$ Conn = NewADOConnection ('mysql ');
$ Conn-> Connect ('localhost', 'root', '000000', 'test'); // Connect to the MySQL database
?>
The code is as follows:
Include ("adodb/adodb. inc. php"); // contains the adodb class library file
$ Conn = NewADOConnection ('MySQL: // root: 1981427 @ localhost/test'); // connect to the database
?>
The code is as follows:
Include ("adodb/adodb. inc. php"); // contains the adodb class library file
$ Conn = NewADOConnection ('seconds s ');
$ Conn-> Connect ('host = localhost port = 5432 dbname = mydb'); // Connect to the PostgreSQL database
?>
The code is as follows:
Include ("adodb/adodb. inc. php"); // contains the adodb class library file
$ Conn = NewADOConnection ('s s: // root: pass @ localhost/mydb'); // connect to the PostgreSQL database
?>
The code is as follows:
Include ("adodb/adodb. inc. php"); // contains the adodb class library file
$ Conn = NewADOConnection ('access'); // connect to the access Database
$ Conn-> Connect ("Driver = {Microsoft Access Driver (*. mdb)}; Dbq = d: \ mydb. mdb; Uid = Admin; Pwd = ;");
?>
The code is as follows:
Include ("adodb/adodb. inc. php"); // contains the adodb class library file
$ Conn = NewADOConnection ('odbc _ mssql'); // connect to the SQL Server database
$ Conn-> Connect ("Driver = {SQL Server}; Server = localhost; Database = mydb;", 'username', 'password ');
?>
The code is as follows:
Include ("adodb/adodb. inc. php"); // contains the adodb class library file
$ Conn = NewADOConnection ('mssql'); // connect to the SQL Server database
$ Conn-> Connect ("localhost", 'username', 'password', 'mydb ');
?>
The code is as follows:
Include ("adodb/adodb. inc. php"); // contains the adodb class library file
$ Conn = NewADOConnection ('db2 '); // connect to the db2 database
$ Conn-> Connect ("driver = {IBM db2 odbc DRIVER}; database = mydb; hostname = localhost; port = 50000;
Protocol = TCPIP; uid = root; pwd = pass ");
?>