📕🐘 도로락 - 코끼리를 냉장고에 넣는 방법
자바[Java] | 2018. 7. 23. 21:00

[Java] MySQL JDBC 연결시 예외 User does not have access to metadata required to determine stored procedure parameter types 해결 방법

Java로 JDBC 연결시 다음과 같은 예외를 마주할 수 있습니다.

java.sql.SQLException: User does not have access to metadata required to determine stored procedure parameter types. If rights can not be granted, configure connection with "noAccessToProcedureBodies=true" to have driver generate parameters that represent INOUT strings irregardless of actual parameter types.
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1084)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987)

조치사항으로는 두 가지가 있습니다. 첫번째로 MySQL에서 해당 커넥션 연결 사용자에 대해 권한을 부여해야 하고, 두번째로는 예외 메시지에 나와있듯이 JDBC Connection 연결 정보 URL에 noAccessToProcedureBodies=true 옵션을 추가해주어야 합니다.

1. 권한 추가

다음과 같이 권한을 추가합니다.

GRANT ALL PRIVILEGES ON [DB 또는 *].* TO '계정'@'접근 허용 대상' IDENTIFIED by '비밀번호'

예시:

GRANT ALL PRIVILEGES ON springdb.* TO 'springuser'@'%' IDENTIFIED by '123456';

2. JDBC URL 설정

JDBC URL 설정에 noAccessToProcedureBodies=true 옵션을 추가합니다.

jdbc:mysql://192.168.111.128:3306/springdb?noAccessToProcedureBodies=true
도로락

도로락

Writer

IT, 프로그래밍, 컴퓨터 활용 정보 등을 위한 블로그