{"record":{"id":"aa1e58eeee99fc4b","repo":"prestodb/presto","slug":"not-implemented-preparedstatement-getparametermet","errorCode":null,"errorMessage":"Not implemented: PreparedStatement.getParameterMetaData","messagePattern":"Not implemented: PreparedStatement\\.getParameterMetaData","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"warning","filePath":"presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoPreparedStatement.java","lineNumber":561,"sourceCode":"    @Override\n    public void setNull(int parameterIndex, int sqlType, String typeName)\n            throws SQLException\n    {\n        setNull(parameterIndex, sqlType);\n    }\n\n    @Override\n    public void setURL(int parameterIndex, URL x)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"setURL\");\n    }\n\n    @Override\n    public ParameterMetaData getParameterMetaData()\n            throws SQLException\n    {\n        throw new NotImplementedException(\"PreparedStatement\", \"getParameterMetaData\");\n    }\n\n    @Override\n    public void setRowId(int parameterIndex, RowId x)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"setRowId\");\n    }\n\n    @Override\n    public void setNString(int parameterIndex, String value)\n            throws SQLException\n    {\n        setString(parameterIndex, value);\n    }\n\n    @Override\n    public void setNCharacterStream(int parameterIndex, Reader value, long length)","sourceCodeStart":543,"sourceCodeEnd":579,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoPreparedStatement.java#L543-L579","documentation":"PrestoPreparedStatement.getParameterMetaData throws NotImplementedException because the driver does not implement JDBC ParameterMetaData retrieval. Presto's wire protocol does not expose prepared-statement parameter metadata in the way this API requires. Code that introspects parameter types/count at runtime will always fail.","triggerScenarios":"Calling PreparedStatement.getParameterMetaData() on a PrestoPreparedStatement; ORM frameworks that call getParameterMetaData to validate or coerce bind values before executing a statement.","commonSituations":"Hibernate/JPA dialects or Spring JdbcTemplate wrappers that probe parameter metadata; generic JDBC tools (SQuirreL, DBeaver style code paths) inspecting statement parameters against Presto.","solutions":["Avoid calling getParameterMetaData; determine parameter count and types from the SQL and schema instead","Wrap the call in a feature check / catch NotImplementedException and fall back to schema-derived metadata","Upgrade the Presto JDBC driver in case a newer version implements the API"],"exampleFix":"// before\nParameterMetaData pmd = pstmt.getParameterMetaData();\nint count = pmd.getParameterCount();\n// after\nint count = countPlaceholders(sql); // derive from SQL text or known schema","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"boolean supportsParameterMetaData(DatabaseMetaData dmd) { try { return dmd.supportsGetGeneratedKeys() && !dmd.getDatabaseProductName().contains(\"Presto\"); } catch (SQLException e) { return false; } }","tryCatchPattern":"try (ParameterMetaData pmd = pstmt.getParameterMetaData()) { use(pmd); } catch (SQLFeatureNotSupportedException | NotImplementedException e) { fallBackToSchemaDerivedMetadata(); }","preventionTips":["Do not rely on getParameterMetaData in code paths that must run against Presto","Derive parameter count/types from the SQL text and Presto catalog metadata instead","Guard optional JDBC capabilities behind feature checks per product"],"tags":["jdbc","unsupported-feature","metadata"],"backgroundTag":"not-implemented-jdbc","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}