Error trying to use Prepared Statements - MySQL

Trying to execute a prepared statement:

 

SELECT [...] INTO @prepared
FROM [...] WHERE [...]

This part executes fine.

PREPARE stmt FROM @prepared;

This part also executes fine.

 

EXECUTE stmt;

 

This returns an error back:
 

Could not retrieve transation read-only status server

 

The first thing I found was this answer from Stackoverflow. They mention that this JDCB option should be set. Locally, I have it setup this way (using Datagrip), and it works.
 

useServerPrepStmts=false
1reply Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • Hi Alan, sorry for the delay! It looks like this question was answered via our in-product chat, but to bring visibility I'll post the answer here as well! So it looks like the issue is with the comment at the very end of the query. This is a known bug where comments at the very end of queries at times lead errors to be generated. This is an internal Mode bug, and it is something that we are working to address long term, but in the short term simply removing the comment should allow the expected results to render. 

    Reply Like
Like Follow
  • 4 wk agoLast active
  • 1Replies
  • 144Views
  • 2 Following