JDBC connection refused
I wrote a jdbc connection to vertica database on IPV6 environment,but it failed , my vertica version is 7.1.1.
BTW, everything is OK on IPV4 environment.
This is my error log:
java.sql.SQLNonTransientConnectionException: [Vertica][JDBC](10100) Connection Refused: [Vertica][JDBC](11640) Required Connection Key(s): database, host; [Vertica][JDBC](11480) Optional Connection Key(s): autocommit, backupservernode, connectionloadbalance, connsettings, directbatchinsert, enableroutablequeries, failonmultinodeplans, jaasconfigname, kerberoshostname, kerberosservicename, logintimeout, loglevel, lognamespace, logpath, maxpooledconnections, maxpooledconnectionspernode, maxpooledconnectionuses, metadatacachelifetime, nodedownwaittime, port, readonly, resultbuffersize, sessionlabel, ssl, streamingbatchinsert, threepartnaming, transactionisolation at com.vertica.exceptions.ExceptionConverter.toSQLException(Unknown Source) ~[vertica-jdbc-7.1.1-0.jar:na]
at com.vertica.jdbc.common.BaseConnectionFactory.checkResponseMap(Unknown Source) ~[vertica-jdbc-7.1.1-0.jar:na]
at com.vertica.jdbc.common.BaseConnectionFactory.doConnect(Unknown Source) ~[vertica-jdbc-7.1.1-0.jar:na]
at com.vertica.jdbc.common.AbstractDriver.connect(Unknown Source) ~[vertica-jdbc-7.1.1-0.jar:na]
at java.sql.DriverManager.getConnection(DriverManager.java:571) ~[na:1.7.0_71]
at java.sql.DriverManager.getConnection(DriverManager.java:187) ~[na:1.7.0_71]
This is my connection codes:
/** * get database connection
* @return
* @throws SQLException
* @throws UnknownHostException
*/
public Connection getConnection() throws SQLException, UnknownHostException {
Properties info = new Properties();
info.put("User", dbContext.getUserName());
info.put("Password", dbContext.getPassword());
InetAddress local = null;
local = InetAddress.getLocalHost();
if (local instanceof Inet4Address) {
info.put("PreferredAddressFamily", "ipv4");
} else if (local instanceof Inet6Address) {
info.put("PreferredAddressFamily", "ipv6");
} else {
info.put("PreferredAddressFamily", "ipv4");
}
connection = DriverManager.getConnection(dbContext.getUrl(), info);
// connection = DriverManager.getConnection(dbContext.getUrl(),
// dbContext.getUserName(), dbContext.getPassword());
return connection;
}
BTW, everything is OK on IPV4 environment.
This is my error log:
java.sql.SQLNonTransientConnectionException: [Vertica][JDBC](10100) Connection Refused: [Vertica][JDBC](11640) Required Connection Key(s): database, host; [Vertica][JDBC](11480) Optional Connection Key(s): autocommit, backupservernode, connectionloadbalance, connsettings, directbatchinsert, enableroutablequeries, failonmultinodeplans, jaasconfigname, kerberoshostname, kerberosservicename, logintimeout, loglevel, lognamespace, logpath, maxpooledconnections, maxpooledconnectionspernode, maxpooledconnectionuses, metadatacachelifetime, nodedownwaittime, port, readonly, resultbuffersize, sessionlabel, ssl, streamingbatchinsert, threepartnaming, transactionisolation at com.vertica.exceptions.ExceptionConverter.toSQLException(Unknown Source) ~[vertica-jdbc-7.1.1-0.jar:na]
at com.vertica.jdbc.common.BaseConnectionFactory.checkResponseMap(Unknown Source) ~[vertica-jdbc-7.1.1-0.jar:na]
at com.vertica.jdbc.common.BaseConnectionFactory.doConnect(Unknown Source) ~[vertica-jdbc-7.1.1-0.jar:na]
at com.vertica.jdbc.common.AbstractDriver.connect(Unknown Source) ~[vertica-jdbc-7.1.1-0.jar:na]
at java.sql.DriverManager.getConnection(DriverManager.java:571) ~[na:1.7.0_71]
at java.sql.DriverManager.getConnection(DriverManager.java:187) ~[na:1.7.0_71]
This is my connection codes:
/** * get database connection
* @return
* @throws SQLException
* @throws UnknownHostException
*/
public Connection getConnection() throws SQLException, UnknownHostException {
Properties info = new Properties();
info.put("User", dbContext.getUserName());
info.put("Password", dbContext.getPassword());
InetAddress local = null;
local = InetAddress.getLocalHost();
if (local instanceof Inet4Address) {
info.put("PreferredAddressFamily", "ipv4");
} else if (local instanceof Inet6Address) {
info.put("PreferredAddressFamily", "ipv6");
} else {
info.put("PreferredAddressFamily", "ipv4");
}
connection = DriverManager.getConnection(dbContext.getUrl(), info);
// connection = DriverManager.getConnection(dbContext.getUrl(),
// dbContext.getUserName(), dbContext.getPassword());
return connection;
}
0
Comments
***********************************
And how about to read it? And you provided (case sensitive):
- User
- Password
So database and host are missing.Why logs exists? Why developer did a logging in human readable format?
Logs - its just some garbage, don't read them.