pantz.org banner
Connecting Openoffice.org's Writer and MySQL on Debian GNU/Linux
Posted on 12-27-2005 19:13:00 UTC | Updated on 12-27-2005 19:13:00 UTC
Section: /software/mysql/ | Permanent Link

This is a quick description of how to use Openoffice.org's Writer to modify MySQL databases. The Openoffice.org used in this example is from 2005 so it might become dated but here it is anyway.

Install OpenOffice.org

apt-get install openoffice.org

Install MySQL

apt-get install mysql

To turn on networking in MySQL (make it listen to incomming connections) you have to edit the /etc/mysql/my.cnf file.Comment out the line "skip-networking". To make it listen to local loopback only (just your machine) you need to put in the line "bind-address = 127.0.0.1". In the section "[mysqld]". Save it.

Then restart MySQL

/etc/init.d/mysql restart

After that install the grant tables.

mysql_install_db --user=mysql

Then login to MySQL.

mysql -u root -p

By default the password is blank so hit enter when asked for one. Then after you login set the MySQL root users password with the following commands.

use mysql;

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('passwordhere');

Then create a database with the following command.

create database databasenamehere;

Then create a table.

create table blah (unique_name varchar(100) not null primary key);

I've read if you don't create a primary key the database stays read-only. So heed that warning. To connect to MySQL with OpenOffice Writer you have to install the packages "unixodbc", "libmyodbc", and "myodbc" in Debian. Do this with the following commands.

apt-get install unixodbc libmyodbc libmyodbc

Then configure the following odbc file /etc/odbcinst.ini to look like this:

[MySQL]

Description = ODBC Driver for MySQL
Driver      = /usr/lib/libmyodbc.so
Setup       = /usr/lib/libodbcmyS.so
FileUsage   = 1
CPTimeout   =
CPReuse     =

Then configure the next odbc file /etc/odbc.ini to look like the following example. Don't forget to replace the "databasenamegoeshere" with your actual database name.

[databasenamegoeshere]
Description  = MySQL db test
Driver       = MySQL
Server       = localhost
Database     = databasenamegoeshere
Port         = 3306
Socket       =
Option       =
Stmt         =

To test if you can connect to the MySQL database with ODBC use the program "isql". It should have come with one of the packages above. To connect to the MySQL database use the command:

isql databasename root mysqlrootspassword -v

If it connects and brings you to a SQL prompt then it should work fine in Openoffice. If not then you'll have to look at the error message and determine what your unique problem is and how to make it connect correctly.

Now open OpenOffice.org's Writer program and click "Tools" -> "Data Sources". In the "database" tab select "MySQL" as the database type. Click the datasource url button and select your database. Then in the "MySQL" tab click select "Use existing myodbc datasource". In the datasource url section click the button and make sure your database is selected. Under username put the users name that has access to the DB (mine is root). Check the password box. Then click the "ok" button and you'll be back at the main Writer screen. Hit the "F4" key and it will bring up a database view. From there you can right click on the "tables" area to create and edit or make new tables.

Reddit!

Related stories


RSS Feed RSS feed logo

About


3com

3ware

alsa

alsactl

alsamixer

amd

android

apache

areca

arm

ati

auditd

awk

badblocks

bash

bind

bios

bonnie

cable

carp

cat5

cdrom

cellphone

centos

chart

chrome

chromebook

cifs

cisco

cloudera

comcast

commands

comodo

compiz-fusion

corsair

cpufreq

cpufrequtils

cpuspeed

cron

crontab

crossover

cu

cups

cvs

database

dbus

dd

dd_rescue

ddclient

debian

decimal

dhclient

dhcp

diagnostic

diskexplorer

disks

dkim

dns

dos

dovecot

drac

dsniff

dvdauthor

e-mail

echo

editor

emerald

encryption

ethernet

expect

ext3

ext4

fat32

fedora

fetchmail

fiber

filesystems

firefox

firewall

flac

flexlm

floppy

flowtools

fonts

format

freebsd

ftp

gdm

gmail

gnome

google

gpg

greasemonkey

greylisting

growisofs

grub

hacking

hadoop

harddrive

hba

hex

hfsc

html

html5

http

https

hulu

idl

ie

ilo

intel

ios

iperf

ipmi

iptables

ipv6

irix

javascript

kde

kernel

kickstart

kmail

kprinter

krecord

kubuntu

kvm

lame

ldap

linux

logfile

lp

lpq

lpr

maradns

matlab

memory

mencoder

mhdd

mkinitrd

mkisofs

moinmoin

motherboard

mouse

movemail

mplayer

multitail

mutt

myodbc

mysql

mythtv

nagios

nameserver

netflix

netflow

nginx

nic

ntfs

ntp

nvidia

odbc

openbsd

openntpd

openoffice

openssh

openssl

openvpn

opteron

parted

partimage

patch

perl

pf

pfflowd

pfsync

photorec

php

pop3

pop3s

ports

postfix

power

procmail

proftpd

proxy

pulseaudio

putty

pxe

python

qemu

r-studio

raid

recovery

redhat

router

rpc

rsync

ruby

saltstack

samba

schedule

screen

scsi

seagate

seatools

sed

sendmail

sgi

shell

siw

smtp

snort

solaris

soundcard

sox

spam

spamd

spf

spotify

sql

sqlite

squid

srs

ssh

ssh.com

ssl

su

subnet

subversion

sudo

sun

supermicro

switches

symbols

syslinux

syslog

systemd

systemrescuecd

t1

tcpip

tcpwrappers

telnet

terminal

testdisk

tftp

thttpd

thunderbird

timezone

ting

tls

tools

tr

trac

tuning

tunnel

ubuntu

unbound

vi

vpn

wget

wiki

windows

windowsxp

wireless

wpa_supplicant

x

xauth

xfree86

xfs

xinearama

xmms

youtube

zdump

zeromq

zic

zlib