Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error with varchar(max) column when using net.sourceforge.jtds.jdbc.Driver

Tags:

sql

solr

jdbc

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?

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

like image 542
Rihan Meij Avatar asked Oct 18 '25 14:10

Rihan Meij


2 Answers

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" />
like image 192
Rihan Meij Avatar answered Oct 20 '25 03:10

Rihan Meij


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.

like image 43
Russell H Avatar answered Oct 20 '25 04:10

Russell H