Hi,
Please, I would like to know the correct sintaxis for calling a stored
procedures in MonetDB from a Java application. I was using some code that
works fine in MySQL but this doesn't work in MonetDB. The code inside a
method is:
-------------------------------------------------------------------
Connection con = null;
ResultSet rs = null;
CallableStatement cs = null;
cs = con.prepareCall("{call hts.spInsertFile(?)}");
File fl = new File("/home//Test/example.pdf");
imgfile = new FileInputStream(fl);
cs.setBinaryStream(1,imgfile);
rs = cs.executeQuery();
-------------------------------------------------------------------
When I execute the stored procedure from Netbeans IDE the stored procedure
works fine. I've made a trace in the application and the statement:
con.prepareCall("{call hts.spInsertFile(?)}"); returns null and finally
throws an exception:
Exception in thread "main" java.lang.NullPointerException
at testmonetdb.DBase.set_file(DBase.java:86)
at testmonetdb.MonetDBTest.main(MonetDBTest.java:34)
The MonetDB version I'm using is:
MonetDB 5 server v11.3.7 "Apr2011-SP2" (64-bit, 64-bit oids)
Copyright (c) 1993-July 2008 CWI
Copyright (c) August 2008-2011 MonetDB B.V., all rights reserved
Visit http://monetdb.cwi.nl/ for further information
Found 3.9GiB available memory, 4 available cpu cores
Libraries:
libpcre: 8.12 2011-01-15 (compiled with 8.10)
openssl: OpenSSL 1.0.0d 8 Feb 2011 (compiled with OpenSSL 1.0.0d-fips 8
Feb 2011)
libxml2: 2.7.7 (compiled with 2.7.7)
Compiled by: mockbuild@ (x86_64-unknown-linux-gnu)
Compilation: gcc -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -O6
-fomit-frame-pointer -finline-functions
-falign-loops=4 -falign-jumps=4 -falign-functions=4
-fexpensive-optimizations -funroll-loops
-frerun-cse-after-loop -frerun-loop-opt -ftree-vectorize
Linking : /usr/bin/ld -m elf_x86_64
I'm also using Netbeans IDE 7.1 with the jdbcclient.jar
(http://dev.monetdb.org/downloads/Java/Oct2010-SP1/)
Thanks in advance for your help,
Enrique.
--
View this message in context: http://old.nabble.com/Calling-a-stored-procedure-from-java-tp32431606p32431…
Sent from the monetdb-users mailing list archive at Nabble.com.