Results 1 to 3 of 3
  1. #1
    firen is offline Member
    Join Date
    Jun 2010
    Posts
    3
    Rep Power
    0

    Default cpanel db information

    Hey im new in the area of DBs vs JAVA.
    I have created a MySQL at cpanel and x10hosting and therefore using this:

    String url ="jdbc:mysql://int.chopin.x10hosting.com:3306/firen_chat";

    But it just keep saying

    ** BEGIN NESTED EXCEPTION **

    java.net.SocketException
    MESSAGE: java.net.ConnectException: Operation timed out

    STACKTRACE:

    java.net.SocketException: java.net.ConnectException: Operation timed out
    at com.mysql.jdbc.StandardSocketFactory.connect(Stand ardSocketFactory.java:156)
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:284)
    at com.mysql.jdbc.Connection.createNewIO(Connection.j ava:2565)
    at com.mysql.jdbc.Connection.<init>(Connection.java:1 485)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonReg isteringDriver.java:266)
    at java.sql.DriverManager.getConnection(DriverManager .java:582)
    at java.sql.DriverManager.getConnection(DriverManager .java:185)
    at mysqltest.JMySQL.openDBConnection(JMySQL.java:71)
    at mysqltest.JMySQL.<init>(JMySQL.java:25)
    at mysqltest.JSqlGui.<init>(JSqlGui.java:40)
    at mysqltest.JSqlGui.main(JSqlGui.java:61)


    ** END NESTED EXCEPTION **

    Im not sure if I use the right host. I have just used the one appearing from phpMyAdmin from "user": firen@int.chopin.x10hosting.com

    Anyone has som clues?

  2. #2
    Sno's Avatar
    Sno
    Sno is offline Senior Member
    Join Date
    Apr 2010
    Posts
    196
    Rep Power
    5

    Default

    It helps if you show us your whole code giving the connection. your error may not be in the string.

    maybe yours is port specific?
    :rolleyes: ~ Sno ~ :rolleyes:
    '-~ B.S. Computer Science ~-'

  3. #3
    firen is offline Member
    Join Date
    Jun 2010
    Posts
    3
    Rep Power
    0

    Default

    public class JMySQL {

    /* Instance variables */
    Connection con = null;

    /**
    * Constructor
    */
    public JMySQL() throws IOException {
    String url ="jdbc:mysql://chopin.x10hosting.com:3306/firen_chat";
    String userName = "brugernavn";
    String password = "password";
    openDBConnection(url,userName,password);
    }

    private void openDBConnection(String url, String userName, String password) throws IOException {
    try {
    // Register the JDBC driver for MySQL.
    Class.forName("com.mysql.jdbc.Driver");
    con = DriverManager.getConnection(url,userName,password) ;
    } catch (SQLException e) {
    System.err.println("SQL Exception caught: " + e);
    } catch (ClassNotFoundException e) {
    System.err.println("Could not register driver: " + e);
    } finally {
    // if no connection was established we throw an IOExeption
    if (con == null){
    throw new IOException("No connection to the database!");
    }
    }
    }
    }

Similar Threads

  1. How to get System Information like CPU Name, Ram...
    By Beginner in forum New To Java
    Replies: 2
    Last Post: 05-24-2010, 04:07 PM
  2. need some compatibility information
    By wildheart25c in forum CLDC and MIDP
    Replies: 0
    Last Post: 04-25-2010, 07:29 AM
  3. Security Information
    By saty_32016 in forum CLDC and MIDP
    Replies: 0
    Last Post: 03-05-2009, 08:14 AM
  4. information used in other class
    By Ancalime in forum New To Java
    Replies: 1
    Last Post: 07-17-2008, 04:28 PM
  5. system information
    By nitinborge5 in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 09:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •