Hello, I would connect a java application via the JDBC driver jconn3.jar to my database SQL Anywhere v12. Unfortunatly, I discovered that the method named getParameterMetaData returns null. PreparedStatement pstmt = con.prepareStatement(MY_QUERY); ParameterMetaData paramMetaData = pstmt.getParameterMetaData(); paramMetaData -> null The JDBC driver named jconn3.jar is it valid ? Is there a workaround? Thank you for your answer. Gabriel |
Thanks for all your answers. I reorganized my project. Thus, I don't need anymore a JDBC 4.0 driver to connect myself to a SQL Anywhere database. I have asked the Sybase support about the JDBC drivers and here is their answer: I confirm you that jconn3.jar from jConnect 6.0.5 is a Type 4 JDBC driver. The JDBC specification identifies four types of JDBC drivers, from the Type 1 "JDBC-ODBC bridge" to the Type 4 "pure Java" driver. SQL Anywhere includes JDBC 3.0 and 4.0 drivers, which are Type 2 JDBC drivers, and also supports the jConnect driver for pure Java applications, which is a Type 4 JDBC driver. JDBC applications http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.help.sqlanywhere.12.0.1/dbprogramming/sa9b6fb370-66fc-400e-9334-208ea33eecab.html
In conclusion, there is no JDBC driver for SQL Anywhere which support the paramMetaData. |
I'm not a JDBC expert, but I know we typically recommend the SQL Anywhere JDBC driver over the JConnect driver I believe you are using. I'm not sure if the SQL Anywhere JDBC driver specifically implements the ParamaterMetaData call you are trying to use, but it is likely worth a try. See "SQL Anywhere JDBC Driver" in the documentation, for example: http://dcx.sybase.com/index.html#1201/en/dbprogramming/jdbc-odbc-bridge-jdbc.html |
Thank you for the answer. I run the sample database named demo.db: I executed the Upgrade Database Wizard. Despite the wizard told me that the jconnect support is already installed in my database, I finished the upgrade. It still not works. Then, I executed the query you have mentionned in the tool named "Interactive SQL". And sadly, I'm still not able to get a ParameterMetaData. Here is the java code I run: You may try on the same sample database with this command: I agree; it seems that this object returns null in this use-case from my experiments as well. It should be noted that the ParameterMetaData call is not mandatory or standardized for JDBC 3.0 implementations (See: http://books.google.com/books?id=a8W8fKQYiogC&lpg=PA192&ots=ojZLBy70CM&pg=PA185#v=onepage&q&f=false ), hence the structure of the code samples you have seen elsewhere.
(07 Sep '11, 15:25)
Jeff Albion
|