Sloppy
Sloppy

Reputation: 143

Reason for "Invalid JDBC escape syntax at line position 24 '=' character expected" error when executing SQL Server call through JTDS driver?

I am trying to execute the following piece of SQL on SQL Server 2012, using a Java program, connecting to the database with the JTDS driver:

Declare @username varbinary(128); 
SET @username=convert(varbinary(128), ?); 
SET CONTEXT_INFO @username; 

I always get the following error:

Invalid JDBC escape syntax at line position 24 '=' character expected.

Any ideas?

Upvotes: 1

Views: 6127

Answers (1)

Shachaf.Gortler
Shachaf.Gortler

Reputation: 5735

I believe you are missing quotations marks around ?

SET @username=convert(varbinary(128), '?'); 

Upvotes: 1

Related Questions