Skip to Content.
Sympa Menu

freetds - [freetds] DB Connectivity & Character set Problem while connecting to MSSQL 7.0 server from Linux via PHP using FreeTDS

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Viswanathan" <viswanathan.natarajan AT patni.com>
  • To: <freetds AT lists.ibiblio.org>
  • Subject: [freetds] DB Connectivity & Character set Problem while connecting to MSSQL 7.0 server from Linux via PHP using FreeTDS
  • Date: Mon, 18 Oct 2004 13:36:57 +0530

Hi,


I am facing a problem with regards to DB connectivity using FreeTDS. I
checked the log freetds.log and I think
The problem is because of the character set that is returned by MSSQL not
being recognized by freeTDS .
The connection to Database works and returns a valid handle but while
querying the Database using this handle,
I get the following error.

Warning: mssql_query() [function.mssql-query]: WARNING! Some character(s)
could not be converted into client's character set. Unconverted bytes were
changed to question marks ('?'). (severity 16)

I am using MSSQL 7.0 and trying to connect to it via freetds version 8.0
form a Linux box running PHP.

My FreeTDS.conf looks like this



NAS - freetds.conf
#
#
# $Id: freetds.conf,v 1.9 2003/12/04 22:26:55 freddy77 Exp $
#
# 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 = 4.2

; 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

# Database server login method, if both server and domain
# logins are enabled, domain login is tried first if a domain
# is specified, and if that fails the server login will be used.
# OBSOLETE
; try server login = yes
; try domain login = no

# The default authentication domain, can be overridden by
# specifying a username with a domain prefix, e.g. DOMAIN\username
# OBSOLETE use DOMAIN\username as username
; nt domain = WORKGROUP

# If the server responds with different domain try that one?
# OBSOLETE never been used
; cross domain login = no

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

# 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

[cbsidbdv1corpge]
host = cbsidbdv1corpge.corporate.ge.com
port = 1433
tds version = 8.0

# A typical Microsoft SQL Server 2000 configuration
;[MyServer2k]
; Host = ntmachine.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





when i run sp_helpsort on DB host I get the following o/p

Unicode data sorting
----------------------
Locale ID = 1033

case insensitive, kana type insensitive, width insensitive


Sort Order Description
----------------------------------------------------------------------------
--------------------------------------------------------
Character Set = 2, cp850
Code Page 850 (Multilingual) character set.
Sort Order = 42, nocase_850
Case-insensitive dictionary sort order for use with several We
stern-European languages including English, French, and German
. Uses the Code Page 850 character set.

Characters, in Order
----------------------------------------------------------------------------
--------------------------------------------------------
! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | }
~  £ × ƒ ª º ¿ ® ¬ ½ ¼ ¡ « » ¦ ¦ ¦ ¦ ¦ © ¦ ¦ + + ¢ ¥ + + - - +
- + + + - - ¦ - + ¤ + + ¦ _ ¦ ¯ µ ¯ ´ ­ ± = ¾ ¶ § ÷ ¸ ° ¨ · ¹ ³
² ¦ 0 1 2 3 4 5 6 7 8 9 A=a à=À á=Á â=Â ã=Ã ä=Ä å=Å æ=Æ B=b C
=c Ç=ç D=d E=e è=È é=É ê=Ê ë=Ë F=f G=g H=h I=i ì=Ì í=Í î=Î ï=Ï i
J=j K=k L=l M=m N=n ñ=Ñ O=o ò=Ò ó=Ó ô=Ô õ=Õ ö=Ö ø=Ø P=p Q=q R=r
S=s ß T=t U=u ù=Ù ú=Ú û=Û ü=Ü V=v W=w X=x Y=y ý=Ý ÿ Z=z ð=Ð þ=Þ

appreciate any help on this.


thanks
viswa



------------------------------------------------------------------------------------------------------------------------
Disclaimer: This e-mail message along with attachment, contain Patni GE
Confidential, proprietary & legally privileged information for the sole use
of the person or entity to whom this message was originally addressed. Any
review, e-transmission dissemination or other use of or taking of any action
in reliance upon this information by persons or entities other than the
intended recipient is prohibited. If you have received this e-mail in error
kindly delete this e-mail from your records. If it appears that this mail has
been forwarded to you without proper authority, please notify the sender and
delete this mail. This email (in whole or in part) is not to be reproduced or
furnished to third parties or made public without the prior express written
permission of the sender.
------------------------------------------------------------------------------------------------------------------------



  • [freetds] DB Connectivity & Character set Problem while connecting to MSSQL 7.0 server from Linux via PHP using FreeTDS, Viswanathan, 10/18/2004

Archive powered by MHonArc 2.6.24.

Top of Page