Jump to content

ODBC


strocknar

Recommended Posts

So i've got this server running a Progress DB.  I need to connect to it using PHP to pull customer/product data.  My web server is running FC6 with Apache and PHP.  I got iODBC installed and connecting to the database and created a simple page to create a connection:

 

<?php
      $conn = odbc_connect(DSN, NAME, PASS) or die ("error connecting");
?>

 

I just want to see if the page will run successfully.  It seems to except for one small thing.  When I run the file in a web browser it asks if I want to save it.  Any ideas why this would be happening?

Link to comment
Share on other sites

Probably should have been more specific.

the code:

<?php
$fname = "./dled.php";
$handle = fopen($fname, "r");
$contents = fread($handle, filesize($fname));
echo $contents;
fclose($handle);
?>

 

Outputs

Warning: fread() [function.fread]: Length parameter must be greater than 0

 

so technically nothing

Link to comment
Share on other sites

I've tried pulling the tables with odbc_tables($conn), i've tried echo ing text (both before and after the connection) and i've tried printing text.  I could see it asking me to download if there was something actually in the file, but the filesize is 0bytes.

Link to comment
Share on other sites

Are you using the Merant ODBC driver? Its quirky at best. I don't think I ever found a PROGRESS ODBC driver for *nix. Mine is set up on a Windows box, but it works.

 

1) Set up a system DSN. Set the isolation level to "READ UNCOMMITED" or it will lock other users out when  you are querying tables.

2)  In php try something like this

$dsn = 'PROGRESS';

$user = 'odbcuser';

$pw = 'password';

$odbc_con  = odbc_connect($dsn,$user,$pw,SQL_CUR_USE_ODBC) or die(odbc_error());

Link to comment
Share on other sites

Frost: those two websites as well as http://jehiah.cz/archive/compiling-shared-php-modules are what I used to set up PHP.  I had lampp installed and didn't want to recompile php/apache.

 

boo:  after that, page comes up blank.

 

artacus:  I'm using the ODBC driver from the progress website (progress.com i think).  You have to have aaccount with them to log in and all that fancy stuff in order to get it tho.  I had to get the driver from the provider of a seperate piece of software (the one connecting to this godforsaken database in the firstplace).

 

P.S.  Thank you all for your help

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.