#1  
Old 30th November 2007, 12:18 AM
Colin Messitt
 
Posts: n/a
Default Connect from Web Site back to ODBC driver


I've struggled with this for hours. I need to connect from a PHP script on a
linux box back to a Nexus DB on a Windows host. The Nexus V2 Driver is
installed on the windows host and appears to be working. A system DSN is
configured for it (the Nexus Server is running as a service). I can
configure it from the Windows Control panel ODBC Administrator, a "Test
Connection" is fine, and I can see the tables when I hit the List Tables
button. So I'm fairly confident the ODBC driver is working.

My problem comes in knowing how to connect to it from PHP on the Linux box.
From a phpinfo() I can see that iodbc is installed. So i'm guessing from PHP
I should use odbc_connect but what do I pass it? The name of a section in an
odbc.ini file? And if so what should that section contain?

I've also seen examples where the parameter to odbc_connect doesn't seem to
be a reference to a section in the odbc.ini file but instead is what appears
to be a straight connection string. Can I do it this way? What should be in
that connection string, does anyone have an example?

Am I on the right track at all?

Colin

  #2  
Old 30th November 2007, 03:49 AM
Colin Messitt
 
Posts: n/a
Default Re: Connect from Web Site back to ODBC driver

Or is this only possible if PHP is running on a Windows box? Does the driver
have to be installed on the machine running PHP (and the machine therefore
have be Windows)?

Am I currrently trying to do the impossible by using a Linux box?

Colin.

"Colin Messitt" <colin@nospamplease.x2net.com> wrote in message
news:474ebb27@nexus-vkpb9bih5.Nexus.local...
>
> I've struggled with this for hours. I need to connect from a PHP script on
> a linux box back to a Nexus DB on a Windows host. The Nexus V2 Driver is
> installed on the windows host and appears to be working. A system DSN is
> configured for it (the Nexus Server is running as a service). I can
> configure it from the Windows Control panel ODBC Administrator, a "Test
> Connection" is fine, and I can see the tables when I hit the List Tables
> button. So I'm fairly confident the ODBC driver is working.
>
> My problem comes in knowing how to connect to it from PHP on the Linux
> box. From a phpinfo() I can see that iodbc is installed. So i'm guessing
> from PHP I should use odbc_connect but what do I pass it? The name of a
> section in an odbc.ini file? And if so what should that section contain?
>
> I've also seen examples where the parameter to odbc_connect doesn't seem
> to be a reference to a section in the odbc.ini file but instead is what
> appears to be a straight connection string. Can I do it this way? What
> should be in that connection string, does anyone have an example?
>
> Am I on the right track at all?
>
> Colin


  #3  
Old 30th November 2007, 06:55 AM
Hannes Danzl[NDD]
 
Posts: n/a
Default Re: Connect from Web Site back to ODBC driver

<?php

echo "NexusDB via ODBC/PHP<br><br>";

$db = odbc_connect("v2test", "", "");

echo "Connected<br>";

$result = odbc_exec($db, "SELECT id, aname FROM ctable");

echo "Executed<br>";

$num_records_fetched = 0;
$num_records_to_fetch = 4;

while ($row = odbc_fetch_array($result)) {
$num_records_fetched++;
echo "Row {$num_records_fetched}:";
foreach ($row as $key => $value) {
echo " {$key} => {$value}";
}
echo "<BR>";
if ($num_records_fetched >= $num_records_to_fetch) {
break;
}
}

?>

--

Hannes Danzl [NexusDB Developer]
Newsgroup archive at http://www.tamaracka.com/search.htm
  #4  
Old 30th November 2007, 07:12 PM
Colin Messitt
 
Posts: n/a
Default Re: Connect from Web Site back to ODBC driver

Thanks for the reply. But I think I'm misunderstanding something fundamental
here maybe. The trouble I'm having is getting the connection. In your
example you get the connection with $db = odbc_connect("v2test", "", "");
but where is v2test? And where is the php script running? Is the PHP script
running on a Windows box, where the driver is installed?

What I was hoping to do was run a PHP script on a Linux box, to connect via
ODBC to a Nexus database on a Windows box.

