Thank you!
On Friday, April 11, 2014, Hannes Mühleisen <Hannes.Muehleisen@cwi.nl> wrote:
Hello Phat (and list),
while looking at this, I found a bug in the setClob() method that includes the length parameter. So this does currently not work at all. See the bug [1] for details and updates.
Best,
Hannes
[1] http://bugs.monetdb.org/show_bug.cgi?id=3470
On 04/11/2014 10:32 AM, Hannes Mühleisen wrote:
Hi Phat,
thanks for the clarification. From looking at the code, the setClob
method is not supported if no length of the content in the reader is
given. So, to make it work, you can explicitly set the length of the
content in the reader.
stmt.setClob(1, new StringReader("ABCDEDFG"),8);
From looking at the Reader interface [1], it is possible to read until
the end of the content is reached. I have filed this as Bug 3470 [2].
Best,
Hannes
[1] http://docs.oracle.com/javase/7/docs/api/java/io/Reader.html
[2] http://bugs.monetdb.org/show_bug.cgi?id=3470
On 04/10/2014 06:55 PM, Phat Loc wrote:
Does not work for prepared statements. See below.
package jdbcForMonetdb;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.PreparedStatement;
import java.io.StringReader;
import java.sql.Statement;
public class TestCall {
public static void main(String[] args) {
try {
Class.forName("nl.cwi.monetdb.jdbc.MonetDriver");
Connection con = DriverManager
.getConnection("jdbc:monetdb://localhost:50000/acs",
"monetdb", "monetdb");
PreparedStatement stmt = con.prepareStatement("insert into
clobtest values(?);");
stmt.setClob(1, new StringReader("ABCDEDFG"));
stmt.execute();
con.close();
//ResultSet rs = stmt.executeQuery("select a from
clobtest");
//if (rs.next()) System.out.println("JDBC Result:
"+rs.getClob(1));
} catch (Exception e) {
e.printStackTrace();
}
}
}
-------------------------
/usr/lib/jvm/java-7-oracle/bin/java
-agentlib:jdwp=transport=dt_socket,address=127.0.0.1:56499
<http://127.0.0.1:56499>,suspend=y,server=n -Dfile.encoding=UTF-8
-classpath
/usr/lib/jvm/java-7-oracle/jre/lib/deploy.jar:/usr/lib/jvm/java-7-oracle/jre/lib/rt.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jfxrt.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jce.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jsse.jar:/usr/lib/jvm/java-7-oracle/jre/lib/plugin.jar:/usr/lib/jvm/java-7-oracle/jre/lib/resources.jar:/usr/lib/jvm/java-7-oracle/jre/lib/javaws.jar:/usr/lib/jvm/java-7-oracle/jre/lib/management-agent.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jfr.jar:/usr/lib/jvm/java-7-oracle/jre/lib/charsets.jar:/usr/lib/jvm/java-7-oracle/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-7-oracle/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-7-oracle/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-7-oracle/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-7-oracle/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-7-oracle/jre/lib/ext/sunec.jar:/home/ploc/IdeaProjects/jdbcForMonetdb/out/production/jdbcForMonetdb:/home/ploc/Downloads/monetdb-jdbc-2.10.jar:/home/ploc/Downloads/idea-IC-135.480/lib/idea_rt.jar
jdbcForMonetdb.TestCall
Connected to the target VM, address: '127.0.0.1:56499
<http://127.0.0.1:56499>', transport: 'socket'
java.sql.SQLFeatureNotSupportedException: setClob(int, Reader) not
supported
at
nl.cwi.monetdb.jdbc.MonetPreparedStatement.setClob(MonetPreparedStatement.java:1280)
at jdbcForMonetdb.TestCall.main(TestCall.java:20)
On Thu, Apr 10, 2014 at 3:32 AM, Hannes Mühleisen
<Hannes.Muehleisen@cwi.nl <mailto:Hannes.Muehleisen@cwi.nl>> wrote:
Hello Phat,
On 04/09/2014 10:11 PM, Phat Loc wrote:
I am not able to get Blob and Clob to work in JDBC v 2.10? I
get a<