Error with database creation with SQL

Sergio Corato <[email protected]> Tue, 09 Mar 2010 00:45:24 +0100
Newsgroups gmane.comp.openoffice.dba.user
Message-ID <[email protected]>
os Windows Vista -  OOo 3.2.0

I have the following error in a macro that:
-create a database
-register the database in the data sources
-create the tables in the database*

*the error happens here

---error----
Exception:
Type: com.sun.star.sdbc.SQLException
Message: Error in reading/writing on file error java.io.IOException: 
S1000 invalid storage class: java.lang.NullPointerException opening file 
- file C:\Users\HiIcsToolsDb.odb.data in statement [create table 
"icstoolsdb.art"].

This doesn't happen with OOo 3.1.1
If I only register the db, close OOo and reopen, I can create the tables 
without problems.

Macro are these ones:

Sub Main
oContext = CreateUnoService("com.sun.star.sdb.DatabaseContext")
oDb = oContext.createInstance()
With oEv.Source.Context.Model
'If ( .getByName("sHSQLDB").State = 1) Then
    If oContext.hasByName(HIDB) Then
...
    Else
        oDb.setPropertyValue ("URL" , "sdbc:embedded:hsqldb" )
        sUrl = .getByName("txtDbDir").text
        sUrl = sUrl & HIDB & ".odb"   
        oDb.DatabaseDocument.storeAsUrl(sUrl, array())
        oDb.DatabaseDocument.store
        oContext.registerObject(HIDB, oDb)
        createTables
        If oContext.hasByName(HIDB) Then
            msgBox ( sSuccess, 0, "IcsToolsConfig" )
        Endif
    Endif
End Sub

Sub createTables
    launchSQLUpdate("create")
End Sub
Sub alterTables
    launchSQLUpdate("alter")
End Sub

Sub launchSQLUpdate(sSQLType As String)
'***get sql string to create db
iFile = FreeFile
path = convertFromUrl(getPackageUrl)
path = path & getPathSeparator & "sql_string" & getPathSeparator & 
sSQLType & "_db_v1.txt"
path = convertToUrl(path)
Open path For Input As #iFile
    While Not (EOF (iFile))
        Line Input #iFile, stringVal
        sql_string = sql_string & stringVal
    Wend
oContext = CreateUnoService("com.sun.star.sdb.DatabaseContext")

oDs = oContext.getByName(HIDB)
oConn = oDs.getConnection("","")
oStmt = oConn.createStatement()
oStmt.executeUpdate(sql_string)
oDb.DatabaseDocument.store()
oDb.dispose()
oConn.dispose()
End Sub

Thanks in advance,
Sergio Corato
http://www.icstools.it/