MDBTools and PHP

View: New views
3 Messages — Rating Filter:   Alert me  

MDBTools and PHP

by Kritan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm new to the list and have been out of Linux for quite a while so any help will be appreciated.  I couldn't find anything that referenced my issue, so if this is the wrong forum, I apologize.  If you can direct me to the correct one, I would be most appreciative.  I found a similar question posted before, but no one answered it.

I have a client who needs to access a Microsoft Access DB across the network, thus MDBTools to the rescue.  My test system has Fedora 5, and I have installed the following:
Unix ODBC 2.2.11
MDBTools 0.5.1
MDBTools ODBC 0.5.1

I created a share to the Windows system and made the DSN entries in the ODBC.ini file.  I am able to access the DB at the command line using mdb-sql, so I think I have it all set up correctly.

My problem comes when I use PHP.  I created a simple page just to test the connection.  But I get nothing, not even an error message.  Can anyone help me?

Thanks,
Steve

The code is as follows (just the PHP, no tags):

$data_source='database';
$user='';
$password='';

# Connect to the data source and get a handle for that connection.
$conn=odbc_connect($data_source,$user,$password);
if (!$conn){
    if (phpversion() < '4.0'){
        exit("Connection Failed: . $php_errormsg" );
    }
    else{
        exit("Connection Failed:" . odbc_errormsg() );
    }
}else{
        exit("Connection Failed:' . odbc_errormsg() );
}

# This query generates a result set with one record in it.
$sql="SELECT 1 AS test_col";

# Execute the statement.
$rs=odbc_exec($conn,$sql);

# Fetch and display the result set value.
if (!$rs){
    exit("Error in SQL");
}
while (odbc_fetch_row($rs)){
    $col1=odbc_result($rs, "test_col");
    echo "$col1";
}

# Disconnect the database from the database handle.
odbc_close($conn);



Re: MDBTools and PHP

by Hartmut Holzgraefe-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Kritan wrote:

> I have a client who needs to access a Microsoft Access DB across the
> network, thus MDBTools to the rescue.  
[...]
> My problem comes when I use PHP.  I created a simple page just to test the
> connection.  But I get nothing, not even an error message.  Can anyone help
> me?

i can't help you with the PHP/ODBC connectvity issue
but i've created a PHP/mdbtools extension a while ago

   http://pecl.php.net/package/mdbtools

If "across the network" does include network file systems
then this might be an option?

--
Hartmut Holzgraefe, Senior Support Engineer                            .
MySQL AB, www.mysql.com



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
mdbtools-dev mailing list
mdbtools-dev@...
https://lists.sourceforge.net/lists/listinfo/mdbtools-dev

Parent Message unknown Re: MDBTools and PHP

by Igor Korot :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, Kritan,
Did you try to run the script without the browser? Just from the command line...
When do this try to put some debugging satements...

Thank you.

-----Original Message-----

>From: Hartmut Holzgraefe <hartmut@...>
>Sent: Jul 11, 2006 5:33 PM
>To: Kritan <steve@...>
>Cc: mdbtools-dev@...
>Subject: Re: [mdb-dev] MDBTools and PHP
>
>Kritan wrote:
>
>> I have a client who needs to access a Microsoft Access DB across the
>> network, thus MDBTools to the rescue.  
>[...]
>> My problem comes when I use PHP.  I created a simple page just to test the
>> connection.  But I get nothing, not even an error message.  Can anyone help
>> me?
>
>i can't help you with the PHP/ODBC connectvity issue
>but i've created a PHP/mdbtools extension a while ago
>
>   http://pecl.php.net/package/mdbtools
>
>If "across the network" does include network file systems
>then this might be an option?
>
>--
>Hartmut Holzgraefe, Senior Support Engineer                            .
>MySQL AB, www.mysql.com
>
>
>
>-------------------------------------------------------------------------
>Using Tomcat but need to do more? Need to support web services, security?
>Get stuff done quickly with pre-integrated technology to make your job easier
>Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>_______________________________________________
>mdbtools-dev mailing list
>mdbtools-dev@...
>https://lists.sourceforge.net/lists/listinfo/mdbtools-dev



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
mdbtools-dev mailing list
mdbtools-dev@...
https://lists.sourceforge.net/lists/listinfo/mdbtools-dev
LightInTheBox - Buy quality products at wholesale price!