Load data (local) infile

287 views
Skip to first unread message

Andreas Nyhrén

unread,
Oct 23, 2012, 4:55:04 AM10/23/12
to node-mys...@googlegroups.com
Hi

trying to perform an import using LOAD DATA LOCAL INFILE ... but getting
Error: This command is not supported in the prepared statement protocol yet

Any info of future support for this?

Andrey Sidorov

unread,
Oct 23, 2012, 6:01:56 AM10/23/12
to node-mys...@googlegroups.com
It's MySQL server restriction, prepared statements don't support LOAD DATA LOCAL INFILE.
Solution is not to use prepared statements (i.e use query instead of execute)

Andreas Nyhrén

unread,
Oct 24, 2012, 7:23:19 AM10/24/12
to node-mys...@googlegroups.com
Ah! did not get that (query v execute) from the docs - thanks, will try that!

Any info on how to do batch inserts/updates, like jdbc?
pstmt = conn.prepareStatement(stmt)
loop
  pstmt.set...
  ...
  pstmt.addBatch
int[] count = pstmt.executeBatch()

Andrey Sidorov

unread,
Oct 24, 2012, 7:40:50 AM10/24/12
to node-mys...@googlegroups.com
I suspect jdbc in the case of mysql just calls insert statements in a
loop. It's relatively inexpensive from wire data point of view: 4
bytes prepared statement it + packet header + command type + data.

Try to inspect jdbc with wireshark and if required mysql command is
missing it's easy to add
Reply all
Reply to author
Forward
0 new messages