Could not create connection to database server

Junior Spellweaver
Joined
Jul 11, 2012
Messages
137
Reaction score
2
i know i've been creating alot of threads but lately things have been going wrong..
ive never had this error before and it appeared today :


yarden - Could not create connection to database server - RaGEZONE Forums



anyone knows how to solve it?
BTW IM USING HELIOSMS V83
 
Last edited:
Possible cause:
1. database setting is incorrect.
2. ThreadLocal is not initialize.

Make sure your username/password is correct.
 
Upvote 0
Possible cause:
1. database setting is incorrect.
2. ThreadLocal is not initialize.

Make sure your username/password is correct.

database setting is correct since the server has been online for about 2 weeks and ive never had that error.
yesterday i uninstalled wamp server and then i reinstalled it
and ever since it keeps hapening..

btw thats what my databaseconnection.java looks like :

PHP:
/*
 * This file is part of the OdinMS Maple Story Server
 * Copyright (C) 2008 Patrick Huy <[email protected]>
 *                    Matthias Butz <[email protected]>
 *                    Jan Christian Meyer <[email protected]>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License version 3
 * as published by the Free Software Foundation. You may not use, modify
 * or distribute this program under any other version of the
 * GNU Affero General Public License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package tools;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Collection;
import java.util.LinkedList;
import java.util.Properties;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * All servers maintain a Database Connection. This class therefore "singletonices" the connection per process.
 *
 *
 * @author Frz
 */
public class DatabaseConnection {

    private static ThreadLocal<Connection> con = new ThreadLocalConnection();
    private final static Logger LOG = LoggerFactory.getLogger(DatabaseConnection.class);
    private static Properties props = null;

    public static Connection getConnection() {
        if (props == null) {
            throw new RuntimeException("DatabaseConnection not initialized");
        }
        return con.get();
    }

    public static boolean isInitialized() {
        return props != null;
    }

    public static void setProps(Properties aProps) {
        props = aProps;
    }

    public static void closeAll() throws SQLException {
        for (Connection chon : ThreadLocalConnection.allConnections) {
            chon.close();
        }
    }

    private static class ThreadLocalConnection extends ThreadLocal<Connection> {

        public static Collection<Connection> allConnections = new LinkedList<Connection>();

        @Override
        protected Connection initialValue() {
            String driver = props.getProperty("driver");
            String url = props.getProperty("url");
            String user = props.getProperty("user");
            String password = props.getProperty("password");
            try {
                Class.forName(driver); // touch the mysql driver
            } catch (ClassNotFoundException e) {
                LOG.error("ERROR", e);
            }
            try {
                Connection con = DriverManager.getConnection(url, user, password);
                allConnections.add(con);
                return con;
            } catch (SQLException e) {
                LOG.error("ERROR", e);
                return null;
            }
        }
    }
}

using heliosms v83
 
Upvote 0
What's the color of your wamp icon? If it's yellow but says online make sure to check the SQL service. Port 80 constantly gets screwed over by things like skype.
 
Upvote 0
What's the color of your wamp icon? If it's yellow but says online make sure to check the SQL service. Port 80 constantly gets screwed over by things like skype.

the problem is
it is green at the begining but when i log on the server and i just @go fm the wamp goes orange and the database dissapears like all npcs just dissapear and when someone trys to log on it says Unregistered ID
the wamp is always green if i restart all services but as soon as i log in it goes orange and i get that error..
 
Upvote 0
Back