insert openoffice data into mysql
Hai all,
This is sri
i am trying to insert openoffice doc data in to mysql table from openOffice. for that i done
installed openOffice base on fedora
and opened my document in openOffice
in tools ->macros -> organise macros -> OpenOffice.org Basic and for my document i created new macro 'mymac' and saved
mymac code
------------
(first i am testing to insert any text in mysql)
(i want to take mysql connection and select db)
Sub Main
oDBCntxt = CreateUnoService("com.sun.star.sdb.DatabaseContext")
oDBSrc = oDBCntxt.getByName( "newdb" ) //newdb is my database in mysql
oConnection = oDBSrc.getConnection("root","srinath")
oStatement = oConnection.CreateStatement
sSQL = "insert into tblTest ( Id, data ) values( null, 'ddd' );"
oStatement.execute( sSQL)
End Sub
now when i run that macro at tools ->macros -> run macros
i am getting error dialog like
BASIC Error
An exception occurred
Type: com.sun.star.container.NoSuchElementException
Message: newdb
i don't know statements for reading my doc file here tell me how that also
please tell me how to solve this.
Thanks
Sri
|