简体   繁体   中英

php odbc_connect to access mdb file another server

Can any one help me how to put parameters in odbc_connect() using php to connect a database *.mdb driver on another server.

$conn=odbc_connect('','','');

Thanks.

Example for odbc connection `

<?php
// Microsoft SQL Server utilise le pilote SQL Native Client 10.0 ODBC Driver : 
// il permet les connexions à SQL 7, 2000, 2005 et 2008
$connection = odbc_connect("Driver={SQL Server Native Client 10.0};Server=$server;Database=$database;", $user, $password);

// Microsoft Access
$connection = odbc_connect("Driver={Microsoft Access Driver (*.mdb)};Dbq=$mdbFilename", $user, $password);

// Microsoft Excel
$excelFile = realpath('C:/ExcelData.xls');
$excelDir = dirname($excelFile);
$connection = odbc_connect("Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=$excelFile;DefaultDir=$excelDir" , '', '');
?>`

You can put the mdb file on a share on the server and access it that way but there are limitations doing that. You can get yourself an ODBC-ODBC Bridge and that allows connection to any remote ODBC data source so long as you can install something on the server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM