...
This section refers to the command-line tool. For information on the uses of the java library, please refer to our java documentation.
...
Commands
JDBC2XML registers under several aliases on the command line, to cover the most common usecases. They are presented here with minimal options, see provides several commands, triggering different operations.
The following command overview only shows the absolut minimal number of options.
Usually more options are needed, especially --user
, --password
, and (Linux only, see bottom) --jdbc-drivers
.
See far below for a full list of options below, as well as examples for JDBC URLs.
Dumping a DB to XML
...
No Format |
---|
jdbc2xml --url <jdbc-url> --user <jdbc-user> --password <jdbc-password> --file <path-to-file> |
See below for details and example for JDBC URLs.
Restoring a DB from XML
...
No Format |
---|
xml2jdbc --file <path-to-file> --url <jdbc-url> --user <jdbc-user> --password <jdbc-password> |
Copying from one DB to another
No Format |
---|
jdbc2jdbc --from-url <jdbc-url> --to-url <jdbc-url> --user <jdbc-user> --password <jdbc-password> |
Parse and copy an XML file
...
No Format |
---|
jdbcping --url <jdbc-url> --user <jdbc-user> --password <jdbc-password> |
Extract parts of a DB
No Format |
---|
jdbcextr --url <jdbc-url> --user <jdbc-user> --password <jdbc-password> --file <path-to-file> |
Full list of options
Database access
...
JDBC URLs
JDBC URLs basically look like jdbc:servertype://host[:port]/db
[?options]):?options
., but some Databases and/or JDBC Drivers like other variants.
Typical examples are:
No Format |
---|
# MySQL
jdbc:mysql://localhost:3306/MYDATABASE?useCursorFetch=true
# MSSQL
jdbc:sqlserver://localhost:1433;databaseName=MYDATABASE; |
The use of cursor fetching in mysql is highly recommended in order to circumvent java heap space exceptions while dumping the content of large tables.
Full list of options
Database access
JDBC URL to access the DB.
No Format |
---|
--from-url "jdbcurl" --to-url "jdbcurl" --url "jdbcurl" |
...
No Format |
---|
--from-driver drivername --to-driver drivername --driver drivername |
linux Linux only: add given drivers to the classpath
No Format |
---|
--jdbc-drivers jarfilename[;jarfilename...] |
Options for
...
jdbc behaviour
Change the batch size for inserts (def.: 1000)
...
Fetch the contents of the database using a read-only transaction
No Format |
---|
--transactional |
Options for
...
xml reading
Enable schema checking on the xml file
...
No Format |
---|
--create-fk-indices |
Options for
...
xml creation
Force or supress pretty printing of xml data
...
Activate loggers in wrapper scripts (only useful if you know what you're doing)
No Format |
---|
--debug-startup |
Driver packages and paths, and other Backend specific tips
See
- MySQL Tips
- MSSQL Tips
- JDBC Snippets with common JDBC URL examples