seo-kw opened a new issue #76:
URL: https://github.com/apache/incubator-age/issues/76


   Hello there, I got some trouble in using JDBC preparestatement. So I want to 
share about my experiences. 
   
   I have been confused rather am I doing something wrong or is it a bug. So, I 
just write down those phenomena.
   
   1. Querystring
   
      1. PrepareStatement
   
         ```java
         PreparedStatement pstmt  = 
connectionHelper.createConnection().prepareStatement(
                "select * from cypher('a', $$ "+
                "match (a) where id(a) = ? return properties(a)" +
                "$$) as (a agtype););"
         pstmt.setString(1, "281474976710667");  //character '?' is replaced to 
281474976710667
         ```
   
      2. Prepared Statements Preparation & Execution in "Apache_AGE_Guide.pdf"
   
         ```java
         PreparedStatement pstmt = 
connectionHelper.createConnection().prepareStatement(
                     "PREPARE cypher_stored_procedure(agtype) AS  " +
                     "select * " +
                                "from cypher('a', $$ " +
                                "match (a)  " +
                                "where a.id = $id " +
                                "return properties(a) " +
                                "$$, $1) as (a agtype);" +
                                "EXECUTE cypher_stored_procedure(('{\"id\": \" 
? \"}'))");
         pstmt.setString(1, "844424930131976");  // character '?' is replaced 
to 844424930131976
         ```
   
   2. Error message 
   
      Both of them got the same out of index error. because they aren't 
replaced to other strings which is what we want to replace. 
(org.postgresql.util.PSQLException: The column index is out of range: 1, number 
of columns: 0.)
   
   3. Suggestion
   
      I asked about these errors to a coworker and understood why those errors 
were thrown. Because of accurate error showing, you guys did so.
   
      I concluded dollar-quoted strings are not to be replaced now. But JDBC 
standards compatibility is a kind of important thing about normal users. And 
AGE is an extension of Postgres. So how about some another route about 
preparestatement supporting?
   
   4. Conclusion
   
      I am waiting for your opinion. or maybe you want some specific things 
about this article. then, feel easy to tell me. I would happily append more 
detailed info.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to