Hi people,

this are the results of trying to copy *FROM* a spreadsheet document
(OOo Calc) *TO* an HSQLDB embedded / MySQL database [obviously the other
way around is not possible], in Linux with Java UNO bridge.


1. like with the FLAT SOURCE, only "ConnectionResource" =
"sdbc:calc:file:///home/ariel/myfile.ods"

RESULT: CopyTableWizard.createWithInteractionHandler() throws
com.sun.star.lang.IllegalArgumentException: "Only tables and queries are
supported at the moment."


2. in this case, just adding 2 more arguments worked OK:
   * "ConnectionResource" = "sdbc:calc:file:///home/ariel/myfile.ods"
   * "CommandType" = com.sun.star.sdb.CommandType.TABLE
   * "Command" = "SheetN"/"ImportN" == a name of a spreadsheet, or
                 the name of a database range (see the property
                 DatabaseRanges of the service
                 com.sun.star.sheet.SpreadsheetDocument and
                 com.sun.star.sheet.XDatabaseRanges)
RESULT= works OK

I didn't try with an *ActiveConnection*, because I didn't find the name
of the properties to pass for the sheet name/database range name to
XDriverManager::getConnectionWithInfo() or XDriver::connect().

The *API* reference does not tell much about this case (we find XDriver,
XDriverManager, JDBCConnectionProperties, ODBCConnectionProperties,
FILEConnectionProperties, DBASEConnectionProperties,
FLATConnectionProperties, *but* there is no CALCConnectionProperties),
nor does the *Developer*'s *Guide*
(http://api.openoffice.org/docs/DevelopersGuide/Database/Database.xhtml#1_2_3_4_7_The_SDBC_Driver_for_OpenOffice.org_Calc_Files)

And although I was a good boy, I was not a saint: I read only
connectivity/source/drivers/calc/CConnection.cxx
connectivity/source/drivers/calc/CDriver.cxx
and as I didn't find what I was looking for, I gave up.


The conclusion here is also that a FilePicker is not enough: we must
show the user all the sheets and database ranges in the spreadsheet
document so that s/he chooses one before we can instantiate the
CopyTableWizard.


Bye
Ariel.


--
Ariel Constenla-Haile
La Plata, Argentina

[EMAIL PROTECTED]
[EMAIL PROTECTED]

http://www.arielconstenlahaile.com.ar/ooo/



"Aus der Kriegsschule des Lebens
                - Was mich nicht umbringt,
        macht mich härter."
                Nietzsche Götzendämmerung, Sprüche und Pfeile, 8.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to