Returns a new created connection

@param jcd the connection descriptor
@return an instance of Connection from the drivermanager
177049
protected Connection newConnectionFromDriverManager(JdbcConnectionDescriptor jcd)
            throws LookupException
    {
        Connection retval = null;
        // use JDBC DriverManager
        final String driver = jcd.getDriver();
        final String url = getDbURL(jcd);
        try
        {
            // loads the driver - NB call to newInstance() added to force initialisation
            ClassHelper.getClass(driver, true);
            final String user = jcd.getUserName();
            final String password = jcd.getPassWord();
            final Properties properties = getJdbcProperties(jcd, user, password);
            if (properties.isEmpty())
            {
                if (user == null)
                {
                    retval = DriverManager.getConnection(url);
                }
                else
                {
                    retval = DriverManager.getConnection(url, user, password);
                }
            }
            else
            {
                retval = DriverManager.getConnection(url, properties);
            }
        }
        catch (SQLException sqlEx)
        {
            log.error("Error getting Connection from DriverManager with url (" + url + ") and driver (" + driver + ")", sqlEx);
            throw new LookupException("Error getting Connection from DriverManager with url (" + url + ") and driver (" + driver + ")", sqlEx);
        }
        catch (ClassNotFoundException cnfEx)
        {
            log.error(cnfEx);
            throw new LookupException("A class was not found", cnfEx);
        }
        catch (Exception e)
        {
            log.error("Instantiation of jdbc driver failed", e);
            throw new LookupException("Instantiation of jdbc driver failed", e);
        }
        // initialize connection
        initializeJdbcConnection(retval, jcd);
        if(log.isDebugEnabled()) log.debug("Create new connection using DriverManager: "+retval);
        return retval;
    }
745219
Connection getSingleConnection() {
        Connection connection = null;
        try {
            Class.forName(driver);
            connection = DriverManager.getConnection(url, user, password);
        } catch (SQLException e) {
            throw new InitializationException("Could not initialize the connection", e);
        } catch (ClassNotFoundException e) {
            throw new InitializationException("Could not find the driver class", e);
        }
        return connection;
    }
564800
protected Cassandra.Client getConnection(Object connection)
    {
        if (connection != null)
        {
            return ((Connection) connection).getClient();
        }

        throw new KunderaException("Invalid configuration!, no available pooled connection found for:"
                + this.getClass().getSimpleName());
    }
272753
@Override
	public final Connection createConnection() throws JMSException
    {
    	String username = getStringProperty(Context.SECURITY_PRINCIPAL,null);
    	String password = getStringProperty(Context.SECURITY_CREDENTIALS,null);
    	
        return createConnection(username,password);
    }
996451
public static Connection getconnnection() {
		Connection con = null;
		try {
			con = DriverManager.getConnection(url, userName, password);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return con;
	}
1262939
protected AJP13Connection createConnection(Socket socket) throws IOException
    {
        return new AJP13Connection(this,socket.getInputStream(),socket.getOutputStream(),socket,getBufferSize());
    }
309463
@Override
    public Connection makeObject(ObjectPoolWithThreadAffinity<Connection> pool) throws Exception
    {
        Connection conn = connectionFactory.createConnection();
        return new PooledConnection(conn, pool, this.statementsToPool);
    }
1095663
private Connection getJdbcConnection() throws JspCoreException, SQLException {

        Connection conn = null;

        String url = getConnProperties().getUrl();
        String user = getConnProperties().getLoginUser();
        String passwd = getConnProperties().getLoginPasswd();
        String jndiName = getConnProperties().getJndiName();

        //System.out.println("***** Query.getJdbcConnection():  jndiname = " + jndiName);

        if (jndiName == null) { // use driver manager
            // load driver
            String dbDriver = (getConnProperties()).getDbDriver();
            try {
                Class.forName(dbDriver);
                conn = DriverManager.getConnection(url, user, passwd);
            } // try load driver
            catch (ClassNotFoundException e) {
                //com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ws.webcontainer.jsp.tsx.db.Query.getJdbcConnection", "174", this);
                throw new JspCoreException(JspConstants.InvalidDbDriver + dbDriver);
            } // catch
        } // if jndiname == null
        else { // use datasource
            DataSource ds;
            try {
                ds = getSingleton(jndiName);
            }
            catch (Throwable th) {
                //com.ibm.ws.ffdc.FFDCFilter.processException(th, "com.ibm.ws.webcontainer.jsp.tsx.db.Query.getJdbcConnection", "184", this);
                throw new JspCoreException(JspConstants.DatasourceException + th.getMessage());
            }
            conn = ds.getConnection(user, passwd);
        }

        return conn;
    }
435423
@Override
    public ConnectionFactory createConnectionFactory(JmsJcaConnectionFactory jcaConnectionFactory, JmsJcaManagedConnectionFactory jcaManagedConnectionFactory) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "createConnectionFactory", new Object[] { jcaConnectionFactory, jcaManagedConnectionFactory });
        ConnectionFactory cf = new JmsConnectionFactoryImpl(jcaConnectionFactory, jcaManagedConnectionFactory);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "createConnectionFactory", cf);
        return cf;
    }
