Home > Backend Development > PHP Tutorial > php adodb connects to different databases_PHP tutorial

php adodb connects to different databases_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-21 15:46:56
Original
868 people have browsed it

Copy code The code is as follows:

include("adodb/adodb.inc.php"); /Contains adodb class library file
$conn = NewADOConnection('postgres');
$conn->Connect('localhost', 'root', 'pass', 'mydb'); //Connect to PostgreSQL Database
?>


Copy code The code is as follows:

< ?php
include("adodb/adodb.inc.php"); //Include adodb class library file
$conn = NewADOConnection('mysql://root:1981427@localhost/test'); // Connect to MySQL database
?>


Copy code The code is as follows:

include("adodb/adodb.inc.php"); //Include adodb class library file
$conn = NewADOConnection('mysql');
$conn->Connect( 'localhost', 'root', '1981427', 'test'); //Connect to MySQL database
?>


Copy Code The code is as follows:

include("adodb/adodb.inc.php"); //Include adodb class library file
$ conn = NewADOConnection('mysql://root:1981427@localhost/test'); //Connect to the database
?>

Copy code The code is as follows:

include("adodb/adodb.inc.php"); //Include adodb class library file
$conn = NewADOConnection(' postgres ');
$conn->Connect('host=localhost port=5432 dbname=mydb'); //Connect to PostgreSQL database
?>

Copy code The code is as follows:

include("adodb/adodb.inc.php"); /Contains adodb class library file
$conn = NewADOConnection('postgres://root:pass@localhost/mydb'); //Connect to PostgreSQL database
?>


Copy code The code is as follows:

include("adodb/adodb.inc.php") ; //Contains adodb class library file
$conn = NewADOConnection('access'); //Connect to Access database
$conn->Connect("Driver={Microsoft Access Driver (*.mdb)}; Dbq=d:\mydb.mdb;Uid=Admin;Pwd=;");
?>


Copy codeThe code is as follows:

include("adodb/adodb.inc.php"); //Include adodb class library file
$conn=NewADOConnection ('odbc_mssql'); //Connect to SQL Server database
$conn->Connect("Driver={SQL Server};Server=localhost;Database=mydb;",'username','password');
?>

Copy code The code is as follows:

include("adodb/adodb.inc.php"); //Include adodb class library file
$conn=NewADOConnection('mssql'); //Connect to SQL Server database
$conn->Connect(" localhost', 'username', 'password', 'mydb');
?>

Copy code The code is as follows :

include("adodb/adodb.inc.php"); //Include adodb class library file
$conn=NewADOConnection('db2'); //Connect to DB2 database
$conn->Connect("driver={IBM db2 odbc DRIVER};database=mydb;hostname=localhost;port=50000;
protocol=TCPIP;uid=root; pwd= pass");
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/320053.htmlTechArticleCopy the code as follows: ?php include("adodb/adodb.inc.php"); //Include adodb Class library file $conn = NewADOConnection('postgres'); $conn-Connect('localhost', 'root', 'pass', 'mydb');...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template