Laurent Godard wrote:

Hi paolo

just randomly tried with "private:factory/sdatabase"
and... it works!! :-)
(OOo 1.9.128)


thanks
i've tried during my long train trip and found this
but not randomly :)

randomly, i tried sbase and not sdatabase

btw, the info is stored in
/share/registry/modules/org/openoffice/TypeDetection/Filter

Thanks again paolo

Laurent

Hi Laurent, I am curious what you ultimately want to accomplish.... Here is a snippet from something that I use. Probably requires some adaptation, and does not include all of the routines that I call, but...

 If FileExists(dbFileName) Then
   Print "The file already exists, go get it!"
   oDoc = FindComponentWithURL(dbFileName, True)
 Else
   Print "Creating a new file!"
   sDBUrl = "private:factory/sdatabase"
   oDoc = StarDesktop.loadComponentFromURL(sDBUrl,"_blank",0,Array())
   oDoc.URL = "sdbc:embedded:hsqldb"
   oDoc.storeAsURL(dbFileName, Array())
 End If

 oBaseContext = CreateUnoService("com.sun.star.sdb.DatabaseContext")
 oDataBase = oBaseContext.getByName(dbFileName)
 oCon = oDataBase.getConnection("", "")

 oTables = oCon.getTables()

 REM Each stamp belongs to a country
 sTableName$ = "COUNTRY"
 If NOT oTables.hasByName(sTableName$) Then
   oTableDescriptor = oTables.createDataDescriptor()
   oTableDescriptor.Name = sTableName$

   oCols = oTableDescriptor.getColumns()
   oCol = oCols.createDataDescriptor()

   oCol.Name = "CountryID"
   oCol.Type = com.sun.star.sdbc.DataType.INTEGER
   oCol.IsNullable = com.sun.star.sdbc.ColumnValue.NO_NULLS
   oCol.IsAutoIncrement = True
   oCol.Precision = 10
   oCols.appendByDescriptor(oCol)

   oCol.Name = "CountryName"
   oCol.Type = com.sun.star.sdbc.DataType.VARCHAR
   oCol.Precision = 50
   oCol.IsAutoIncrement = False
   oCols.appendByDescriptor(oCol)

   oTables.appendByDescriptor(oTableDescriptor)
 End If




--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.sxw
My Book: http://www.hentzenwerke.com/catalog/oome.htm
Info:  http://www.pitonyak.org/oo.php
See Also: http://documentation.openoffice.org/HOW_TO/index.html


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

Reply via email to