Welcome to NeoOffice developer notes and announcements
NeoOffice
Developer notes and announcements
 
 

This website is an archive and is no longer active
NeoOffice announcements have moved to the NeoOffice News website


Support
· Forums
· NeoOffice Support
· NeoWiki


Announcements
· Twitter @NeoOffice


Downloads
· Download NeoOffice


  
NeoOffice :: View topic - How To Get a connection to MySQL working via JDBC
How To Get a connection to MySQL working via JDBC
 
   NeoOffice Forum Index -> NeoOffice Releases
View previous topic :: View next topic  
Author Message
new user
Guest





PostPosted: Sun Jan 16, 2005 1:49 pm    Post subject: How To Get a connection to MySQL working via JDBC

Well that was elusive. Hopefully, this will help the next guy. This is kind of long because I wanted to include the error messages of the failed attempts so it's easier for the next guy to find.

Under Tools | Data Sources | New Data Source | General
Name it anything. For conection, I initially tried MySQL.

Clicking the MySQL tab, evidently ODBC doesn't work and I didn't spend any time investigating that as I've gotten JDBC to work with other applications. So, I select Use Connector/J and left the default driver class of com.mysql.jdbc.Driver filled in.

Fill in the Data Source URL with something like //localhost:3306/test where 'test' is the name of a database which exists in your MySQL server. Username and password are obvious.

Then click the Table tab to initiate the connection to the database. I kept getting "No connection could be established for the URL sdbc:mysql:jdbc://localhost:3306/test". Clicking on more info, it reported:
Error code: 1000 The specified driver could not be loaded! and
Error code: -1 com/mysql/jdbc/Driver

To resolve that, you have to download the appropriate JDBC driver from MySQL.com and point NeoOffice to the driver jar file. You do that through
Tools | Options | NeoOffice/J | Security | ClassPath | Browse | Add
Then exit and restart NeoOffice/J so that it picks up the change to the classpath.

Returning to Tools | Data Sources | Tables, I kept getting "No connection could be established for the URL sdbc:mysql:jdbc://locahost:3306/test." Clicking on more info, it reported:
Error code: -1 java/sql/Savepoint

Diving through the README.txt file that came with Connector/J section 2.1.1 Java Versions Supported, it says that "Connector/J 3.1.0 and newer will not run on JDKs older than 1.4 unless the class verifier is turned off (-Xverify:none)". Since I found somewhere that NeoOffice/J 1.1 is running on Java 1.3, this means I have to use another driver.

In the NeoOffice/J help pages, under JDBC driver it says:
Use the mm.mysql-2.0.4-bin.jar driver archive available on the following web site:
http://mmmysql.sourceforge.net/oldDist.html

I had 2.0.14 on my computer already so, going back through
Tools | Options | NeoOffice/J | Security | ClassPath | Add and pointing to the 2.0.14 version, exiting and restarting NeoOffice/J and returning to to Tools | Data Sources | MySQL tab, you have to set the MySQL JDBC driver class to org.gjt.mm.mysql.Driver

Clicking on the Tables tab, I kept getting "No connection could be established for the URL sdbc:mysql:jdbc://locahost:3306/test." Clicking on more info, it reported:
SQL Status: S1000 General error: Incorrect database name '/' and
Error code: 1102 General error: Incorrect database name '/'

Well, this threw me. So I tried backing up to the General tab and selecting JDBC for the database type. Clicking on the JDBC tab, set the URL to mysql://localhost:3306/test set the username and password, click the Tables tab and it works!
Back to top
MHV
Guest





PostPosted: Mon Jan 17, 2005 7:06 pm    Post subject: Next guy here

I didn't have any prior problems with NeoOffice/J to use either ODBC or JDBC connector to have read access to my MySQL databases, but I could NEVER get it to work in read/write access mode, even by using that obscure macro trick that's hidden somewhere on the OOo site.

