-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Gilmar Caiado wrote:
> Hi! > > I've been experiencing some problems regarding connection mysql/java. I'm > using a connector 3.0.8, and linux debian. I have also copied the connector > to JAVA_HOME/jre/lib/ext directory. > > Here's is the code: > > import java.sql.*; > > public class DBTeste{ > > public static void main(String[] args) { > try { > Class.forName ("com.mysql.jdbc.Driver"); > System.out.println("Driver JDBC loaded!"); > Connection con = > DriverManager.getConnection("jdbc:mysql://localhost:3306/mysql"); > } catch (SQLException sqle) { > System.err.println("SQL Exception: " + sqle.getMessage()); > } catch (Exception e) { > System.err.println("Exception: " + e.getMessage()); > } > } > } > > The error message I've got: > > SQL Exception: Unable to connect to any hosts due to exception: > java.net.ConnectException: Connection refused > > It's worth to remember that I'm able to enter in the db using a shell > command, without problems... > > Could someone help me? > > Thanks! > > Gilmar > > Debian has 'skip-networking' set in their .deb-based installs of MySQL. Connector/J needs TCP/IP networking in MySQL to be enabled, because Java doesn't support Unix domain sockets. You need to edit your my.cnf in /etc/mysql to remove the 'skip-networking' line, and restart MySQL. Of course, you should also figure out what you need to do to make sure this is secure for your particular situation :) -Mark - -- For technical support contracts, visit https://order.mysql.com/?ref=mmma __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Mark Matthews <[EMAIL PROTECTED]> / /|_/ / // /\ \/ /_/ / /__ MySQL AB, SW Dev. Manager - J2EE/Windows /_/ /_/\_, /___/\___\_\___/ Flossmoor (Chicago), IL USA <___/ www.mysql.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQE+2mzRtvXNTca6JD8RAny9AJ9yO6frhU2wiltJelgx2So+8zgpYQCfaozE cTwv7N49ryz63XE4zkQ1LCk= =oZaK -----END PGP SIGNATURE----- -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]