× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



By the way, in the freetds.conf file, the:

[FBC_DEV_106]

or the:

[FEDBAR]

entry needs to go on a separate line after:

"# PeopleSoft FIN88QA database (Microsoft SQL Server 2000
configuration)".

The email list keeps putting the [FBC_DEV_106] and [FEDBAR] entries on
the same line as the comment. Quirky formatting. Anything on a line with
the # is a comment.

Kelly





-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx]
On Behalf Of Kelly Cookson
Sent: Wednesday, September 30, 2009 12:57 PM
To: Web Enabling the AS400 / iSeries
Subject: Re: [WEB400] PHP and microsoft sql server

It looks like you are trying to use two different names for the
database. If you make this entry into the freetds.conf file:

# PeopleSoft FIN88QA database (Microsoft SQL Server 2000 configuration)
[FBC_DEV_106]
host = 192.168.100.5
port = 1433
tds version = 8.0

then your PHP code should look like this:

$conn = mssql_connect('FBC_DEV_106','username','password');
if ($conn) {
mssql_select_db("FBC_DEV_106");

On the other hand, if you make this entry into the freetds.conf file:

# PeopleSoft FIN88QA database (Microsoft SQL Server 2000 configuration)
[FEDBAR]
host = 192.168.100.5
port = 1433
tds version = 8.0

then your PHP code should look like this:

$conn = mssql_connect('FEDBAR','username','password');
if ($conn) {
mssql_select_db("FEDBAR");

Please try making those changes and see if it works. In terms of log
files, I don't know whether freetds generates log files or where they
would be kept.

Kelly

-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx]
On Behalf Of Larry Kleinman
Sent: Wednesday, September 30, 2009 11:46 AM
To: Web Enabling the AS400 / iSeries
Subject: Re: [WEB400] PHP and microsoft sql server

Kelly - thanks for the advice. Unfortunately, I don't seem to be
connecting to the SQL server. Is there some log that I can look at that

would tell me what is going wrong. Below is the PHP script.

<html>
<head></head>
<body>
Here is some stuff
<table border = "1">
<tr><th>Column Name 1</th><th>Column Name 2</th><th>Column Name
3</th><th>Sequence</th><th>Desc</th></tr>
<?php
$conn = mssql_connect('FedBar','Sa','Fbc');
if ($conn) {
mssql_select_db("FBC_DEV_106");
$query = "SELECT * FROM MYTABLE"; }
?>
</table>
</body>
</html>



Here is the addition to the freetds file that I made (the rest of the
file
is unchanged from how it was shipped)

# Fed Bar Microsoft SQL Server 2000 configuration
[FedBar]
192.168.100.5
port = 1433
tds version = 8.0


Larry Kleinman
Kleinman Associates, Inc.
212-949-6469
203-255-4100



"Kelly Cookson" <KCookson@xxxxxxxxxxxx>
Sent by: web400-bounces@xxxxxxxxxxxx
09/25/2009 05:06 PM
Please respond to
Web Enabling the AS400 / iSeries <web400@xxxxxxxxxxxx>


To
"Web Enabling the AS400 / iSeries" <web400@xxxxxxxxxxxx>
cc

Subject
Re: [WEB400] PHP and microsoft sql server






Yes. Open iSeries Navigator and go to this folder:

/usr/local/Zend/Core/etc

Look for the file named:

freetds.conf

Make a copy of the file for backup. Then open the file for editing (I
move it to my desktop and use NotePad). Scroll down to the bottom of the
file. You need to make an entry like this one:

# SQL Server database named MYDATA (Microsoft SQL Server 2000
configuration)
[MYDATA]
host = myserver.mydomain.com
port = 1433
tds version = 8.0

Look at the examples and be sure to use the format appropriate for your
version of SQL Server. Save the configuration file.

The PHP code looks something like this:

$conn = mssql_connect('MYDATA','username','password');
if ($conn) {
mssql_select_db("MYDATA");
$query = "SELECT * FROM MYTABLE";
$result = mssql_query($query);
$row = mssql_fetch_array($result);
<process $row as desired>
}

Hope this helps.
Kelly

-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx]
On Behalf Of Larry Kleinman
Sent: Friday, September 25, 2009 3:48 PM
To: Web Enabling the AS400 / iSeries
Subject: [WEB400] PHP and microsoft sql server

Is there something special that needs to be done in order to have a PHP
script - running either on Zend or on a non-system i server - talk to
SQL
Server?


Larry Kleinman
Kleinman Associates, Inc.
212-949-6469
203-255-4100

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.