Open ediril opened 4 years ago
Btw, setNull
with VARCHAR
using execute
(instead of addBatch
and executeBatch
) works if that helps. But I need it to work with addBatch
and executeBatch
.
Thanks for the precious info; I will take a look into issue (when I will back to home)
Ottieni Outlook per Androidhttps://aka.ms/ghei36
From: Emrah Diril notifications@github.com Sent: Wednesday, July 29, 2020 8:12:16 AM To: omnisci/omnisci-jdbc omnisci-jdbc@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: Re: [omnisci/omnisci-jdbc] PreparedStatement addBatch insert NULL into POINT column (#27)
Btw, setNull with VARCHAR using execute (instead of addBatch and executeBatch) works if that helps. But I need it to work with addBatch and executeBatch.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/omnisci/omnisci-jdbc/issues/27#issuecomment-665454200, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHLFBF4X3TJL62Z373PQGRTR564UBANCNFSM4PLHRMAA.
Thank you!
One easy way to reproduce this problem is to modify OmniSciGeomTest.tst2_geometry
and replace the first ps.setString
line with ps.setNull(1, Types.VARCHAR);
. The test will still pass, but you'll notice the resultset from statement.executeQuery(sql_select_geom)
is empty since the row never got created.
I have a table with several columns one of which is a defined as
FrameCenter GEOMETRY(POINT, 4326)
so it's nullable. For some rows, I'd like to insert a NULL into this column. I'm usingaddBatch
andexecuteBatch
methods. I tried callingsetNull
with all combinations ofjava.sql.Types
. I also triedsetString
with empty string as value, but didn't work. I don't get an error when I callexecuteBatch
but my row does not get inserted into the table either.I also tried INSERT with named columns leaving out the column I'd like to insert a NULL but that didn't work either.
executeBatch
knows the full list of columns and gave me this error:executeBatch failed: Exception: TException - service has thrown: TOmniSciException(error_msg=Wrong number of columns to load into Table (4 vs 7))
So how do I insert a NULL to a Geometry Point column?