Has your JDBC experience allowed you to read/write to a MySQL DB from within NeoO?
Back to top
new user
Guest





PostPosted: Tue Jan 18, 2005 5:09 pm    Post subject: How To Get a connection to MySQL working via JDBC

Yes, I can write to the MySQL DB through the View | Data Source | [dbname] | Tables | [tablename] grid. However, for some reason the MySQL user must have "table" write permissions and not just "data" write permissions. Before I figured that out, it would just highlight the field and I couldn't type anything. Sorry, I haven't had the chance to narrow down the permissions any more than that. Right now I'm using a user with
mysql> GRANT ALL PERMISSONS ON dbname TO new_user@localhost.

Have also been able to write through a form | data source as table and from a form, although I have to use the "save record" icon to flush changes to DB.

Now, if I could just figure out how to create custom report styles. So far, it seems I'm locked into the AutoPilot templates that come with. In particular, I'd like to be able to have the fields from one record distributed over more than one layout table row. Have also seen a blob truncated at the page break instead of flow over to the next page. Would be nice if Neo/OO used a configurable report writer interface more similar to http://datavision.sourceforge.net
Back to top
new user
Guest





PostPosted: Tue Jan 18, 2005 5:14 pm    Post subject: How To Get a connection to MySQL working via JDBC

Oops, for the newbies, that's
mysql> GRANT ALL PERMISSONS ON dbname.* TO new_user@localhost

See the mysql docs for more on user permissions.
Back to top
kervalen
Agent


Joined: Nov 01, 2004
Posts: 14

PostPosted: Thu Jan 20, 2005 1:41 am    Post subject:

Now, I keep seeing "Communication failure during handshake." What's weird is that I know there's a database there; "mysql" can connect to it.
Back to top
new user
Guest





PostPosted: Fri Jan 21, 2005 3:52 pm    Post subject:

Sounds like it might be sockets vs. ports. I believe mysql uses the unix socket by default. Try mysql --host=localhost --port=3306 If that fails, it could be a firewall issue. At least then you will know where to start digging in the mysql trouble shooting pages.
Back to top
kervalen
Agent


Joined: Nov 01, 2004
Posts: 14

PostPosted: Fri Jan 21, 2005 4:06 pm    Post subject:

Thanks for the suggestion, but "mysql --host=localhost --port=3306 -p" works--I just tried it.
Back to top
MechaBlue
Blue Pill


Joined: Aug 14, 2005
Posts: 3

PostPosted: Sun Aug 14, 2005 11:10 pm    Post subject: Two words...

I have two words: "Hulk Smash!!"

That out of the way, I have some more that are useful.

1. MySQL 4.1.3 and onward use a different means of communicating. This means that, software written and compiled for older version (e.g., the version of PHP included with Tiger) can't connect to the database.
2. I tried using mm.mysql-2.0.4-bin.jar. No dice.
3. While Connector/J 3.1 doesn't work with OO, Connector/J 3.0 does.

So here goes:
1. If you haven't already, install NeoOffice/J (I am using v1.1, downloaded 2005-08-14) and MySQL (I am using 4.1.13-standard).
2. Download Connector/J 3.0 from http://www.mysql.com and save it to the Desktop. (I downloaded v3.0.17, the tar.gz version).
3. Extract it.
4. Copy the .jar file to wherever you like (I chose ~/lib).
5. Open Neooffice/J.
6. Go to the following Menu: Tools | Options...
7. On the left is a tree of items. At the very top is NeoOffice/J. Indented and underneath is a list of other items. Click on Security.
8. This changes the panel on the right. At the bottom is a Java section. Click the Browse button.
9. Make sure that there are no other Connector/J versions installed (e.g., 3.1) or they will make life messy. To remove them, click the jar file to select, then click Delete. Repeat as necessary. (Note: not all items here are necessarily Connector/J archives, use some caution).
9. Click the Add button.
10. Browse to the directory the Connector/J 3.0 jar file is in. Select the .jar file and click the Open button.
11. Click the OK button.
12. Exit NeoOffice/J.
13. Restart NeoOffice/J.
14. Go to the following Menu: Tools | Data Sources...
15. Above the panel on the left is a button that says New Data Source. Click it.
16. Change the URL to: mysql://localhost:3306/test
17. Click the JDBC tab.
18. Set the JDBC cDrive class to: com.mysql.jdbc.Driver
19. Set the user name and check the password box, if required.
20. Click the Tables tab.
21. Fill out your password if necessary.
22. Observe that no error message appears and that there is an entry in the white box.
Back to top
MechaBlue
Blue Pill


