Just looking at the code, it seems to expect a query in a parameter called
SQL (something like "select * from user where first_name=? and last_name =
?" and a list of parameters where the first parameter would be the first
name (in this specific case), the second parameter would be the last name.
List of lists won't work because it will try to stick the first array into
the first parameter of the query -- hence the error you were getting.
If you want to load multiple rows of data, then you need to iterate over
your list, calling the SQLUpdateWorker once per update.
Hope this helps,
Mark
On Fri, Nov 20, 2009 at 12:58 PM, Kevin Crowston <[email protected]> wrote:
> I'm trying to have my workflow write its results to a database using the
> jdbc java widget and am running into problems. I'm using Taverna 1.7.2.1 on
> the Mac; AFAIK, Taverna 2 does not support jdbc at all, so switching is not
> an option.
>
> After much thrashing about, I believe that the SQLUpdateWorker code has a
> bug--it does not work if the params list is not given. There's no error
> reported in Taverna, but there is a backtrace in the system log (see
> [Attach1] below) that complains about a null pointer. Comparing the code for
> SQLUpdateWorker [1] to SQLQueryWorker [2], I noticed that the later tests
> for params being null, which the former does not (line 118 of SQLQueryWorker
> tests params!=null, which is missing from the corresponding line 83 of
> SQLUpdateWorker). (The code on SourceForge is two years old, but the problem
> seems to still be there.) Presumably this would be trivial to fix, except I
> don't know how to compile java source to a working program (perhaps that's
> documented somewhere?).
>
> Anyway, once I found this problem, I rewrote my workflow, adding a bean
> shell to create an ArrayList of the various values to pass to the params
> port of the SQLUpdate. Actually, it gets a list of lists, as the whole thing
> is iterated, but the status suggests that the SQLUpdate will also be
> iterated, so I think it's okay. But this also doesn't work, throwing a
> java.lang.ArrayStoreException on the first pass for some reason that I can't
> figure out. Again, there's no error visible in Taverna, but there is a
> backtrace in the system log--see attachment 2.
>
> So, any chance the first bug will be fixed? Or advice about what's going on
> in the second case?
>
>
> References
>
> [1]
> http://taverna.cvs.sourceforge.net/viewvc/taverna/taverna1.0/taverna-contrib/src/main/java/net/sourceforge/taverna/scuflworkers/jdbc/SQLUpdateWorker.java?revision=1.3&view=markup
>
> [2]
> http://taverna.cvs.sourceforge.net/viewvc/taverna/taverna1.0/taverna-contrib/src/main/java/net/sourceforge/taverna/scuflworkers/jdbc/SQLQueryWorker.java?revision=1.5&view=markup
>
>
> Attachments
>
> [Attach1] Backtrace from system log calling Execute SQLUpdate with no
> params:
>
> 20/11/09 11:45:34 AM [0x0-0x138138].Taverna[56288] ERROR 2009-11-20
> 11:45:34,527 Failed while iterating Thread[Processor worker insert_data
> #0,6,main]
> 20/11/09 11:45:34 AM [0x0-0x138138].Taverna[56288]
> java.lang.NullPointerException
> 20/11/09 11:45:34 AM [0x0-0x138138].Taverna[56288] at
> net.sourceforge.taverna.scuflworkers.jdbc.SQLUpdateWorker.execute(SQLUpdateWorker.java:83)
> 20/11/09 11:45:34 AM [0x0-0x138138].Taverna[56288] at
> org.embl.ebi.escience.scuflworkers.java.LocalServiceTask.execute(LocalServiceTask.java:31)
> 20/11/09 11:45:34 AM [0x0-0x138138].Taverna[56288] at
> uk.ac.soton.itinnovation.taverna.enactor.entities.ProcessorTask.runAndGenerateTemplates(ProcessorTask.java:585)
> 20/11/09 11:45:34 AM [0x0-0x138138].Taverna[56288] at
> uk.ac.soton.itinnovation.taverna.enactor.entities.ProcessorTask.doInvocationWithRetryLogic(ProcessorTask.java:524)
> 20/11/09 11:45:34 AM [0x0-0x138138].Taverna[56288] at
> uk.ac.soton.itinnovation.taverna.enactor.entities.ProcessorTask.invokeOnce(ProcessorTask.java:443)
> 20/11/09 11:45:34 AM [0x0-0x138138].Taverna[56288] at
> uk.ac.soton.itinnovation.taverna.enactor.entities.ProcessorTask.doSingleIteration(ProcessorTask.java:962)
> 20/11/09 11:45:34 AM [0x0-0x138138].Taverna[56288] at
> uk.ac.soton.itinnovation.taverna.enactor.entities.ProcessorTask.access$100(ProcessorTask.java:95)
> 20/11/09 11:45:34 AM [0x0-0x138138].Taverna[56288] at
> uk.ac.soton.itinnovation.taverna.enactor.entities.ProcessorTask$1.run(ProcessorTask.java:835)
>
>
>
> [Attach2] System error log from running SQLUpdate passing list of values in
> params port
>
> 20/11/09 3:30:56 PM [0x0-0x1bd1bd].Taverna[87334] ERROR 2009-11-20
> 15:30:56,095 Failed while iterating Thread[Processor worker insert_data
> #0,6,main]
> 20/11/09 3:30:56 PM [0x0-0x1bd1bd].Taverna[87334]
> java.lang.ArrayStoreException
> 20/11/09 3:30:56 PM [0x0-0x1bd1bd].Taverna[87334] at
> java.lang.System.arraycopy(Native Method)
> 20/11/09 3:30:56 PM [0x0-0x1bd1bd].Taverna[87334] at
> java.util.ArrayList.toArray(ArrayList.java:306)
> 20/11/09 3:30:56 PM [0x0-0x1bd1bd].Taverna[87334] at
> net.sourceforge.taverna.baclava.DataThingAdapter.getStringArray(DataThingAdapter.java:60)
> 20/11/09 3:30:56 PM [0x0-0x1bd1bd].Taverna[87334] at
> net.sourceforge.taverna.scuflworkers.jdbc.SQLUpdateWorker.execute(SQLUpdateWorker.java:68)
> 20/11/09 3:30:56 PM [0x0-0x1bd1bd].Taverna[87334] at
> org.embl.ebi.escience.scuflworkers.java.LocalServiceTask.execute(LocalServiceTask.java:31)
> 20/11/09 3:30:56 PM [0x0-0x1bd1bd].Taverna[87334] at
> uk.ac.soton.itinnovation.taverna.enactor.entities.ProcessorTask.runAndGenerateTemplates(ProcessorTask.java:585)
> 20/11/09 3:30:56 PM [0x0-0x1bd1bd].Taverna[87334] at
> uk.ac.soton.itinnovation.taverna.enactor.entities.ProcessorTask.doInvocationWithRetryLogic(ProcessorTask.java:524)
> 20/11/09 3:30:56 PM [0x0-0x1bd1bd].Taverna[87334] at
> uk.ac.soton.itinnovation.taverna.enactor.entities.ProcessorTask.invokeOnce(ProcessorTask.java:443)
> 20/11/09 3:30:56 PM [0x0-0x1bd1bd].Taverna[87334] at
> uk.ac.soton.itinnovation.taverna.enactor.entities.ProcessorTask.doSingleIteration(ProcessorTask.java:962)
> 20/11/09 3:30:56 PM [0x0-0x1bd1bd].Taverna[87334] at
> uk.ac.soton.itinnovation.taverna.enactor.entities.ProcessorTask.access$100(ProcessorTask.java:95)
> 20/11/09 3:30:56 PM [0x0-0x1bd1bd].Taverna[87334] at
> uk.ac.soton.itinnovation.taverna.enactor.entities.ProcessorTask$1.run(ProcessorTask.java:835)
>
>
> Kevin Crowston
> Syracuse University Phone: +1 (315)
> 464-0272
> School of Information Studies Fax: +1 (866) 265-7407
> 348 Hinds Hall Web:
> http://crowston.syr.edu/
> Syracuse, NY 13244-4100 USA
>
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> taverna-users mailing list
> [email protected]
> [email protected]
> Web site: http://www.taverna.org.uk
> Mailing lists: http://www.taverna.org.uk/taverna-mailing-lists/
>
--
Mark Fortner
blog: http://feeds.feedburner.com/jroller/ideafactory
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
taverna-users mailing list
[email protected]
[email protected]
Web site: http://www.taverna.org.uk
Mailing lists: http://www.taverna.org.uk/taverna-mailing-lists/