I have written a java program to connect to AS400 DB. I am using jt400-6.4.jar to connect to DB.
DB Properties I am using:
as400_dbUrl=jdbc:as400://host/schema;translate binary=true
as400_dbUser=user
as400_dbPassword=pass
My program is not able to connect to DB server i am getting the below error.
2017-06-30 05:36:53 ERROR DBUtil:88 - Exception:
java.sql.SQLException: The application requester cannot establish the connection. (A remote host refused an attempted connect operation.)
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:528)
at com.ibm.as400.access.AS400JDBCConnection.setProperties(AS400JDBCConnection.java:3130)
at com.ibm.as400.access.AS400JDBCDriver.prepareConnection(AS400JDBCDriver.java:1360)
at com.ibm.as400.access.AS400JDBCDriver.initializeConnection(AS400JDBCDriver.java:1211)
at com.ibm.as400.access.AS400JDBCDriver.connect(AS400JDBCDriver.java:352)
at java.sql.DriverManager.getConnection(DriverManager.java:426)
at java.sql.DriverManager.getConnection(DriverManager.java:474)
I googled about this, not able to find the exact reason.
I think jt400.jar will use 8471 as the port to connect to DB. Please correct me if I am wrong regarding this port.
I am not able to ping the host. ping host is not returning any response.
I am able to telnet like telnet host. But I am not able to telnet the system like telnet host 8471
Your hlep will be highly appreciable. Kindly help.
try updating your DB property as:
Add <:port-number> after host
as400_dbUrl=jdbc:as400://host:port/schema;translate binary=true
Hope this solves your problem.
Related
I am unable to connect to Cassandra DB. I have tried with port number 9042 but it is throwing an exception given below
java.sql.SQLNonTransientConnectionException: org.apache.thrift.transport.TTransportException: Read a negative frame size (-2097152000)!.
Due to that I am using port number 9160 for the same. But it is giving me below exception
[main] ERROR org.bigsql.cassandra2.jdbc.CassandraConnection - Impossible to connect to server Server Name : org.apache.thrift.transport.TTransportException: java.net.ConnectException: Connection timed out: connect
Please provide the solution on the same. Please see below code that I am using for connection.
URL="jdbc:cassandra://server name:9160/schema";
address =address;
user=Username;
pass=Password;
Class.forName("org.bigsql.cassandra2.jdbc.CassandraDriver");
conn = DriverManager.getConnection(URL,user,pass);
The URL is not correct you have a problem in this URL :
URL="jdbc:cassandra://server name:9160/schema";
Here is the syntax you should to follow :
jdbc:cassandra://host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[keyspace][?options]]
So for example :
URL="jdbc:cassandra://10.6.99.99:9160/dbname";
So in place of server name you should to specify the #IP of your database or the right host.
Second after the port number 9160/schema you should to specify the name of your database and not the schema.
Take a look at :
cassandra jdbc driver
cassandra jdbc
EDIT
As #Mark Rotteveel mention : ..Or the port is wrong, or the port isn't
open on the accessible IP address for that hostname
so make sure that this port is open on the accessible IP address for that host name.
I'm learning R language. I want to establish a connection with MySQL using R. I've studied how to do from here, here, tutorial and from many other websites. I've followed all the steps to connect with MySQL, but still I'm unable to connect with MySQL, and getting an error:
Error in .local(drv, ...) :
Failed to connect to database: Error: Can't connect to MySQL server on 'localhost' (0)
Here is screenshot of what I did:
I'm using R version-3.2.2 and MySQL version-5.6 and MySQL database is running on localhost:1527. Please help me to remove the error and tell me what I'm doing wrong.
INFO: I'm able to connect above MySQL database with java.
you say that your mysql is running on localhost:1527 - but you don't specify that port in dbConnect, then it probably uses the default port, 3306, so it should not be able to connect... add the port argument to your dbConnect
dbConnect(MySQL(), user="user", password="password", dbname="dbname", host="localhost", port="1527")
I'm trying to make a connection to an already existing database in SQL Server 2012n with Netbeans 8.
Using the connection wizard I select Sql Server 2012 and enter the credentials and fields.
However I get the message that a connection cannot be established.
You can see screenshots of the entered fields:
I also tried using "localhost" instead of "STIJN" this didn't work. I also tried with the default port "1433". Also didn't worked, however what port should this be? Where can I see what port I'm using? Maybe the error lies in the port, otherwise I wouldn't know where I made a mistake.
Go to your SQL Server configuration manager -> SQL server network configuration -> protocols for SQLEXPRESS -> TCP/IP (double click on it for properties).
On protocol page set enabled to Yes.
On IP Addresses page, scroll to bottom.
TCP Dynamic Ports: 54629
TCP Port: 1433
Apply and ok.
Make a connection with:
Host: localhost
Port: 1433
Your credentials
Instance field = blank.
This should work.
I am trying to install "Kwok information server" and I am new to postgreSQL. I just followed the installation guide of Kwok information server.
when I am trying to install kwok-schema-setup.jar file using java through postgreSQL server in Command Prompt, I am getting the following error..."Connecting to PostgreSQL Server ...failed. Connection refused. Check that the ho
stname and port are correct and that the postmaster is accepting TCP/IP connecti
ons. Cause: java.net.ConnectException: Connection refused: connect
Schema setup encountered errors" .
And when I am trying to connect to the server using pgAdmin III, I am getting the following error "Server doesn't listen
The server doesn't accept connections: the connection library reports
could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432? ".
Please anyone help me regarding, Thanks in advance!!
Looks like your Postgresql daemon is not running. Check if the server has started and is running. I dont know which OS you are using but try ps -ax on linux/mac or the task manager in windows.
Maybe a firewall that is blocking the connection, you have to provide more information about your environment to be sure.
I have a cassandra server running on a server(serv1). cassandra-cli can connect to it when run on serv1. However, when i try to connect to it through some other server(serv2), i get the following exception:
org.apache.thrift.transport.TTransportException: java.net.ConnectException: Connection refused
at org.apache.thrift.transport.TSocket.open(TSocket.java:183)
at org.apache.thrift.transport.TFramedTransport.open(TFramedTransport.java:81)
at org.apache.cassandra.cli.CliMain.connect(CliMain.java:80)
at org.apache.cassandra.cli.CliMain.main(CliMain.java:256)
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at org.apache.thrift.transport.TSocket.open(TSocket.java:178)
... 3 more
Exception connecting to jckstore/9160. Reason: Connection refused.
I looked in cassandra.yaml and found that the property "listen_address" is configured to "localhost" and using 0.0.0.0 is severely discouraged. I tried to change localhost to serv2, ip address of serv1 but nothing worked. Even commenting out didnt help.
Is there a way i can make my cassandra server listen on all the ip's without using 0.0.0.0
I was able to solve the problem as following:
changing the rpc_address property in cassandra.yaml to 0.0.0.0 instead of localhost.
set the broadcast_rpc_address property in cassandra.yaml to a value other than 0.0.0.0
Then I can access.
Cassandra cli uses thrift to connect to Cassandra. The rpc_address decides how the thrift clients can connect to Cassandra. Setting it to 0.0.0.0 will work, but setting it to the hostname of the server and then using the same hostname to connect will also work.
I also had the same problem, and I was constantly surprised because it was configured correctly. In the end, I found out it was permission issues:
chown -R cassandra: /var/lib/cassandra
chown -R cassandra: /var/log/cassandra
Hope it helps :-)
I had the same problem. I fixed this by updating the snappy temp dir VM option to point to the right directory.
VM_OPTS="$JVM_OPTS -Dorg.xerial.snappy.tempdir=/home/users/local/user/cassandra_home/snap
Hope this helps!
I also had the same problem "Connection refused". Changing the rpc_address from "localhost" to the same hostname as listen_address worked for me.
I also had the same problem "Connection refused". Changing start_rpc: to true fixed it for me.