Joined: Aug 14, 2005
Posts: 3

PostPosted: Sun Aug 14, 2005 11:30 pm    Post subject: Wiki

If my previous post helps you, please check out the entry in the wiki at http://neowiki.sixthcrusade.com/index.php/Using_MySQL and contribute to the list by formatting it for clarity, correcting mistakes, or otherwise improving it.

Thank you.
Back to top
sardisson
Town Crier
Town Crier


Joined: Feb 01, 2004
Posts: 4588

PostPosted: Mon Aug 15, 2005 12:40 am    Post subject: Re: Wiki

MechaBlue wrote:
If my previous post helps you, please check out the entry in the wiki at http://neowiki.sixthcrusade.com/index.php/Using_MySQL and contribute to the list by formatting it for clarity, correcting mistakes, or otherwise improving it.

Thank you.

Don't forget to check out the NeoWiki Style Guide when doing so Wink

(It actually looks more like a Style Guide and less like a running discussion now Smile)

Smokey

P.S. Your username has an unfortunate resemblence to a spammer who used to attack the wiki Sad

_________________
"[...] whether the duck drinks hot chocolate or coffee is irrelevant." -- ovvldc and sardisson in the NeoWiki
Back to top
MechaBlue
Blue Pill


Joined: Aug 14, 2005
Posts: 3

PostPosted: Sat Aug 20, 2005 4:45 pm    Post subject: Spammers and Style

Not that they belong in the same sentence...

I am sorry to hear about the the spammer. I can assure you that I am not a spammer through words and, more importantly, through my actions.

I will do my best to meet the guidelines as described in the style-guide. And when I do transgress, I hope that my content will make up for it. I'm very detail-oriented but, unfortunately, I am also very busy and not infallible.
Back to top
sardisson
Town Crier
Town Crier


Joined: Feb 01, 2004
Posts: 4588

PostPosted: Sat Aug 20, 2005 9:30 pm    Post subject: Re: Spammers and Style

MechaBlue wrote:
I am sorry to hear about the the spammer. I can assure you that I am not a spammer through words and, more importantly, through my actions.

Indeed! Smile

MechaBlue wrote:
I will do my best to meet the guidelines as described in the style-guide. And when I do transgress, I hope that my content will make up for it. I'm very detail-oriented but, unfortunately, I am also very busy and not infallible.

Sorry; my style comment wasn't meant as a "knock" at you but as a general FYI for any new contributors your post might have attracted. (The style guide actually developed fairly late in the game and a number of parts of the wiki still need to be brought up to spec, but we're trying to make all new content conform and slowly working through the remaining stuff....)

Thanks for jumping in on updating that article, and welcome aboard!

Smokey

_________________
"[...] whether the duck drinks hot chocolate or coffee is irrelevant." -- ovvldc and sardisson in the NeoWiki
Back to top
Display posts from previous:   
   NeoOffice Forum Index -> NeoOffice Releases All times are GMT - 7 Hours
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Powered by phpBB © 2001, 2005 phpBB Group

All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest © Planamesa Inc.
NeoOffice is a registered trademark of Planamesa Inc. and may not be used without permission.
PHP-Nuke Copyright © 2005 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.