Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2008

    Unanswered: Total Newb - connect to pervasive database from PHP

    OK let me start off here - just starting to learn PHP (as well as Linux)- dont know very much...but am a programmer of 5 years in C++, C#, Java....

    Here at my office, we have a database server that hosts a Pervasive 9.0 database - we are trying to write a new INTRANET so our users can look up stuff from our database without having login credentials to log into our main software. This would allow for easy item lookup and some other really cool stuff - we are trying to develop a site in which we allow certain users to do certain things - so if you are logged in you can do this, otherwise, you cant do a thing. ANYWAYS, i have set up an Ubuntu desktop installation, and installed LAMP. PHP does work, and i have been screwing around getting some code done to try it out. HOWEVER, I cannot for the life of me get connected to our pervasive server. I have installed the ODBC package for php5, and see that the odbc commands are available, but i cant seem to get connected. All the resources i have been seeing online seem to show how to connect to servers that are a local DSN on that machine - when i have connected in the past, i have always used a connection string and provided the database name, and never had to have the DSN be local...we simply refer to the server by IP.

    Can anyone out there help me get connected? i am a total newb to linux as well, and am totally lost as to which files to edit, and which to leave alone.

    i KNOW that mySQL is working cause i have a joomla installation set up and that is working - its just connecting to our production database i cant get working....once i connect, i am good cause i know SQL fairly well.

    TIA - i GREATLY appreciate any help!
    Last edited by mominsky; 04-07-08 at 12:23.

  2. #2
    Join Date
    Dec 2001
    Provided Answers: 4
    First, why Linux for PHP? PHP runs on Windows. If you're PSQL is also running on Windows (typical) then you can use IIS and PHP (or ASP.NET, or ASP).
    Second, a few questions:
    - What is the exact version of PSQL being used?
    - Have you installed the PSQL client on the Linux box?
    - Can you access the PSQL data through ODBC from a Windows client (through PCC or otherwise)?

    Here's a very simple PHP script that I've used in the past both from WIndows and Linux. It connects to the PSQL DEMODATA database.
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <TITLE>PHP Sample</TITLE>
    $sql="select * from class";
    echo "<table border=1>\n";
    $numfields = odbc_num_fields($rs);
    	echo "<th>$fn</th>";
    echo "\n";
    	echo "<tr>\n";
    	   echo "<td>$fv</td>";
    	echo "</tr>\n";
    echo "</table>\n";
    echo "<p>Number of Fields: $numfields</p>\n";
    Mirtheil Software
    Certified Pervasive Developer
    Certified Pervasive Technician
    Custom Btrieve/VB development
    I do not answer questions by email. Please post on the forum.

  3. #3
    Join Date
    Mar 2008
    ok - first of all, thank you for the reply.....i think i have narrowed down SOME of the issues, but still am a bit lost - i think my biggest problem is my lack of knowledge with linux.

    the reason for linux, honestly, its coool - also, its a lot easier to get our CFO to approve of us buying a server that doesnt need an expensive OS on it - we are looking to use this server for simply hosting our intranet, and hosting some images and things...

    after trying to connect to the database, and posting this thread, i realized there is definitely a client version of pervasive to install on linux - in my stupidity i thougght i could simply connect over basic odbc drivers - so i have installed it. it now says it is installed, but again from my lack of linux knowledge, i dont know how to USE it. i installed the client rpm file, as well as the control center....but again, i dont know how to actuall RUN them.

    i am currently trying to install the java runtime environment, as the files were .jar files, so i figured it was probably necessary.

    our version of pervasive is 9.5, and it is currently accessed by over 100 users, and handles every transaction through our system at over 9 locations - so i know it is up and running (we have 8 retail stores, and where i am, our corp office).

    once the JRE is done installing, i am going to try to mess around some more, but am worried there is no way i am doing this right, and furthermore, there is no way i am going to be able to remember this when i do it on our new server (right now this is all testing on an old laptop).

    ALSO - i have coonnected with ODBC drivers from a windows terminal before - i did it in C# using a connection string - which is what i tried copyiing and pasting into the PHP connection string, but it didnt work - probably cause pervasive wasnt installled correctly on the linux pc
    Last edited by mominsky; 04-07-08 at 15:58.

  4. #4
    Join Date
    Mar 2008
    okay - so after screwing around some more, i think i have gotten some headway - however i ran into a little problem again -

    i am running dsnadd to add the DSN, and it says that the odbc.ini file has been updated,, but the file HASNT been updated - i am thinking this is some type of permission problem - so i tried changing the ownership of odbc.ini, but that didnt do anything - i am now trying to reinstall pervasive to see if that gets it backk to where it should be, and then hopefully it will let me add the dsn.

    ok that didnt work - starting to think a full format/reinstall would be best....i dont think it will take TOO long - i am starting to understand all of this a little bit better...
    problem is that it will take forever to do all the updates again and everything...
    Last edited by mominsky; 04-08-08 at 10:14.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts