incubator-ooo-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Girvin R. Herr" <girvin.h...@sbcglobal.net>
Subject Re: Connecting to MySQL problem.
Date Thu, 27 Sep 2012 18:52:00 GMT


Ian Whitfield wrote:
> Hi All - Can anyone help me out please!!??
>
> I want to transfer my Database from the embedded DB to a MySQL DB. I'm 
> using PCLinuxOS 2012 and AOO 3.4.0.
>
> * I Created a new empty SQL DB on my WebServer, with all my fields,
> using phpMySQLAdmin.
> * I exported this DB back to my home computer. It comes out as a
> 'filename.sql' and seems to be a text document. (If I "open" this
> file it opens in my HTML Editor!!)
> * I downloaded and extracted 'mysql-connector-java-5.1.22.tar.gz'.
> After extraction I have 'mysql-connector-java-5.1.22-bin.jar' in a
> folder '/home/ian/Database'.
> * I have MySQL loaded and the service IS running. (Checked with
> Control Center)
> * I DO have Java installed with Office (Sun Microsystems 1.6.0_21)
> * I start Base and select 'Connect to existing DB' - JDBC
> * Under Datasource I select the above 'Filename.sql' file.
> * Under JDBC Class I select
> '/home/ian/Database/mysql-connector-java-5.1.22-bin.jar'
> * I select 'Test Class' and get the error "The JDBC Driver could not
> be loaded".
>
> Where is the problem and how do I get round it??
>
> My requirements are a single user on a single machine!!
>
> Also what other problems am I likely to come across as I proceed?
>
> Thanks for any help.
>
> IanW
> Pretoria SA
>
>
Ian,
It sounds like you have some more work to do before you get into Base 
and the driver installation. Here is an excerpt from my computer notes 
which I use to bring up MySQL and Base whenever I upgrade my system from 
scratch. Some of these steps you may have already done or are not 
needed, such as the initial MySQL database backup:


      Pre-installation

Back up the current database, if there is one, by entering:

"mysqldump --user=root -p --opt <database_name> > /tmp/<database_name>.sql"

where <database_name> is the name of the database. This will generate a 
set of SQL commands to use in re-creating the database. If there is more 
than one database, create separate dumps for each one. DO NOT DUMP THE 
MySQL DATABASES {mysql, test, anonymous, etc.}. These should be created 
fresh from the new MySQL program (see below). Restoring these could 
propagate a corrupted system.

*MySQL Installation and Setup
*

To install, run the following from a shell.
Note that the file locations may vary by system. This procedure is for a 
Slackware Linux system:

    *

      Execute "chmod +x /etc/rc.d/rc.mysqld".
      rc.mysqld is a Slackware script that starts/stops/restarts the
      MySQL server.

    *

      Enter: "cp /etc/my-huge.cnf /etc/my.cfg".
      to copy mysql huge configuration to be the default. Note that
      there are other configuration files for smaller systems. I have 1
      GB of RAM and huge works fine for me.

    *

      Enter "/usr/bin/mysql_install_db --user=mysql"
      to set up standard MySQL databases. This MUST be done!

    *

      Enter: "/etc/rc.d/rc.mysqld start"
      to start the MySQL daemon (server).

    *

      Enter: "mysql_secure_installation"
      to set the mysql root password, remove the "test" database, and
      remove network root access. This program will prompt for these items.

    *

      Enter: "mysql --user=root -p mysql"
      to bring up the MySQL monitor (interpreter) program. While in this
      program, the prompt will change to "MySQL> ". Enter the following
      commands, terminated by a semicolon (;) and Enter:

      GRANT ALL PRIVILEGES ON *.* TO <username>@localhost IDENTIFIED BY
      '<password>' WITH GRANT OPTION;

      GRANT ALL PRIVILEGES ON *.* TO <username>@"%" IDENTIFIED BY
      '<password>' WITH GRANT OPTION;

      GRANT ALL PRIVILEGES ON *.* TO admin@localhost IDENTIFIED BY
      '<password>' WITH GRANT OPTION;

      GRANT RELOAD,PROCESS ON *.* TO admin@localhost ;

      CREATE DATABASE <database_name>;

      exit

These commands will set up the <username> user and <password> passwords 
and create the <database_name> empty database. If there are additional 
databases, CREATE those also. Next, load the database data by entering 
the following command as root:

"mysql --user=root -p <database_name> < <data_name>.sql"


The <database_name> database should now be ready for access by OO.o 
Base. If there are additional databases dumped in the pre-installation 
paragraph, then restore them also.


      OO.o Base Fails to Connect But mysql Interpreter Works

If OpenOffice Base fails to connect to the MySQL database, but the mysql 
interpreter works fine, then do the following:

In "etc/rc.d/rc.mysql", verify that the line beginning with "SKIP=" is 
commented out. If it is not commented out then do so. This line 
instructs the mysqld server to disable net access. OO.o Base uses 
"localhost" to access a database. Commenting out this line enables 
"localhost" access.


    OpenOffice

Base Fails to Open Java Driver

If the MySQL Connector Java driver is already installed when OO.o is 
installed, the new OO.o will not see the driver and produce an error 
message about not being able to load the driver. You need to tell OO.o 
where the driver jar is located. Do:

Tools > Options... > OpenOffice.org > java > Class Path... > Add Archive...

and drill down to the driver jar. An example of this is 
“mysql-connector-java-5.0.7-bin.jar” located in “/usr/java/jars/.”. 
Note: Do not select the “...-g-bin.jar” version! This is a debug version 
and will be very slow. After this is done, then Base should access the 
MySQL database without error.
Note that there is a pause after "java". Wait for OO to find the Java 
packages you have installed and list them in the window. It shouldn't 
take more than a few seconds, but it seems like a long time and OO has 
crashed - it hasn't. If you have more Java packages than one, make sure 
you select the Java you want to use first.

Notes:

   1. Keep in mind that these procedures are for a Slackware Linux
      system. Your system may vary slightly.
   2. The <data_name>.sql file should have the data in it already. This
      is done by the mysqldump program, which creates an SQL executable
      file that removes the original database and re-creates the
      structure and data at restore time.
   3. It has been a long time, but I once moved Microsoft Access data to
      MySQL using the comma separated value (CSV) format. MySQL will
      import CSV data files, but I don't remember how I did it. If you
      need that process, I can try researching how I did it for you.
   4. Keep in mind that OO Base is a database _client._ That means it
      can make some database operations convenient, but you still must
      set up the database in MySQL first. Base will not do that for you.
   5. As you have already been told, the MySQL "root" user is not the
      same as the system root user. You can use the root password for
      MySQL's root during the setup, but I do not advise that for
      security reasons. Pick another password.
   6. Another good information source is the MySQL Reference Manual,
      which is supplied with MySQL or on the MySQL website. It should be
      in the MySQL docs directory on your system. It has chapters on
      installation and setup with step-by-step instructions. Most of
      what I outlined above came directly from that manual.
   7. These steps must be performed in the proper sequence or your Base
      connection may fail.
   8. Quotes (") and brackets (< >) are not to be included in any command.

Hope this helps. Good luck.
Girvin Herr







---------------------------------------------------------------------
To unsubscribe, e-mail: ooo-users-unsubscribe@incubator.apache.org
For additional commands, e-mail: ooo-users-help@incubator.apache.org


Mime
View raw message