connect mysql from openOffice
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
Sub Main
sUser$ = "root"
sPass$ = "srinath"
Dim oParms(2) as new com.sun.star.beans.PropertyValue
oParms(0).Name = "user"
oParms(0).Value = sUser
oParms(1).Name = "password"
oParms(1).Value = sPass
oParms(2).Name = "JavaDriverClass"
oParms(2).Value = "com.mysql.jdbc.Driver"
sURL$ = "sdbc:mysql:jdbc:localhost:3306/newdb"
oDBCntxt = CreateUnoService("com.sun.star.sdbc.DriverManager")
AppendProperty(oParms(), "JavaDriverClass", "com.mysql.jdbc.Driver")
oCon = oManager.getConnectionWithInfo(sURL, oParms())
oStatement = oCon.CreateStatement
sSQL = "insert into tblTest ( Id, data ) values( null, 'ddd' );"
oStatement.execute( sSQL)
End Sub
when i run this macro i am getting error dialog as
BASIC run time error
Object variable not set.
at oCon = oManager.getConnectionWithInfo(sURL, oParms()) line.
please tell me solution for this
Thanks
Sri
Last edited by sriphp; 06-02-2009 at 05:37 AM.
Reason: correction
|