php adodb连接不同数据库

前端之家收集整理的这篇文章主要介绍了php adodb连接不同数据库前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

<div class="codetitle"><a style="CURSOR: pointer" data="18667" class="copybut" id="copybut18667" onclick="doCopy('code18667')"> 代码如下:

<div class="codebody" id="code18667">
<?PHP
include("adodb/adodb.inc.PHP"); //包含adodb类库文件
$conn = NewADOConnection('postgres');
$conn->Connect('localhost','root','pass','mydb'); //连接Postgresql数据库
?>
<div class="codetitle"><a style="CURSOR: pointer" data="10381" class="copybut" id="copybut10381" onclick="doCopy('code10381')"> 代码如下:
<div class="codebody" id="code10381">
<?PHP
include("adodb/adodb.inc.PHP"); //包含adodb类库文件
$conn = NewADOConnection('MysqL://root:1981427@localhost/test'); //连接MysqL数据库
?>
<div class="codetitle"><a style="CURSOR: pointer" data="88354" class="copybut" id="copybut88354" onclick="doCopy('code88354')"> 代码如下:
<div class="codebody" id="code88354">
<?PHP
include("adodb/adodb.inc.PHP"); //包含adodb类库文件
$conn = NewADOConnection('MysqL');
$conn->Connect('localhost','1981427','test'); //连接MysqL数据库
?>
<div class="codetitle"><a style="CURSOR: pointer" data="27875" class="copybut" id="copybut27875" onclick="doCopy('code27875')"> 代码如下:
<div class="codebody" id="code27875">
<?PHP
include("adodb/adodb.inc.PHP"); //包含adodb类库文件
$conn = NewADOConnection('MysqL://root:1981427@localhost/test'); //连接数据库
?>

<div class="codetitle"><a style="CURSOR: pointer" data="9313" class="copybut" id="copybut9313" onclick="doCopy('code9313')"> 代码如下:<div class="codebody" id="code9313">
<?PHP
include("adodb/adodb.inc.PHP"); //包含adodb类库文件
$conn = NewADOConnection(' postgres ');
$conn->Connect('host=localhost port=5432 dbname=mydb'); //连接Postgresql数据库
?>

<div class="codetitle"><a style="CURSOR: pointer" data="91559" class="copybut" id="copybut91559" onclick="doCopy('code91559')"> 代码如下:<div class="codebody" id="code91559">
<?PHP
include("adodb/adodb.inc.PHP"); //包含adodb类库文件
$conn = NewADOConnection('postgres://root:pass@localhost/mydb'); //连接Postgresql数据库
?>
<div class="codetitle"><a style="CURSOR: pointer" data="18262" class="copybut" id="copybut18262" onclick="doCopy('code18262')"> 代码如下:<div class="codebody" id="code18262">
<?PHP
include("adodb/adodb.inc.PHP"); //包含adodb类库文件
$conn = NewADOConnection('access'); //连接Access数据库
$conn->Connect("Driver={Microsoft Access Driver (*.mdb)};Dbq=d:\mydb.mdb;Uid=Admin;Pwd=;");
?>
<div class="codetitle"><a style="CURSOR: pointer" data="38152" class="copybut" id="copybut38152" onclick="doCopy('code38152')"> 代码如下:<div class="codebody" id="code38152">
<?PHP
include("adodb/adodb.inc.PHP"); //包含adodb类库文件
$conn=NewADOConnection('odbc_mssql'); //连接sql Server数据库
$conn->Connect("Driver={sql Server};Server=localhost;Database=mydb;",'username','password');
?>

<div class="codetitle"><a style="CURSOR: pointer" data="5040" class="copybut" id="copybut5040" onclick="doCopy('code5040')"> 代码如下:<div class="codebody" id="code5040">
<?PHP
include("adodb/adodb.inc.PHP"); //包含adodb类库文件
$conn=NewADOConnection('mssql'); //连接sql Server数据库
$conn->Connect("localhost','password','mydb');
?>

<div class="codetitle"><a style="CURSOR: pointer" data="4376" class="copybut" id="copybut4376" onclick="doCopy('code4376')"> 代码如下:<div class="codebody" id="code4376">
<?PHP
include("adodb/adodb.inc.PHP"); //包含adodb类库文件
$conn=NewADOConnection('db2'); //连接DB2数据库
$conn->Connect("driver={IBM db2 odbc DRIVER};database=mydb;hostname=localhost;port=50000;
protocol=TCPIP;uid=root; pwd=pass");
?>

猜你在找的PHP相关文章