LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-01-2009, 08:15 AM   #16
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Original Poster
Rep: Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062

I would appreciate that test program if it's not too much trouble (mailto:trona@ameritech.net) and thank you for the offer.

I have installed JDK (from the extra directory) and moved the connector from my classes directory (and removed CLASSPATH from the environment). Within OpenOffice I've pointed the "Class Path" to /usr/lib/java/lib/ext (the driver loads with just that) as well as to /usr/lib/java/lib/ext/mysql-connector...jar (and the driver loads). Also tried a space, "localhost" and the actual address of the machine for the URL setting and everything reports a communications link failure. I'm sort of at a loss and it'd be nice to try something to determine if it's an OpenOffice thing and a Java thing (I already know I can get at that data base because I can do so with the ODBC drivers). I've also fiddled with /etc/my.cnf, enabling and disabling the skip-networking directive and that hasn't mattered, either (unless there's something goofy about the pretty much default settings in my.cnf). Ah, well.

So, anyway, thank you for your interest.
 
Old 03-01-2009, 08:54 AM   #17
arubin
Senior Member
 
Registered: Mar 2004
Location: Middx UK
Distribution: Slackware64 14.2 (multilib)
Posts: 1,260

Rep: Reputation: 60
I've emailed you the java class. Here is the code which you can play with yourself if you want

Quote:
import java.sql.DriverManager;



class Mysqltest {
public static void main(String[] args) {
String s1 = args[0];
String s2 = args[1];
String s3 = args[2];
java.sql.Connection conn;

try {
String s4 = "jdbc:mysql://localhost/" + s1 + "?user=" +
System.getProperty("user.name") + "&password=" + s3;
System.out.println(s4);
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection(s4);
System.out.println("Success");
} catch (Exception e) {
System.out.println("Error -- " + e.toString());
e.printStackTrace();
System.exit(0);
}


}
}
It is a bit crude. If the connection works then it prints "Success". If it fails it just prints the error messages.
 
Old 03-01-2009, 09:40 AM   #18
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Original Poster
Rep: Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062
OK, I've tried the source with mysql-connector 3.1.14, 5.0.8 and 5.1.7 (that's the recommended one at Sun's web site), compiling Mysqltest.class with javac Mysqltest.java for each (I saved the source as Mysqltest.java; think that's the right way to do it). Currently, mysql-connector-java-3.1.14-bin.jar is the installed version at /usr/lib/java/lib/ext and, when I run the program it kicks out all this stuff (which, I assume, means I haven't got something set correctly somewhere or other -- arrgghh!):
Code:
java Mysqltest gnis myuserid mypassword
jdbc:mysql://localhost/gnis?user=myuserid&password=mypassword
Error -- com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.net.SocketException
MESSAGE: java.net.ConnectException: Connection refused

STACKTRACE:

java.net.SocketException: java.net.ConnectException: Connection refused
        at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156)
        at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:284)
        at com.mysql.jdbc.Connection.createNewIO(Connection.java:2569)
        at com.mysql.jdbc.Connection.<init>(Connection.java:1485)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at Mysqltest.main(Mysqltest.java:17)


** END NESTED EXCEPTION **



Last packet sent to the server was 17 ms ago.
com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.net.SocketException
MESSAGE: java.net.ConnectException: Connection refused

STACKTRACE:

java.net.SocketException: java.net.ConnectException: Connection refused
        at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156)
        at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:284)
        at com.mysql.jdbc.Connection.createNewIO(Connection.java:2569)
        at com.mysql.jdbc.Connection.<init>(Connection.java:1485)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at Mysqltest.main(Mysqltest.java:17)


** END NESTED EXCEPTION **



Last packet sent to the server was 17 ms ago.
        at com.mysql.jdbc.Connection.createNewIO(Connection.java:2643)
        at com.mysql.jdbc.Connection.<init>(Connection.java:1485)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at Mysqltest.main(Mysqltest.java:17)
 
Old 03-01-2009, 10:08 AM   #19
arubin
Senior Member
 
Registered: Mar 2004
Location: Middx UK
Distribution: Slackware64 14.2 (multilib)
Posts: 1,260

Rep: Reputation: 60
Just had a brainwave

go to /etc/rc.d/rc/mysqld

Quote:
# Before you can run MySQL, you must have a database. To install an initial
# database, do this as root:
#
# mysql_install_db --user=mysql
#
# Note that the mysql user must exist in /etc/passwd, and the created files
# will be owned by this dedicated user. This is important, or else mysql
# (which runs as user "mysql") will not be able to write to the database
# later (this can be fixed with 'chown -R mysql.mysql /var/lib/mysql').
#
# To increase system security, consider using "mysql_secure_installation"
# as well. For more information on this tool, please read:
# man mysql_secure_installation

# To allow outside connections to the database comment out the next line.
# If you don't need incoming network connections, then leave the line
# uncommented to improve system security.
#SKIP="--skip-networking"
make sure SKIP="--skip-networking" is commented out.
Restart mysql
 
Old 03-01-2009, 10:20 AM   #20
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Original Poster
Rep: Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062
Well, well, well. Another gotcha. I usually control MySQL with /etc/my.cnf, which, of course, has --skip-networking commented out (and /etc/my.cnf is supposed to override what happens when MySQL starts).

Bloody thing works.

Thank you for all the time and effort.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenOffice Base & MySQL datadriven Slackware 3 06-22-2005 06:37 PM
Openoffice Base 2 beta. How to use MySQL KR-data Linux - Software 1 04-24-2005 12:45 PM
JDBC and MySQL Driver White R4bbit Debian 2 08-13-2004 04:55 PM
mysql and jdbc gballsch Programming 7 05-14-2003 04:04 PM
MySQL and JDBC oulevon Programming 1 07-16-2001 06:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 09:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration