I am trying to create some PHP reports on a linux server pulling data from
a SQL Server v.8 running on IIS. I am able to connect, but when I try to 
execute the query I get the following:

Warning: odbc_exec(): SQL error: [EMAIL PROTECTED] \ufffdE\ufffd, SQL state 
00000 in 
SQLExecDirect in /var/www/html/sqltest.php on line 14

If anyone  has an answer or suggestions, I would greatly appreciate hearing 
them. Below is a breakdown of my environment.

++Linux: (Red Hat Enterprise Linux 4.4)+++++++++++++++++++++++++++++++++++++

++PHP: (PHP 5.1.2-5)+++++++++++++++++++++++++++++++++++++++++++++++++++
== /etc/php.d/odbc.ini ===================================================
extension=odbc.so  (found in /usr/lib/php/modules/ )

== PHP Code =========================================================
// connect to a DSN "MSSQLTestServer" 
$DSN = "MSSQLTestServer";
$db_usr = "genUsr";
$db_pwd = "genPwd";

$connect = odbc_connect($DSN, $db_usr, $db_pwd) or die
  ("couldn't connect");
 
// query the users table for count of records
$query = "select * from tableX";

// perform the query
$result = odbc_exec($connect, $query) or 
  die('<br>'.odbc_errormsg());

// fetch the data from the database
while(odbc_fetch_row($result)) {
$field1 = odbc_result($result, 1);
print("$field1 \n");
}

// close the connection
  odbc_close($connect);
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

++unixODBC: (unixODBC-2.2.12)++++++++++++++++++++++++++++++++++++++++++
== /usr/local/etc/odbcinst.ini
==============================================
[FreeTDS]
Description     = v0.65 with protocol v7.0
Driver          = /usr/local/lib/libtdsodbc.so
UsageCount      = 1
--------------------------------------------------------------------------

== /usr/local/etc/odbc.ini ===============================================
[MSSQLTestServer]
Driver          = FreeTDS
Description     = customer database
Trace           = No
Server          = 192.168.?.???
Port            = 1433
Database        = DLI
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

++freeTDS: (v0.65.dev.20061113)++++++++++++++++++++++++++++++++++++++++++++
== /usr/local/etc/freetds.conf
================================================
#
#
# The freetds.conf file is a replacement for the original interfaces
# file developed by Sybase.  You may use either this or the interfaces
# file, but not both.
#
# FreeTDS will search for a conf file in the following order:
#
#     1) check if a file was set programatically via dbsetifile() and
#        is in .conf format, if so use that,
#
#     2) otherwise, if env variable FREETDSCONF specifies a properly 
#        formatted config file, use it,
#
#     3) otherwise, look in ~/.freetds.conf,
#
#     4) otherwise, look in @sysconfdir@/freetds.conf
#
# If FreeTDS has found no suitable conf file it will then search for
# an interfaces file in the following order:
#
#     1) check if a file was set programatically via dbsetifile() and 
#        is in interfaces format, if so use that,
#
#     2) look in ~/.interfaces
#
#     3) look in $SYBASE/interfaces (where $SYBASE is an environment
#        variable)
#
# Only hostname, port number, and protocol version can be specified
# using the interfaces format.
#
# The conf file format follows a modified Samba style layout.  There
# is a [global] section which will affect all database servers and
# basic program behaviour, and a section headed with the database
# server's name which will have settings which override the global
# ones.
#
# Note that environment variables TDSVER, TDSDUMP, TDSPORT, TDSQUERY, 
# and TDSHOST will override values set by a .conf or .interfaces file.
#
# To review the processing of the above, set env variable TDSDUMPCONFIG
# to a file name to log configuration processing.
#
# Global settings, any value here may be overridden by a database
# server specific section
[global]
        # TDS protocol version
        tds version = 7.0

;       initial block size = 512

        # uses some fixes required for some bugged MSSQL 7.0 server that
        # return invalid data to big endian clients
        # NOTE TDS version 7.0 or 8.0 should be used instead
;       swap broken dates = no
;       swap broken money = no

        # Whether to write a TDSDUMP file for diagnostic purposes
        # (setting this to /tmp is insecure on a multi-user system)
        dump file = /tmp/dump.log
;       debug flags = 0xffff

        # Command and connection timeouts
;       timeout = 10
;       connect timeout = 10
        
        # If you get out of memory errors, it may mean that your client
        # is trying to allocate a huge buffer for a TEXT field.  
        # (Microsoft servers sometimes pretend TEXT columns are
        # 4 GB wide!)   If you have this problem, try setting 
        # 'text size' to a more reasonable limit 
        text size = 64512

# This is a Sybase hosted database server, if you are directly on the
# net you can use it to test.
[JDBC]
        host = 192.138.151.39
        port = 4444
        tds version = 5.0

# The same server, using TDS 4.2.  Used in configuration examples for the
# pool server, since the pool server supports only TDS 4.2.
[JDBC_42]
        host = 192.138.151.39
        port = 4444
        tds version = 4.2

# The client connecting to the pool server will use this to find its
# listening socket.  This entry assumes that the client is on the same
# system as the pool server.
[mypool]
        host = 127.0.0.1
        port = 5000
        tds version = 4.2

# A typical Microsoft SQL Server 7.0 configuration      
;[MyServer70]
;       host = ntmachine.domain.com
;       port = 1433
;       tds version = 7.0

# Microsoft SQL Server v.8 configuration
[TDS]
        host = 192.168.?.???
        port = 1433
        tds version = 7.0

# A typical Microsoft SQL Server 2000 configuration
;[MyServer80]
;       host = some.domain.com
;       port = 1433
;       tds version = 8.0
        
# A typical Microsoft SQL Server 6.x configuration      
;[MyServer65]
;       host = ntmachine.domain.com
;       port = 1433
;       tds version = 4.2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- 
View this message in context: 
http://www.nabble.com/Strange-error-from-SQL-Server-tf2638254.html#a7364314
Sent from the Php - Database mailing list archive at Nabble.com.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to