2

Firstly, my cconfig is:
Language: ColdFusion 10(and installed update 11)
DB is MS SQL Server 2012
Using the jtds jdbc(tried versions 1.2.6, 1.2.8 and 1.3.0)

I'm currently having a problem running queries where I use cfqueryparam with a cfsqltype of cf_sql_nvarchar. The problem is the page just hangs. If I look at the application log of ColdFusion, I see the error of: "net.sourceforge.jtds.jdbc.JtdsPreparedStatement.setNString(ILjava/lang/String;)V The specific sequence of files included or processed is:" followed by the test filename.

I'm running a very basic select query on a nvarchar column, but the page doesn't load and that error is logged.

I know it's gotta be something to do with the jtds jdbc as if I connect through the regular sql driver it'll work perfectly.

So did anybody experience this before? If so, what was your resolution?

Thanks

seraph
  • 33
  • 2

2 Answers2

2

I did a quick search and the results suggest jtds does not support setNString(). I checked the driver source for 1.3.1, and as mentioned in the comments here the method is not implemented:

"..while getNString is implemented the code just consists of // TODO Auto-generated method stub and throw new AbstractMethodError();.."

So it sounds like you may need to use cf_sql_varchar, combined with the "String Format" setting, like in previous versions. Obviously, the other option is to use a different driver (one that does support setNString(), such as Adobe's driver or the MS SQL Server driver).

Community
  • 1
  • 1
Leigh
  • 28,765
  • 10
  • 55
  • 103
  • Thanks, that does suggest that I can give up my search and wait for a newer version of the driver, but what confuses me is why they don't have it added it to the driver since it already does it by default. Like if I don't set sendStringParametersAsUnicode=false, then all the string parameters will be passed as nvarchar. It's like you can have either all string parameters nvarchar or all varchar, but never both for the same database – seraph Aug 26 '13 at 16:19
  • (Edit - I misread your response). Well, unfortunately yes. Since `setNString` is not implemented, the all-or-nothing sendStringParametersAsUnicode flag is the only option afaik. – Leigh Aug 26 '13 at 16:30
1

Try using cf_sql_varchar. cf_sql_nvarchar is not a valid option according to the Documentation and you should use cf_sql_varchar

Scott Stroz
  • 7,510
  • 2
  • 21
  • 25
  • Scott - Unfortunately, that section of the documentation is wrong (and so is the above ;-). The [new sqltype is mentioned here](http://help.adobe.com/en_US/ColdFusion/10.0/Developing/WSc3ff6d0ea77859461172e0811cbec0e02b-7ff3.html#WSe61e35da8d318518-9efe7cf1358680a71d-7ffe). – Leigh Aug 26 '13 at 16:06
  • As Leigh said, they added it in CF10, but the documentation doesn't really reflect it that well – seraph Aug 26 '13 at 16:07
  • Yeah, once again the main docs lag behind the current release, but it is mentioned in the link above (where most people would not think of looking for it) :/ – Leigh Aug 26 '13 at 16:09
  • It's also worth mentioning that it does work if you don't use the jtds driver. cf_sql_nvarchar will work if you use the default ms sql driver – seraph Aug 26 '13 at 16:22
  • 1
    Yes, both Adobe and Microsoft's SQL Server driver support it. So if you are not tied to jtds, that is another alternative. – Leigh Aug 26 '13 at 16:54