LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   insert openoffice data into mysql (https://www.linuxquestions.org/questions/linux-software-2/insert-openoffice-data-into-mysql-730060/)

sriphp 06-02-2009 02:07 AM

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

Tinkster 06-02-2009 02:26 AM

Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread has been reported for closure because it is a duplicate.



http://www.linuxquestions.org/questi...-mysql-730059/


All times are GMT -5. The time now is 04:15 AM.