Error with varchar(max) column when using net.sourceforge.jtds.jdbc.Driver
I have a MS SQL database running (MS SQL 2005) and am connecting to it via the net.sourceforge.jtds.jdbc.Driver.
The query works fine for all the columns except one that is a varchar(max). Any ideas how to get around this issues?
开发者_JAVA百科I am using the jdbc driver to run a data index into a SOLR implementation.
(I do not control the database, so the first prize solution would be where I can tweak the SQL command to get the desired results)
Thanks
I have found what looks to be a answer. In setting up the driver for the connection to SQL server I did not specify useLobs=false. I am a bit worried about what this will mean for performance, but at least for now it works.
<dataSource
driver="net.sourceforge.jtds.jdbc.Driver"
url="jdbc:jtds:sqlserver://server/database;useLOBs=false"
user="user"
password="password" />
I had the same problem with connecting to MS SQL 2K3. The useLOBs=false did not work for me, but changing the SELECT to CAST(Name AS varchar(255))'Name'
worked for me.
精彩评论