Question

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');
Was it helpful?

Solution

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).

OTHER TIPS

Use this connection string:

$connect=odbc_connect("Driver={Pervasive ODBC Engine Interface};ServerName=localhost;ServerDSN=DSNname;",
    "Username", "Password", SQL_CUR_USE_ODBC); 
$servername = "127.0.0.1"; $username = "root"; $password = "password";$db ="database";
$conn = mysqli_connect($servername, $username, $password, $db);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top