Bulk insert
Mark Rotteveel
mark at lawinegevaar.nl
Wed Oct 10 16:34:15 UTC 2018
On 10-10-2018 12:06, Arthur McGibbon wrote:
> Would it be possible to add bulk insert functionality to the spec?
>
> Many drivers already implement this in their own way. Their procedure is
> generally to define the column metadata, define some properties about the
> table (e.g. locking) and then fire a stream at it.
>
> For reference...
>
> MS SQL: com.microsoft.sqlserver.jdbc.SQLServerBulkCopy
>
> PostgreSQL:org.postgresql.copy.CopyManager
>
> MySQL:com.mysql.cj.jdbc.StatementImpl#setLocalInfileInputStream
The problem with this is that these are all specifically native
solutions, as in: the file format, configuration options, etc are
specific to the underlying database and usually have different tools for
that database that support the same options and format.
Having such a thing for JDBC, in my opinion, would require a common
(JDBC-defined) input format, common config, common api, etc, and not
just provide a basic entrypoint to get access. If you don't do that,
you're not really providing the database-independent API that JDBC tries
to be.
And trying to unify an API that would be suitable to cover the existing
options would probably be complex. My guess is that it would likely not
gain much traction, because these tools already exist and they map well
to equivalent features in other tools for that database system.
And if you just provide the common denominator or simplest thing
possible, then people will probably still end up using the
database-specific tooling, as they will likely be richer in features.
I personally think this is one of those things where it is better to
just escape JDBC, and use the database specific tools.
That said, I assume that if you can come up with a proposal and a
workable API, it could be considered by the EG (could you confirm, Lance).
Mark
--
Mark Rotteveel
More information about the jdbc-spec-discuss
mailing list