How to connect with pervasive database via php

偶尔善良 提交于 2021-02-20 04:09:02

问题


I need to know how can I connect with pervasive database via php.

As I know, I have to use ODBC. I configured it on my Windows 7 system and I created table in pervasive server.

This is my code, but it does not work:

$connect_string = "DRIVER={Pervasive ODBC Client Interface}; SERVERNAME=localhost; SERVERDSN=demodata;";
$conn = odbc_connect($connect_string, 'root', 'root');

回答1:


You probably already have the ODBC drivers installed; I obtained the latest by installing the Pervasive Client from http://www.pervasive.com/database/Home/Products/PSQLv12.aspx (current version is 12).

Then depending on 32 or 64 bit use the following connection string:

32bit:

$connect=odbc_connect("Driver={Pervasive ODBC Client Interface};ServerName=localhost;ServerDSN=DSNname;",
    "Username", "Password", SQL_CUR_USE_ODBC); 

64bit:

$connect=odbc_connect("Driver={Pervasive ODBC Interface};ServerName=localhost;ServerDSN=DSNname;",
    "Username", "Password", SQL_CUR_USE_ODBC); 

(You can check these strings with the ODBC data source administrator on Windows, use equivalent on other operating systems).




回答2:


Use this connection string:

$connect=odbc_connect("Driver={Pervasive ODBC Engine Interface};ServerName=localhost;ServerDSN=DSNname;",
    "Username", "Password", SQL_CUR_USE_ODBC); 


来源:https://stackoverflow.com/questions/22917908/how-to-connect-with-pervasive-database-via-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!