Backend/SPRING

Caused by: java.sql.SQLSyntaxErrorException: (conn=84) Could not set parameter at position...

GreatSaiyaman 2022. 5. 31. 19:14
Caused by: java.sql.SQLSyntaxErrorException: (conn=84) Could not set parameter at position...

제가 오늘 너무 황당한 오류를 겪어서 기재해 놓으려고 합니다.

물론 전적으로 휴먼에러이고... 제 잘못인데요, 구글링으로 검색해보면..

https://stackoverflow.com/questions/48070781/exception-java-sql-sqlexception-could-not-set-parameter-at-position-whit

 

Exception java.sql.SQLException: Could not set parameter at position (...). whit mariadb

The following code throws an exception to me, by using the mariadb manager, this with mysql not passed, allows me to do executeUpdate, but not executeQuery. The truth I have sought the solution and...

stackoverflow.com

위 링크에서 이런저런 솔루션을 보면, 혹시 파라미터 값으로 잘못 넣어준 것 아니냐 혹은 물음표를 조심해서 사용하라고 하죠.

그런데 저 같은 경우 마이바티스 쿼리들 안에 주석으로 아래와 같은 문자열을 넣었었습니다.

 

.
.
WHERE TB_CAT.CAT_AUTH = 'Y' -- #{catAuthOrNot}
.
.

저는 당연히 -- 처리를 하여 주석 처리를 했기 때문에 아무 문제없을 줄 알았습니다.

'혹시나' 하는 마음에 주석을 지워보았는데 에러가 말끔하게 사라졌습니다.

저의 사라진 2시간이.. 나중에 반복되지 않도록 기록용으로 남겨 둡니다....

감사합니다.