php连接interbase,PHP Open a persistent connection to an InterBase database

这篇博客介绍了如何使用PHP的ibase_pconnect函数连接到Firebird数据库,并详细阐述了如何根据不同的用户权限设置角色。通过创建和授予角色,可以实现登录不同用户时具有不同的数据库操作权限。默认情况下,用户将处于PUBLIC角色,该角色通常只有选择表的权限。要切换到具有特定角色(如'MANAGER_HR')的用户,需要提供所有参数,包括用户名、密码和角色名。
摘要由CSDN通过智能技术生成

houston_roadrunner at yahoo dot com (2006-04-19 08:18:21)

To make a connection to a firebird database with pconnect many people like to use the SYSDBA, or database owner.

example:

$dbConnection = ibase_pconnect('path to db','SYSDBA','masterkey');

The above is fine unless you want to login in various user that have different permissions. To use permission make roles in the database, either as the database creator (or SYSDBA) and grant the roles to the various users.

If you login with...

$dbConnection = ibase_pconnect('path to db', 'USERNAME', 'userpassword');

...interbase will default your user to the PUBLIC role, which is created when the database is create and usualy has select rights on tables only. To get the proper role you will need to use all the parameters, like this...

$user='USERNAME';

$password='userpassword';

$role='MANAGER_HR';

$dbConnection = ibase_pconnect('path to db', $user, $password, '', 0, 3, $role, 0);

BTW - The "path to db", is formed like this...

---------------------

'localhost:c:/firebird/test_db/test.fdb'

---------------------

reading the interbase material, it states 3 connection methods, PHP appears to have selected the tcp type for us. So you can use localhost, or I suspect(never tested this myself) a ip address.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值