Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Connection refused: connect

Help
Fiona
2011-11-26
2013-04-29
  • Fiona
    Fiona
    2011-11-26

    hello,

    I have started trying to get JWNL set up in Netbeans on Windows, and I've run into a few problems to say the least.

    The code I am running is as follows

      String sProjectPath = System.getProperty("user.dir");
            String sPropertyFile= sProjectPath + "\\config\\file_properties.xml";
            String sCreateTableScript = sProjectPath + "\\sql\\create.sql";
            String sDriverClass="com.mysql.jdbc.Driver";
            String sConnectionURL="jdbc:mysql://localhost/jwnl?user=jwnl&password=jwnl";
            String[] mainargs = new String[4];
            mainargs[0] = sPropertyFile;
            mainargs[1] = sCreateTableScript;
            mainargs[2] = sDriverClass;
            mainargs[3] = sConnectionURL;
            DictionaryToDatabase.main(mainargs) ;
    

    and I am recieving an error saying that I am being refused connection from the database.

    The entire error is as follows:

    java.net.ConnectException: Connection refused: connect
            at java.net.PlainSocketImpl.socketConnect(Native Method)
            at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
            at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
            at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
            at java.net.Socket.connect(Socket.java:525)
            at java.net.Socket.connect(Socket.java:475)
            at java.net.Socket.<init>(Socket.java:372)
            at java.net.Socket.<init>(Socket.java:215)
            at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:256)
            at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:271)
            at com.mysql.jdbc.Connection.createNewIO(Connection.java:2771)
            at com.mysql.jdbc.Connection.<init>(Connection.java:1555)
            at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
            at java.sql.DriverManager.getConnection(DriverManager.java:582)
            at java.sql.DriverManager.getConnection(DriverManager.java:207)
            at net.didion.jwnl.dictionary.database.ConnectionManager.getConnection(ConnectionManager.java:31)
            at net.didion.jwnl.utilities.DictionaryToDatabase.main(DictionaryToDatabase.java:89)
            at mp_1.WordNet.<init>(WordNet.java:44)
    

    What reasons would there be to have a connection refused?