Package marauroa.server.db

Examples of marauroa.server.db.DatabaseConnectionException


        DAORegister.get();
        configureGameDatabaseAccess();
      }
    } catch (Exception e) {
      logger.error("cannot get player database", e);
      throw new DatabaseConnectionException(e);
    }
  }
View Full Code Here


      try {
        if  (connInfo.get("jdbc_class") != null) {
          Class.forName((String) connInfo.get("jdbc_class")).newInstance();
        }
      } catch (Exception e) {
        throw new DatabaseConnectionException("Cannot load driver class " + connInfo.get("jdbc_class"), e);
      }

      Properties connectionInfo = new Properties();
      if (connInfo.get("jdbc_user") != null) {
        connectionInfo.put("user", connInfo.get("jdbc_user"));
      }
      if (connInfo.get("jdbc_pwd") != null) {
        connectionInfo.put("password", connInfo.get("jdbc_pwd"));
      }
      connectionInfo.put("charSet", "UTF-8");

      Connection conn = DriverManager.getConnection((String) connInfo.get("jdbc_url"), connectionInfo);

      // enable transaction support
      conn.setAutoCommit(false);
      conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);

      DatabaseMetaData meta = conn.getMetaData();
      logger.info("Connected to " + connInfo.get("jdbc_url")
          + ": " + meta.getDatabaseProductName() + " " + meta.getDatabaseProductVersion()
          + " with driver " +  meta.getDriverName() + " " + meta.getDriverVersion());

      return conn;
    } catch (SQLException e) {
      throw new DatabaseConnectionException("Unable to create a connection to: " + connInfo.get("jdbc_url"), e);
    }
  }
View Full Code Here

TOP

Related Classes of marauroa.server.db.DatabaseConnectionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.