Query with newline character fails - by ajaykumarks

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


1
0
Sign in
to vote
ID 735610 Comments
Status Closed Workarounds
Type Bug Repros 1
Opened 4/5/2012 6:39:15 AM
Access Restriction Public

Description

Web 2.0 application allows users to enter SQL into a text box and submit it to a SQL Server backend.  One of our users reported a failure submitting a simple query.  It turns out the problem is that there is a newline character proceeding the from clause, when this is removed the error does not occur.  The call throwing the exception is getParameterMetaData().  

Using Cut N Paste from a UNIX envrionment the end of line (EOL) is a newline (\n).  The parser does not seem to recognize these as a delimiter and failes to parse the query properly.

Execute the attached program using the following command - the logon specified must be able to create and delete tables in the database.  

You supply the connection URL for the SqlServer you will be using to run the test.  The required tables are created, populated with data and then deleted.  The output from the program is below.  I have annotated the output in this font:     

java ParamMetaDataProblem "jdbc:sqlserver://<serverHost>:<port>;databaseName=<DBname>;user=<username>;password=<password>" 

... 

* java -cp .\sqljdbc4.jar;.;%CLASSPATH% ParamMetaDataProblem "jdbc:sqlserver://sqlHost:1433;databaseName=dbname;user=adm;password=xxx" 


Sign in to post a comment.
Posted by Microsoft on 4/5/2012 at 3:04 PM
Thank you for your feedback, we will look into it.