1314142
protected ObjectPool setupPool(JdbcConnectionDescriptor jcd)
    {
        log.info("Create new ObjectPool for DBCP connections:" + jcd);

        try
        {
            ClassHelper.newInstance(jcd.getDriver());
        }
        catch (InstantiationException e)
        {
            log.fatal("Unable to instantiate the driver class: " + jcd.getDriver() + " in ConnectionFactoryDBCImpl!" , e);
        }
        catch (IllegalAccessException e)
        {
            log.fatal("IllegalAccessException while instantiating the driver class: " + jcd.getDriver() + " in ConnectionFactoryDBCImpl!" , e);
        }
        catch (ClassNotFoundException e)
        {
            log.fatal("Could not find the driver class : " + jcd.getDriver() + " in ConnectionFactoryDBCImpl!" , e);
        }

        // Get the configuration for the connection pool
        GenericObjectPool.Config conf = jcd.getConnectionPoolDescriptor().getObjectPoolConfig();

        // Get the additional abandoned configuration
        AbandonedConfig ac = jcd.getConnectionPoolDescriptor().getAbandonedConfig();

        // Create the ObjectPool that serves as the actual pool of connections.
        final ObjectPool connectionPool = createConnectionPool(conf, ac);

        // Create a DriverManager-based ConnectionFactory that
        // the connectionPool will use to create Connection instances
        final org.apache.commons.dbcp.ConnectionFactory connectionFactory;
        connectionFactory = createConnectionFactory(jcd);

        // Create PreparedStatement object pool (if any)
        KeyedObjectPoolFactory statementPoolFactory = createStatementPoolFactory(jcd);

        // Set validation query and auto-commit mode
        final String validationQuery;
        final boolean defaultAutoCommit;
        final boolean defaultReadOnly = false;
        validationQuery = jcd.getConnectionPoolDescriptor().getValidationQuery();
        defaultAutoCommit = (jcd.getUseAutoCommit() != JdbcConnectionDescriptor.AUTO_COMMIT_SET_FALSE);

        //
        // Now we'll create the PoolableConnectionFactory, which wraps
        // the "real" Connections created by the ConnectionFactory with
        // the classes that implement the pooling functionality.
        //
        final PoolableConnectionFactory poolableConnectionFactory;
        poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory,
                connectionPool,
                statementPoolFactory,
                validationQuery,
                defaultReadOnly,
                defaultAutoCommit,
                ac);
        return poolableConnectionFactory.getPool();
    }
1272770
@Override
    public ConnectionFactory createConnectionFactory(JmsJcaConnectionFactory jcaConnectionFactory) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "createConnectionFactory", jcaConnectionFactory);
        ConnectionFactory cf = new JmsManagedConnectionFactoryImpl(jcaConnectionFactory);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "createConnectionFactory", cf);
        return cf;
    }
230344
public CouchDbConnector createConnector() {
        val connector = new StdCouchDbConnector(couchDbProperties.getDbName(), getCouchDbInstance(), objectMapperFactory);
        LOGGER.debug("Connector created: [{}]", connector);

        return connector;
    }
137350
public OTMConnection acquireConnection(PBKey pbkey)
	{
		Util.log("In JCAKit.getConnection,1");
		try
		{
			OTMConnectionRequestInfo info = new OTMConnectionRequestInfo(pbkey);
			return (OTMConnection) m_connectionManager.allocateConnection(m_managedConnectionFactory, info);
		}
		catch (ResourceException ex)
		{
			throw new OTMConnectionRuntimeException(ex);
		}
	}
1131868
public void createConnection(ICredentials credentials, ConnectorClusterConfig config) throws ConnectionException {
        logger.info("Creating new connection...");
        Connection connection = createNativeConnection(credentials, config);

        String connectionName = config.getName().getName();

        synchronized (connections) {
            if (!connections.containsKey(connectionName)) {
                connections.put(connectionName, connection);
                logger.info("Connected to [" + connectionName + "]");

            } else {
                String msg = "The connection [" + connectionName + "] already exists";
                logger.error(msg);
                throw new ConnectionException(msg);
            }
        }

    }
62636
@Override
    protected JedisConnector buildJedisConnector() {
        JedisConnector jedisConnector = new JedisConnector();
        jedisConnector.setJedisPoolConfig(JedisUtils.defaultJedisPoolConfig())
                .setRedisHostsAndPorts(redisHostAndPort).init();
        return jedisConnector;
    }
863225
public static Platform getPlatformFor(JdbcConnectionDescriptor jcd)
    {
        String dbms = jcd.getDbms();
        Platform result = null;
        String platformName = null;

        result = (Platform) getPlatforms().get(dbms);
        if (result == null)
        {
            try
            {
                platformName = getClassnameFor(dbms);
                Class platformClass = ClassHelper.getClass(platformName);
                result = (Platform) platformClass.newInstance();

            }
            catch (Throwable t)
            {
                LoggerFactory.getDefaultLogger().warn(
                        "[PlatformFactory] problems with platform " + platformName, t);
                LoggerFactory.getDefaultLogger().warn(
                        "[PlatformFactory] OJB will use PlatformDefaultImpl instead");

                result = new PlatformDefaultImpl();
            }
            getPlatforms().put(dbms, result); // cache the Platform
        }
        return result;
    }
1258503
public Socket createConnection(InetAddress peer) throws IOException
    {
        int attempts = 0;
        while (true)
        {
            try
            {
                Socket socket = OutboundTcpConnectionPool.newSocket(peer);
                socket.setSoTimeout(DatabaseDescriptor.getStreamingSocketTimeout());
                socket.setKeepAlive(true);
                return socket;
            }
            catch (IOException e)
            {
                if (++attempts >= MAX_CONNECT_ATTEMPTS)
                    throw e;

                long waitms = DatabaseDescriptor.getRpcTimeout() * (long)Math.pow(2, attempts);
                logger.warn("Failed attempt " + attempts + " to connect to " + peer + ". Retrying in " + waitms + " ms. (" + e + ")");
                try
                {
                    Thread.sleep(waitms);
                }
                catch (InterruptedException wtf)
                {
                    throw new IOException("interrupted", wtf);
                }
            }
        }
    }