PHP: Getting Text to Display from ODBC Database
Increasing the Default Size of odbc.defaultlrl in the php.ini File
If you have been frustrated by trying to output your long text data from a Microsoft SQL database via an ODBC connection you are not alone. The default setting for the odbc.defaultlrl (how odbc handles larger fields i.e. TEXT, IMAGE, NTEXT in MS SQL) isTo solve this problem you have to increase the size of the odbc.defaultlrl setting in the php.ini file. Located about half way down in the Module Settings section. You will see the chunk of code listed for ODBC. Change the odbc.defaultlrl = 4096 to a number great enough for need. I changed it to 60000 because I needed to work with documents that were approximately 4000 words in length. Here is the sample code from the php.ini file:
[ODBC]
;odbc.default_db = Not yet implemented
;odbc.default_user = Not yet implemented
;odbc.default_pw = Not yet implemented
; Allow or prevent persistent links.
odbc.allow_persistent = On
; Check that a connection is still valid before reuse.
odbc.check_persistent = On
; Maximum number of persistent links. -1 means no limit.
odbc.max_persistent = -1
; Maximum number of links (persistent + non-persistent). -1 means no limit.
odbc.max_links = -1
; Handling of LONG fields. Returns number of bytes to variables. 0 means
; passthru.
odbc.defaultlrl = 60000
; Handling of binary data. 0 means passthru, 1 return as is, 2 convert to char.
; See the documentation on odbc_binmode and odbc_longreadlen for an explanation
; of uodbc.defaultlrl and uodbc.defaultbinmode
odbc.defaultbinmode = 1
Related information
- The ODBC long text default is 4096 bytes.
- Changes made to the php.ini file
- This helps users connecting to PHP via an ODBC connection to a MS SQL database
Most Comments Today
- Cyber Attack Aftermath: Perplexed AC Exec Asks, "Why Us?" It's easy to guess why cyber attackers went after the White House and the Pen... 30 Comments
- Easy Napkin Folding Techniques Find easy napkin folding techniques that anyone can do. Butterfly fold, Bis... 26 Comments
- Frogg Toggs Chilly Pad: Product Review Use the Frogg Toggs Chilly Pad to stay cool this summer. Designed to keep yo... 26 Comments
- Hot News Quickies - Wednesday, July 8, 2009 News happens while you sleep - get your Hot News Quickies here! 23 Comments
- This is Not Love Many women all around the world are in an unhealthy relationship. In this sh... 22 Comments
- False Friends Between English and French English and French share a fair number of lexical false friends, i.e. words t... 21 Comments







Posted on 09/08/2008 at 1:09:56 PM
Posted on 07/27/2008 at 6:07:13 AM