Search in sources :

Example 1 with ConnectionPropertiesImpl

use of org.apache.ignite.internal.jdbc.thin.ConnectionPropertiesImpl in project ignite by apache.

the class IgniteJdbcThinDriver method connect.

/**
 * {@inheritDoc}
 */
@Override
public Connection connect(String url, Properties props) throws SQLException {
    if (!acceptsURL(url))
        return null;
    ConnectionPropertiesImpl connProps = new ConnectionPropertiesImpl();
    connProps.init(url, props);
    return new JdbcThinConnection(connProps);
}
Also used : ConnectionPropertiesImpl(org.apache.ignite.internal.jdbc.thin.ConnectionPropertiesImpl) JdbcThinConnection(org.apache.ignite.internal.jdbc.thin.JdbcThinConnection)

Example 2 with ConnectionPropertiesImpl

use of org.apache.ignite.internal.jdbc.thin.ConnectionPropertiesImpl in project ignite by apache.

the class JdbcThinTcpIoTest method createTcpIo.

/**
 * Create JdbcThinTcpIo instance.
 *
 * @param addrs IP-addresses.
 * @param port Server socket port.
 * @return JdbcThinTcpIo instance.
 * @throws SQLException On connection error or reject.
 */
private JdbcThinTcpIo createTcpIo(String[] addrs, int port) throws SQLException {
    ConnectionPropertiesImpl connProps = new ConnectionPropertiesImpl();
    connProps.setAddresses(new HostAndPortRange[] { new HostAndPortRange("test.domain.name", port, port) });
    return new JdbcThinTcpIo(connProps) {

        @Override
        protected InetAddress[] getAllAddressesByHost(String host) throws UnknownHostException {
            InetAddress[] addresses = new InetAddress[addrs.length];
            for (int i = 0; i < addrs.length; i++) addresses[i] = InetAddress.getByName(addrs[i]);
            return addresses;
        }

        @Override
        public void handshake(ClientListenerProtocolVersion ver) {
        // Skip handshake.
        }
    };
}
Also used : HostAndPortRange(org.apache.ignite.internal.util.HostAndPortRange) ClientListenerProtocolVersion(org.apache.ignite.internal.processors.odbc.ClientListenerProtocolVersion) ConnectionPropertiesImpl(org.apache.ignite.internal.jdbc.thin.ConnectionPropertiesImpl) JdbcThinTcpIo(org.apache.ignite.internal.jdbc.thin.JdbcThinTcpIo) InetAddress(java.net.InetAddress)

Example 3 with ConnectionPropertiesImpl

use of org.apache.ignite.internal.jdbc.thin.ConnectionPropertiesImpl in project ignite by apache.

the class IgniteJdbcThinDriver method getPropertyInfo.

/**
 * {@inheritDoc}
 */
@Override
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException {
    ConnectionPropertiesImpl connProps = new ConnectionPropertiesImpl();
    connProps.init(url, info);
    return connProps.getDriverPropertyInfo();
}
Also used : ConnectionPropertiesImpl(org.apache.ignite.internal.jdbc.thin.ConnectionPropertiesImpl)

Aggregations

ConnectionPropertiesImpl (org.apache.ignite.internal.jdbc.thin.ConnectionPropertiesImpl)3 InetAddress (java.net.InetAddress)1 JdbcThinConnection (org.apache.ignite.internal.jdbc.thin.JdbcThinConnection)1 JdbcThinTcpIo (org.apache.ignite.internal.jdbc.thin.JdbcThinTcpIo)1 ClientListenerProtocolVersion (org.apache.ignite.internal.processors.odbc.ClientListenerProtocolVersion)1 HostAndPortRange (org.apache.ignite.internal.util.HostAndPortRange)1