[CONJ-523] java.sql.SQLException: Could not set parameter at position 1 (values was 'admin') Created: 2017-09-12  Updated: 2017-11-20  Resolved: 2017-11-20

Status: Closed
Project: MariaDB Connector/J
Component/s: JDBC 4.2 compatibility
Affects Version/s: 2.1.1, 1.6.4
Fix Version/s: N/A

Type: Bug Priority: Blocker
Reporter: banesh banna Assignee: Diego Dupin
Resolution: Cannot Reproduce Votes: 0
Labels: None
Environment:

java 1.8 with 2.1.1 version binary.
java 1.7 with 1.6.4 version binary.



 Description   

Query Execution failed with below error.

java.sql.SQLException: Could not set parameter at position 1 (values was 'admin')

below query we are using.
SELECT CONCAT('<img style=\"width:30px;height:26px;\" src=\"http://${ip}/assets/logos/',IF(image_url IS NULL OR image_url=\"\",'${IP}/assets/images/default-logo.gif',image_url),'\"onmouseout=\"funCloseLogoImage()\" onmouseover=\"funOpenLogoImage(event,\\'',\"${IP}/assets/logos//\",IF(image_url IS NULL OR image_url=\"\",'${IP}/assets/images/default-logo.gif',image_url),'\\')\" style=\"width:30px;height:26px;\"') AS imageurl,CONCAT(' <img class=\"updatePandL\" src=\\'${IP}/as/icons/Edit.png
' alt=
'Edit
' title=
'Edit
' onclick=\"funEdit(
'', CAST(id AS CHAR),'\\')\");\"/> <img class=\"deletePandL\" src=\\'${IP}/Delete.png
' alt=\\'View
' title=
'Delete
' onclick=\"funDelete(
'', CAST(id AS CHAR),''',''',pl_name,'\\')\");\"/>') AS Actions table WHERE 1=1 AND created_by=?

same query executing in 1.5.9 version



 Comments   
Comment by Diego Dupin [ 2017-09-12 ]

Trying to reproduced without success for the moment.
Could you please send connection string and server variable @SQL_MODE ?

Error i have is (normal since there is no FROM keyword) :

java.sql.SQLSyntaxErrorException: (conn=1521) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'table WHERE 1=1  AND created_by='t'' at line 1
	at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:146)
	at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:107)
	at org.mariadb.jdbc.MariaDbStatement.executeExceptionEpilogue(MariaDbStatement.java:235)
	at org.mariadb.jdbc.MariaDbPreparedStatementClient.executeInternal(MariaDbPreparedStatementClient.java:224)
	at org.mariadb.jdbc.MariaDbPreparedStatementClient.execute(MariaDbPreparedStatementClient.java:159)
	at org.mariadb.jdbc.Testt.tt(Testt.java:36)

Comment by Diego Dupin [ 2017-11-20 ]

closing since unable to reproduce error and no answer since 2 month.
Feel free to re-open it if issue occur.

Generated at Thu Feb 08 03:16:18 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.