Setting up MySQL following initial installation:
->mysql mysql -this gets us into mysql
mysql> delete from user where host='localhost' and user='';
mysql> quit
then
-> mysqladmin reload
-> mysqladmin -u root password my_password_here
now we reconnect to mysql
-> mysql -h localhost -u root -p
mysql> grant all priveleges on *.* to my_user_name@localhost identified by 'my_user_password';
Now we have a user with full privileges on the database.
To set up the connection between MySQL and OpenOffice I used myODBC, which has a config program called as "ODBCConfig". Run this as root (in KDE use alt-F2 and select options to run as root). Then set a driver and a user or system DSN
On a SuSE 9.1 system,
The driver is: /usr/lib/unixODBC/libmyodbc3-3.51.06.so
The setup is /usr/lib/unixODBC/libodbcmyS.so.1
In OpenOffice, under Tools, Data Source, we can then select the ODBC database type, and then select the available data sources.
To make sure we can edit tables, there is a macro that needs to be run (see under "more").
I found the following sites helpful in getting to this point:
Sourceforge:setting up OOo with MySQL and Openoffice.org howto IgnoreDriverPrivilegesEnter and run this as a macro in OpenOffice with Tools-Macros, and enter the name of your datasource (the one you entered in OpenOffice Data Sources)
REM ***** BASIC *****
Option Explicit
Sub Main
Dim sDataSourceName as String
sDataSourceName = InputBox( "Please enter the name of the data source:" )
IgnoreDriverPrivileges(sDataSourceName )
End Sub
Sub IgnoreDriverPrivileges(sDataSourceName as String )
' the data source context (ehm - the service name is historical :)
Dim aContext as Object
aContext = createUnoService( "com.sun.star.sdb.DatabaseContext" )
If ( Not aContext.hasByName( sDataSourceName ) ) Then
MsgBox "There is no data source named " + sDataSourceName + "!"
Exit Sub
End If
' the data source
Dim aDataSource as Object
aDataSource = aContext.getByName( sDataSourceName )
' append the new IgnoreDriverPrivilegesflag
Dim bFlag as Boolean
bFlag = TRUE
Dim aInfo as Variant
aInfo = aDataSource.Info
aInfo = AddInfo( aInfo, "IgnoreDriverPrivileges", bFlag )
' and write back
aDataSource.Info = aInfo
' flush (not really necessary, but to be on the safe side :)
aDataSource.flush
End Sub
Function AddInfo( aOldInfo() as new com.sun.star.beans.PropertyValue,sSettingsName as String, aSettingsValue as Variant ) as Variant
Dim nLower as Integer
Dim nUpper as Integer
nLower = LBound( aOldInfo() )
nUpper = UBound( aOldInfo() )
' look if the setting is already present
Dim bNeedAdd as Boolean
bNeedAdd = TRUE
Dim i As Integer
For i = nLower To nUpper
If ( aOldInfo( i ).Name = sSettingsName ) Then
aOldInfo( i ).Value = aSettingsValue
bNeedAdd = FALSE
End If
Next i
' allocate the new array
Dim nNewSize as Integer
nNewSize = ( nUpper - nLower )
If bNeedAdd Then nNewSize = nNewSize + 1
Dim aNewInfo( nNewSize ) as new com.sun.star.beans.PropertyValue
' copy the elements (a simply copy does not work in Basic)
For i = nLower To nUpper
aNewInfo( i ) = aOldInfo( i )
Next i
' append the new setting, if necessary
If ( bNeedAdd ) Then
aNewInfo( nUpper + 1 ).Name = sSettingsName
aNewInfo( nUpper + 1 ).Value = aSettingsValue
End If
AddInfo = aNewInfo()
End Function
Would you like to benefit from the once in a lifetime investment opportunities in the UK? The lower level of the pound together with depressed property prices has created excellent conditions for medium to long term investment. I have substantial experience in the London market and would be delighted to offer no strings advice. If you'd like to know more, please contact me.
For more details please go to Rhema Housing Ltd. Rhema Housing Ltd is a Franchise Partner of Platinum Property Partners, the UK's fastest growing franchise, and a recognised provider of leading insight and support for UK property investors.
Massage and alternative therapies in London
A very good friend of mine is one of the worlds most amazing Audiologists. You can find out more here.......
click for hear2learn
Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer