Wiki source code of JDBC2XML Usage

Version 2.1 by christoph_lechleitner@iteg_at on 2012-08-03 06.12:17

Show last authors
1 = {{id name="JDBC2XMLUsage-JDBC2XMLUsage"/}}JDBC2XML Usage =
2
3 This section refers to the command-line tool. For information on the uses of the java library, please refer to our [[java documentation>>doc:JDBC2XML.Java Library Documentation.WebHome]].
4
5 = {{id name="JDBC2XMLUsage-Commands"/}}Commands =
6
7 JDBC2XML provides several commands, triggering different operations.
8
9 The following command overview only shows the absolut minimal number of options.
10
11 Usually more options are needed, especially {{code language="none"}}--user{{/code}}, {{code language="none"}}--password{{/code}}, and (Linux only) {{code language="none"}}--jdbc-drivers{{/code}}.
12
13 See far below for a full list of options, as well as examples for JDBC URLs.
14
15 ==== {{id name="JDBC2XMLUsage-DumpingaDBtoXML"/}}Dumping a DB to XML ====
16
17 {{code language="none"}}
18 jdbc2xml --url <jdbc-url> --file <path-to-file>
19 {{/code}}
20
21 See below for details and example for JDBC URLs.
22
23 ==== {{id name="JDBC2XMLUsage-RestoringaDBfromXML"/}}Restoring a DB from XML ====
24
25 {{code language="none"}}
26 xml2jdbc --file <path-to-file> --url <jdbc-url>
27 {{/code}}
28
29 ==== {{id name="JDBC2XMLUsage-CopyingfromoneDBtoanother"/}}Copying from one DB to another ====
30
31 {{code language="none"}}
32 jdbc2jdbc --from-url <jdbc-url> --to-url <jdbc-url>
33 {{/code}}
34
35 ==== {{id name="JDBC2XMLUsage-ParseandcopyanXMLfile"/}}Parse and copy an XML file ====
36
37 This can be useful for extracting a schema from a database (see options below)
38
39 {{code language="none"}}
40 xml2xml --from-file <path-to-file> --to-file <path-to-file>
41 {{/code}}
42
43 ==== {{id name="JDBC2XMLUsage-TestDBconnectionandserverstatus"/}}Test DB connection and server status ====
44
45 {{code language="none"}}
46 jdbcping --url <jdbc-url>
47 {{/code}}
48
49 ==== {{id name="JDBC2XMLUsage-ExtractpartsofaDB"/}}Extract parts of a DB ====
50
51 {{code language="none"}}
52 jdbcextr --url <jdbc-url> --file <path-to-file>
53 {{/code}}
54
55 == {{id name="JDBC2XMLUsage-JDBCURLs"/}}JDBC URLs ==
56
57 JDBC URLs basically look like {{code language="none"}}jdbc:servertype://host[:port]/db?options{{/code}}., but some Databases and/or JDBC Drivers like other variants.
58
59 Typical examples are:
60
61 {{code language="none"}}
62 # MySQL
63 jdbc:mysql://localhost:3306/MYDATABASE
64  
65 # MSSQL
66 jdbc:sqlserver://localhost:1433;databaseName=MYDATABASE;
67 {{/code}}
68
69 == {{id name="JDBC2XMLUsage-Fulllistofoptions"/}}Full list of options ==
70
71 ==== {{id name="JDBC2XMLUsage-Databaseaccess"/}}Database access ====
72
73 JDBC URL to access the DB.
74
75 {{code language="none"}}
76 --from-url "jdbcurl"
77 --to-url "jdbcurl"
78 --url "jdbcurl"
79 {{/code}}
80
81 User to access the DB (some drivers can parse that from the URL):
82
83 {{code language="none"}}
84 --from-user user
85 --to-user user
86 --user user
87
88 {{/code}}
89
90 Password to access the DB (some drivers can parse that from the URL):
91
92 {{code language="none"}}
93 --from-password password
94 --to-password password
95 --password password
96 {{/code}}
97
98 ==== {{id name="JDBC2XMLUsage-Fileaccess"/}}File access ====
99
100 Win32 wrapper needs absolut paths. The given filenames may contain compressed input. The implementation instantiates an appropriate inflating/deflating stream if the filename ends with .gz or .bz2
101
102 {{code language="none"}}
103 --from-file file
104 --to-file file
105 --file file
106 {{/code}}
107
108 ==== {{id name="JDBC2XMLUsage-Restrictprocessingtotables"/}}Restrict processing to tables ====
109
110 Whitelist tables (comma seperated, without whitespace)
111
112 {{code language="none"}}
113 --tables table1,table2,...
114 {{/code}}
115
116 Blacklist tables
117
118 {{code language="none"}}
119 --exclude-tables table1,table2,...
120 {{/code}}
121
122 Do not include table data in dump (creates a full schema from a populated database):
123
124 {{code language="none"}}
125 --no-data
126 {{/code}}
127
128 Ignore constraints
129
130 {{code language="none"}}
131 --no-constraints
132 {{/code}}
133
134 Combined{{code language="none"}}--no-data{{/code}} and {{code language="none"}}--no-constraints{{/code}}
135
136 {{code language="none"}}
137 --schema-only
138 {{/code}}
139
140 ==== {{id name="JDBC2XMLUsage-Expertoptions"/}}Expert options ====
141
142 Drop the affected tables before actually importing a dump. If {{code language="none"}}--tables{{/code}} or {{code language="none"}}--exclude-tables{{/code}} is given, only tables affected by the specified filter are dropped.
143
144 {{code language="none"}}
145 --drop-tables
146 {{/code}}
147
148 Overrides the default bzip2 output compression, if {{code language="none"}}--to-file{{/code}} ends with .bz2
149
150 {{code language="none"}}
151 --compression <n>
152 {{/code}}
153
154 Force a timezone
155
156 {{code language="none"}}
157 --timezone timezoneid
158 {{/code}}
159
160 allows to select a JDBC driver, overriding autoselection
161
162 {{code language="none"}}
163 --from-driver drivername
164 --to-driver drivername
165 --driver drivername
166 {{/code}}
167
168 Linux only: add given drivers to the classpath
169
170 {{code language="none"}}
171 --jdbc-drivers jarfilename[;jarfilename...]
172 {{/code}}
173
174 ==== {{id name="JDBC2XMLUsage-Optionsforjdbcbehaviour"/}}Options for jdbc behaviour ====
175
176 Change the batch size for inserts (def.: 1000)
177
178 {{code language="none"}}
179 --batch-size n
180 {{/code}}
181
182 Fetch the contents of the database using a read-only transaction
183
184 {{code language="none"}}
185 --transactional
186 {{/code}}
187
188 ==== {{id name="JDBC2XMLUsage-Optionsforxmlreading"/}}Options for xml reading ====
189
190 Enable schema checking on the xml file
191
192 {{code language="none"}}
193 --check-xml-schema
194 {{/code}}
195
196 Create an extra index on each foreign key
197
198 {{code language="none"}}
199 --create-fk-indices
200 {{/code}}
201
202 ==== {{id name="JDBC2XMLUsage-Optionsforxmlcreation"/}}Options for xml creation ====
203
204 Force or supress pretty printing of xml data
205
206 {{code language="none"}}
207 --pretty, --no-pretty
208 {{/code}}
209
210 Forces the transformation of SQL identifiers to lower case
211
212 {{code language="none"}}
213 --to-lower
214 {{/code}}
215
216 Force the transformation of SQL identifiers to upper case
217
218 {{code language="none"}}
219 --to-upper
220 {{/code}}
221
222 Write internal indices, which are generated by the RDBMS
223
224 {{code language="none"}}
225 --keep-internal-indices
226 {{/code}}
227
228 ==== {{id name="JDBC2XMLUsage-OutputVerbosity"/}}Output Verbosity ====
229
230 The default log level prints {{code language="none"}}Fatal{{/code}}, {{code language="none"}}Error{{/code}} and {{code language="none"}}Warning{{/code}} logs
231
232 Suppresses any output except for the return code
233
234 {{code language="none"}}
235 --quiet
236 {{/code}}
237
238 Increase log-level to {{code language="none"}}Info{{/code}}
239
240 {{code language="none"}}
241 --verbose
242 {{/code}}
243
244 Log everything (command-line spam warning)
245
246 {{code language="none"}}
247 --debug
248 {{/code}}
249
250 Activate loggers in wrapper scripts (only useful if you know what you're doing)
251
252 {{code language="none"}}
253 --debug-startup
254 {{/code}}