I now think that is impossible, because the ODBC Driver has to be installed
on the same box as the PHP script. As the ODBC driver is a Windows DLL it
can't go on to a Linux box. So using the ODBC driver to connect a PHP script
running on Linux to a Nexus database is not possible. Am I right in that?
What would actually be required is a Linux version of the driver, which
doesn't currently exist?

Colin.



"Hannes Danzl[NDD]" <hannes@nexusdb.dbnexus.com> wrote in message
news:xn0feb1pt29p85w001@77.37.6.239...
> <?php
>
> echo "NexusDB via ODBC/PHP<br><br>";
>
> $db = odbc_connect("v2test", "", "");
>
> echo "Connected<br>";
>
> $result = odbc_exec($db, "SELECT id, aname FROM ctable");
>
> echo "Executed<br>";
>
> $num_records_fetched = 0;
> $num_records_to_fetch = 4;
>
> while ($row = odbc_fetch_array($result)) {
> $num_records_fetched++;
> echo "Row {$num_records_fetched}:";
> foreach ($row as $key => $value) {
> echo " {$key} => {$value}";
> }
> echo "<BR>";
> if ($num_records_fetched >= $num_records_to_fetch) {
> break;
> }
> }
>
> ?>
>
> --
>
> Hannes Danzl [NexusDB Developer]
> Newsgroup archive at http://www.tamaracka.com/search.htm


  #5  
Old 30th November 2007, 07:56 PM
Hannes Danzl[NDD]
 
Posts: n/a
Default Re: Connect from Web Site back to ODBC driver

> What would actually be required is a Linux version of the driver, which
> doesn't currently exist?


That's correct

--

Hannes Danzl [NexusDB Developer]
Newsgroup archive at http://www.tamaracka.com/search.htm
  #6  
Old 30th November 2007, 08:17 PM
Colin Messitt
 
Posts: n/a
Default Re: Connect from Web Site back to ODBC driver

Thought so. I see one option available appears to be an ODBC to ODBC bridge
but the prices are eye-watering. Will have to use a Windows server for
running PHP rather than Linux at this point I guess.

Are there any plans for a Linux driver? A lot of work I suspect.

Thanks for confirming it anyway.

Colin.

"Hannes Danzl[NDD]" <hannes@nexusdb.dbnexus.com> wrote in message
news:xn0febme831m4ke008@77.37.6.239...
>> What would actually be required is a Linux version of the driver, which
>> doesn't currently exist?

>
> That's correct
>
> --
>
> Hannes Danzl [NexusDB Developer]
> Newsgroup archive at http://www.tamaracka.com/search.htm


  #7  
Old 9th January 2012, 10:12 AM
olivergeorge olivergeorge is offline
Junior Member
 
Join Date: Jan 2012
Posts: 2
Default

Hi Colin, Hi Hannes,

Just wondered if anything had changed on this front in the last 5 years?

cheers, Oliver
  #8  
Old 9th January 2012, 11:06 AM
Eivind Bakkestuen [NDD]
 
Posts: n/a
Default Re: Connect from Web Site back to ODBC driver

> Just wondered if anything had changed on this front in the last 5
> years?


Not in the ODBC driver, no. Given that ODBC is a Microsoft (windows)
technology, I don't think we'll have a non-windows ODBC driver in the
foreseeable future.


--
Eivind Bakkestuen [NDD]


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Had to go back to 3.63 Danijel Tkalcec nexusdb.public.support.portal 4 26th May 2010 10:05 AM
I need an example in ASP>NET Web Site Delphi Prism David Guest nexusdb.public.support.adoprovider 9 12th May 2010 10:58 PM
How do I send messages back to the controller? Hannes Danzl[NDD] nexusdb.public.support.portal 2 16th February 2010 08:55 AM
Web Site Luigi Amorini nexusdb.public.support.adoprovider 14 18th December 2008 05:31 AM
Delphi 8 + Beta 13 - can't connect Steve Crook nexusdb.public.support.adoprovider 5 22nd December 2005 04:09 PM


All times are GMT +11. The time now is 03:37 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.