I just got this message for some reason...  way to go yahoo!  :p

anyway, see my comments below:


James Keeline wrote:
> --- Brian Cummiskey <[EMAIL PROTECTED]> wrote:
> 
>>my office is finally starting to make the move to linux/apache/php web 
>>servers from IIS.  But, the majority of our databases will remain on MS 
>>SQL 2000.
>>
>>I've been trying to connect from my linux webserver at location A to my 
>>MS SQL server on wink2k3 at location B to no avail.
>>
>>i've read a ton of articles on odbc, and how there needs to be a DSN on 
>>the webserver machine...  but how do you put a DNS on a linux box?
>>I finally got around that and now, i'm failing at the basic connect 
>>function:
>>Fatal error: Call to undefined function: odbc_connect()
>>
>>I must be missing a library of some sort.
>>
>>can anyone point me in the right direction?
> 
> 
> 
> You should probably reveal how you set up a DSN (Data Source Name) since 
> others
> will doubtless run into the same obstacle.

after toying with several solutions, I had my server admin re-compile 
apache with the http://www.freetds.org/ freeTDS DSN.  Supposedly, this 
is not stable and they say not to use it on a live environment.  I 
wasn't too concerned with this, as its mostly a server for ME for 
reporting purposes, and if it crashes on me, its not a huge deal.  a 
shout across the room to my admin to reboot is easy :)


Once the system was compiled with the freetds, we were able to telnet 
into the system...

nano /etc/odbc.ini

and there, we are able to edit the DSN's.

the doc's section on the freetds site offers more info on that...

> Which version of Linux are you using?  

linux version is red hat enterprise.


> If it is a Red Hat/Fedora system, there
> are php-odbc*.rpm files which can bring this functionality to your system.  
> You
> will need the ODBC libraries (look for both *odbc*.rpm and *ODBC*.rpm in your
> install CDs).  If you are using a hosting company, you'll have to ask them
> nicely to install these modules or recompile PHP to include ODBC functions.


after the re-compile with tds in there, all the functions started working


here's a sample script i used with dynamic scripts to make some queries 
to test everything out....



<html>
<head>
<title>test</title>
</head>

<body>

<?php
$query=$_POST['query'];
$uid=$_POST['uid'];
$passwd=$_POST['passwd'];
$listtables=$_POST['listtables'];
$DSN=$_POST['DSN'];
$exec=$_POST['exec'];
?>

<p>Enter the parameters for your query here:</p>

<form action="index.php" method="post">
<div>
<span class="caption">DSN</span>
<input type="text" name="DSN" value="<?php
print ($DSN<>"")?$DSN:"test"
?>" />

<span class="caption">UserID</span>
<input type="text" name="uid" value="<?php print ($uid<>"")?$uid:"test" 
?>" />

<span class="caption">Password</span>
<input type="password" name="passwd" value="<?php print 
($passwd<>"")?$passwd:"pass"?>" />
</div>

<div>
<span class="caption">Query</span>
<input type="text" name="query" value="<?php
print ($query<>"")?$query:"select top 25 * from testtable"
?>" size="100" />
</div>
<div>
<input type="submit" name="exec" value="Execute query" />
</div>
</form>

<hr />

<?php

if($query<>"" && $DSN<>"" && $exec!=NULL)
{
        print "<p>Connecting... ";
        $handle=odbc_connect ("$DSN", "$uid", "$passwd");

        if(!$handle) {
          print "<p>Uh-oh! Failure to connect to DSN [$DSN]: <br />";
          odbc_errormsg();
        }
        else {
          print "done</p>";
          $resultset=odbc_exec ($handle, "$query");
          odbc_result_all($resultset);
          odbc_close($handle);
        }
}
?>

</body>
</html>




and thats about it.  :)

if anyone has any questions about hitting MSSQL 2000 on win2k3 from 
php/apache/linux across a domain, i guess i'm your man :)





Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to