网站首页 > 文章中心 > 其它

phpodbc数据源

作者:小编 更新时间:2023-09-29 08:07:54 浏览量:174人看过

PHP使用ODBC连接数据库的方法

本文实例讲述了PHP使用ODBC连接数据库的方法.分享给大家供大家参考.具体实现方法如下:

!DOCTYPE

html

PUBLIC

phpodbc数据源-图1

XHTML

①0

Strict//EN"

""

xmlns=""

xml:lang="en"

lang="en"

head

titlePHP

and

ODBC:

Example

①./title

meta

http-equiv="Content-Type"

content="text/html;

/

/head

body

php

$conn

=

odbc_connect(

"DRIVER={MySQL

ODBC

Driver};Server=localhost;Database=phpodbcdb",

"username",

"password");

if

(!($conn))

{

echo

"pConnection

to

DB

via

failed:

";

odbc_errormsg

($conn

);

"/p\n";

}

$sql

"SELECT

as

test";

$rs

odbc_exec($conn,$sql);

"tabletr";

"thTest/th/tr";

while

(odbc_fetch_row($rs))

$result

odbc_result($rs,"test");

"trtd$result/td/tr";

odbc_close($conn);

"/table";

/body

/html

希望本文所述对大家的php程序设计有所帮助.

PHP通过ODBC连接到PROGRESS数据库?

①在/etc/services配置文件中添加一行启动odbc的端口,例如:

export PATH

export DLC

export PROOIBRK

export PROOIDRV

例如:

general:

data source name:自己取名

description:随便

database name:数据库的名字

user id:不填

oid/oib options:

protocol:tcp

service name:在services文件中加的merantodbc的端口名称host name:服务器的名称或ip(建议用ip,否则还要在hosts文件中加解析)database options:

database access mode:via server

service name:启动数据库的端口名(是在服务端启动数据库服务的端口名也是在服务端的services文件中)host name:启动数据库服务的机器名或ip(推荐ip)完成后应该可以连接上了

php-odbc php-pear分别是做什么的

php-odbc

php-pear

PEAR是PHP扩展与应用库(the PHP Extension and Application Repository)的缩写.它是一个PHP扩展及应用的一个代码仓库,简单地说,PEAR就是PHP的CPAN.

以上就是土嘎嘎小编为大家整理的phpodbc数据源相关主题介绍,如果您觉得小编更新的文章只要能对粉丝们有用,就是我们最大的鼓励和动力,不要忘记讲本站分享给您身边的朋友哦!!

版权声明:倡导尊重与保护知识产权。未经许可,任何人不得复制、转载、或以其他方式使用本站《原创》内容,违者将追究其法律责任。本站文章内容,部分图片来源于网络,如有侵权,请联系我们修改或者删除处理。

编辑推荐

热门文章