faqts : Computers : Programming : Languages : PHP : Database Backed Sites : ODBC

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

11 of 14 people (79%) answered Yes
Recently 2 of 4 people (50%) answered Yes


Why does php3.exe crash when calling odbc_do with no errors logged or explanation when I try to query a SQL Server 7.0 database?
How can i search for a pattern , the data stored in a image datatype, i used to store long text data

Feb 7th, 2008 21:14
dman, Deepak Bansal, Ian Smith, Rachit Bagda, Jeff Connolly, Nathan Wallace, Manish Kaushik, http://sturly.com

When querying SQL Server if the table you query has either of these
two blob fields: Image or ntext, odbc_do will quit without giving any
error or explanation.  This will crash php as well.  I don't know of a
solution to this problem other than avoiding using the Image or ntext
objects.  When using the mssql_query function to retrieve an image
field, php throws an exception and then shuts down.  When using the
mssql_query function to return an ntext field, SQL Server 7.0 denies 
request and returns an error message to php.
You can duplicate the error by using an odbc connection to SQL Server
7.0 and querying the provided Northwind database Employee table for the
fields Picture or Notes.  Or by using the mssql_query function to do 
In fact, a better solution than avoiding the fields is to issue the 
following SQL command before performing your query:
where nnnnnnnn is the maximum size you think you will require.
I was having a problem retrieving LONG fields thru SQL Server where it 
would just crash and this solved the problem.
I had an ntext field which I couldn't just avoid using and i was able 
to set the textsize to 800,000 and retrieve all my very long text 
I can't say whether or not this will work for image blobs but it 
definitely works for ntext.
Jeff Connolly
[email protected]
Searching for patterns is generally performed by using wildcards
surrounding whatever pattern you are looking for. In ANSI SQL, _ is a
single character wildcard and % is a wildcard of unknown length. The
filesystem equivalents are ? and * respectively.
More information than that will probably require more information in 
question :)
Ian Smith