| Author |
com.mysql.jdbc.exceptions.jdbc4.communicationsexception communications link failure
|
Adi Kulkarni
Ranch Hand
Joined: Mar 12, 2009
Posts: 86
|
|
Hi,
I'm getting this exception. Actually i'm running a loop and for many iterations its working fine but after around 25 seconds I get this exception for every iteration.
I am using jdk 1.5 , Mysql freeware 5.0 , OS is windows Vista.
Can anyone help me with the issue?
Thanks,
Aditya
|
SCJP 1.5
|
 |
Adi Kulkarni
Ranch Hand
Joined: Mar 12, 2009
Posts: 86
|
|
Hi all,
Any pointers ?
~Aditya
|
 |
Sagar Rohankar
Ranch Hand
Joined: Feb 19, 2008
Posts: 2896
|
|
Please print the full stack trace with the code which actually throwing the exception, because you said the problem is within a loop and I don't find any loop code?
Between, what is the "connection_timeout' environment variable set to ? also see the max client connection allowed setting in MySQL.
|
[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
|
 |
Adi Kulkarni
Ranch Hand
Joined: Mar 12, 2009
Posts: 86
|
|
Hi Rohan,
Following is the stack trace. Since DB is being used for comparison for every iteration, the loop comes into picture. So the thing is that the DB query is being executed fine for some iterations after which I get this exception
Cannot connect to database server
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet successfully received from the server was 1,252,319,692,146 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago.
at sun.reflect.GeneratedConstructorAccessor10.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2214)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:773)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)
at sun.reflect.GeneratedConstructorAccessor6.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:352)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:282)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.bt.LibraryDataProvider.compareUsingLibrary(LibraryDataProvider.java:27)
at com.bt.CSVFileProcessor.CompareAndWriteToFile(CSVFileProcessor.java:472)
at com.bt.CSVFileProcessor.processBufferData(CSVFileProcessor.java:428)
at com.bt.CSVFileProcessor.recognitionEngine(CSVFileProcessor.java:83)
at com.bt.MainProcessCall.main(MainProcessCall.java:12)
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The driver was unable to create a connection due to an inability to establish the client portion of a socket.
This is usually caused by a limit on the number of sockets imposed by the operating system. This limit is usually configurable.
For Unix-based platforms, see the manual page for the 'ulimit' command. Kernel or system reconfiguration may also be required.
For Windows-based platforms, see Microsoft Knowledge Base Article 196271 (Q196271).
at sun.reflect.GeneratedConstructorAccessor10.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:341)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2137)
... 15 more
Caused by: java.net.BindException: Address already in use: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:253)Entering compare and write
Buffer size 2
Exiting compare and write
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:290)
... 16 more
|
 |
Sagar Rohankar
Ranch Hand
Joined: Feb 19, 2008
Posts: 2896
|
|
Adi Kulkarni wrote:Hi Rohan,
Kulkarni, "Rohan" is part of my surname
I don't know how you're getting the connection, Its useless to comment anything unless you provide the "actual" code which is responsible for the exception(I think, its a loop code)
FYI,
And the exception itself explain its cause,
Adi Kulkarni wrote:
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The driver was unable to create a connection due to an inability to establish the client portion of a socket.
This is usually caused by a limit on the number of sockets imposed by the operating system. This limit is usually configurable.
For Unix-based platforms, see the manual page for the 'ulimit' command. Kernel or system reconfiguration may also be required.
For Windows-based platforms, see Microsoft Knowledge Base Article 196271 (Q196271).
Caused by: java.net.BindException: Address already in use: connect
|
 |
Adi Kulkarni
Ranch Hand
Joined: Mar 12, 2009
Posts: 86
|
|
Thanks SAGAR
|
 |
Adi Kulkarni
Ranch Hand
Joined: Mar 12, 2009
Posts: 86
|
|
This is the loop which calls that method
|
 |
Sagar Rohankar
Ranch Hand
Joined: Feb 19, 2008
Posts: 2896
|
|
Now, that's loop code, by any chance, doesn't hint any thing related to db connection.
Between, when I Google the exception, I found plenty hits discussed the same issue, so Google:
The driver was unable to create a connection due to an inability to establish the client portion of a socket.
|
 |
leglaude leglaudy
Greenhorn
Joined: Mar 06, 2011
Posts: 1
|
|
I found a solution that worked for me. (sorry for my english.... I m french)
I was looking for a solution all the day for using JDBC connector with mysql and eclipse. With the last version of JDBC connector 5.1... it does not work so after long hours I decided to change the version of the connector to 5.08 and then I don't have any more problem. It works fine. We are lot experiencing this problem so if it can help à would be pleased.
bye
glaudy
|
 |
m kanso
Greenhorn
Joined: Oct 12, 2011
Posts: 2
|
|
leglaude leglaudy wrote:I found a solution that worked for me. (sorry for my english.... I m french)
I was looking for a solution all the day for using JDBC connector with mysql and eclipse. With the last version of JDBC connector 5.1... it does not work so after long hours I decided to change the version of the connector to 5.08 and then I don't have any more problem. It works fine. We are lot experiencing this problem so if it can help à would be pleased.
bye
glaudy
Hello, I have the same problem, I am looking since 3 days for a solution to activate the connector but no issue ...
I tried the 5.0.8 version and it does not work neither
I am working with
thanks for your help
Marwa
|
 |
Scott Manno
Greenhorn
Joined: Nov 27, 2011
Posts: 2
|
|
|
If you're running multiple instances of MySQL, make sure the instance you're referencing is up and running.
|
 |
m kanso
Greenhorn
Joined: Oct 12, 2011
Posts: 2
|
|
Scott Manno wrote:If you're running multiple instances of MySQL, make sure the instance you're referencing is up and running.
what is instance ? I am not a database expert so please be more specified and clear,
thanks for the reply
|
 |
Scott Manno
Greenhorn
Joined: Nov 27, 2011
Posts: 2
|
|
m kanso wrote:
Scott Manno wrote:If you're running multiple instances of MySQL, make sure the instance you're referencing is up and running.
what is instance ? I am not a database expert so please be more specified and clear,
thanks for the reply
Two copies. For instance, if you have one (or more) standalone install of MySQL, and/or you're also using something like wampserver, which installs its own copy. Make sure you're looking at the port that corresponds to the install (and that the database is in that copy).
|
 |
 |
|
|
subject: com.mysql.jdbc.exceptions.jdbc4.communicationsexception communications link failure
|
|
|