PHP connecting to Pervasive SQL

Posted on 2003-03-10
Medium Priority
Last Modified: 2013-12-12
I am currently using PHP to connect to MySQL but have a need to use Pervasive Sql.

What is the best way to connect to Pervasive Sql? I can't find examples anywhere.
And yes I am new at this  :)

Question by:dc_sava
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 40

Expert Comment

by:Richard Quadling
ID: 8127126
http://www.pervasive.com/library/index.asp?_portal=PHP seems a good place to start.

It looks like there is no native support for Pervasive, so using ODBC is required.

Accepted Solution

mokelly1 earned 750 total points
ID: 8159721
I have set up an ODBC system dsn that points to my pervasive database. Then I use the following top three lines of code to open the database and the rest to access tables and fields:

// connect to an ODBC-dba with a user and password
$connect = odbc_connect("ODBCDatabaseName", "username", "password");

// query the users table for Finished Goods
$query = "SELECT mtro_code, mtro_desc
            FROM routing
        ORDER BY mtro_code";
$result = odbc_exec($connect, $query);
// fetch the data from the database
$LastTopLevel = "1";
$TopLevel[$i] = " ";
  $TopLevel[$i] = odbc_result($result, 1);
  if ($LastTopLevel <> $TopLevel[$i])
     $Description[$i] = odbc_result($result, 2);
     $LastTopLevel = $TopLevel[$i];
     $i = $i + 1;

odbc_result($result,1) is the field mtro_code
odbc_result($result,2) is the field mtro_desc in the Select statement above

Author Comment

ID: 8185323
Thanks for the comments.
Unfortunately I found the pervasive examples to not even download from their site.
On the up side I have managed to figure out how to connect using ODBC from some PHP resources similar to the above suggestion.

Thanks again.

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question