adodbをphpで利用するMySQL、DB2、Postgresqlへの接続

1.MySQLへの接続
<?php
include_once(“adodb5/adodb.inc.php");
$db = NewADOConnection('mysql’);
$db->Connect('localhost’, 'root’, 'startnews24’, 'test’)or die(“df");
?>

2.Accessへの接続
<?php
include_once(“adodb/adodb.inc.php");
$conn = NewADOConnection('access’);
$conn->Connect(“test.mb")or die(“cuowu");
?>
3.DB2への接続
<?php
include(“adodb/adodb.inc.php");
$conn=NewADOConnection('db2’);
$conn->Connect(“driver={IBM db2 odbc DRIVER};database=mydb;hostname=localhost;port=50000;
protocol=TCPIP;uid=root; pwd=pass");
?>

4.PostgreSQLへの接続

<?php
include(“adodb/adodb.inc.php");
$conn = NewADOConnection('postgres’);
$conn->Connect('localhost’, 'root’, 'pass’, 'mydb’);
?>

 

 

Source

Posted by arkgame