Revision [960]

This is an old revision of CommandXsql made by DavidLee on 2009-11-24 18:58:16.

 

Command xsql


Name

xsql queries a a relational database using jdbc


Synopsis

xsql [ serialization options ] [options]

Options


-cp path
-classpath path
Specifies an additional classpath to use to load the jdbc driver
-d class
-driver class
Specifies the jdbc driver classname
-u user
-user user
Username
-p password
-password password
Password
-root root Root element for generated xml
-row row Row element name for generated xml
-attr Use attribute normal form instead of element normal form for column data
-c string
-connect string
Connect string for jdbc connections
-q query SQL query to run
-o name=value
-option name=value
Specifiy additional connection options, may be repeated (-o opt1=value1 -o opt2=value2)


Supports the standard [ serialization options ]

Description

xsql connects to a database using the java jdbc interface, executes an sql statement and returns the result as an xml document. The xml document is formatted similarly to csv2xml.



Example using the mysql JDBC connector

xsql -cp mysql-connector-java-5.1.7-bin.jar -c jdbc:mysql://host.com/xmlsh -u xmlsh -p password -d org.gjt.mm.mysql.Driver  -q 'select * from books'


Example using the csvjdbc driver from http://csvjdbc.sourceforge.net/
xsql -cp csvjdbc.jar -d org.relique.jdbc.csv.CsvDriver -c "jdbc:relique:csv:$PWD" "select * from books"


Added suppressHeaders option
xsql -cp csvjdbc.jar -d org.relique.jdbc.csv.CsvDriver  -o suppressHeaders=true -c "jdbc:relique:csv:$PWD" "select * from books"


Return Value

Returns 0 if the command executed successfully, 1 if there was an error.

Commands
CategoryCommands

There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki