Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

MESSAGE: java.net.ConnectException: Connection timed out

843859Dec 7 2005 — edited Nov 9 2006
hi there!
please tell me what's wrong or i'm doing wrong. i would like to know what's causing the java/DB connection's time out. it's drive me crazy and i'm out of ideas. MySQl and JAVA are both new for me.
i'm using mysql-standard-5.0.15-linux-i686-glibc23 and j2sdk1.4.2_10 on kubuntu 5.4
thanks


-after i execute this command:
____________________________________
root@kapverd:~/demo/commissioner# java -classpath "./revs_server.jar:./ext/mysql-connector-java-3.1.11-bin.jar:" -Djava.security.policy=conf/policy.txt inescID.revs.commissioner.Commissioner


-i'm asked to enter a username and and his password for the databases. after this i get this follow error and then i the options to create, redo, fill and delete the tables. obviously none of them woks.
the error message is like this:


com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.net.SocketException
MESSAGE: java.net.ConnectException: Connection timed out

STACKTRACE:

java.net.SocketException: java.net.ConnectException: Connection timed out
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:284)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2541)
at com.mysql.jdbc.Connection.<init>(Connection.java:1474)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at inescID.revs.database.CommonDatabase.connectDB(CommonDatabase.java:49)
at inescID.revs.database.CommonDatabase.DBInit(CommonDatabase.java:41)
at inescID.revs.database.DB_Commissioner.<init>(DB_Commissioner.java:86)
at inescID.revs.commissioner.Commissioner.start(Commissioner.java:73)
at inescID.revs.commissioner.Commissioner.start(Commissioner.java:63)
at inescID.revs.commissioner.Commissioner.<init>(Commissioner.java:36)
at inescID.revs.commissioner.Commissioner.main(Commissioner.java:88)


** END NESTED EXCEPTION **



Last packet sent to the server was 50 ms ago.
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2607)
at com.mysql.jdbc.Connection.<init>(Connection.java:1474)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at inescID.revs.database.CommonDatabase.connectDB(CommonDatabase.java:49)
at inescID.revs.database.CommonDatabase.DBInit(CommonDatabase.java:41)
at inescID.revs.database.DB_Commissioner.<init>(DB_Commissioner.java:86)
at inescID.revs.commissioner.Commissioner.start(Commissioner.java:73)
at inescID.revs.commissioner.Commissioner.start(Commissioner.java:63)
at inescID.revs.commissioner.Commissioner.<init>(Commissioner.java:36)
at inescID.revs.commissioner.Commissioner.main(Commissioner.java:88)

Comments

What are you trying to run?
What platform are you on?
Where is your JDeveloper installed?
488269
OK, sorry, should have been more specific.

I'm running on Windows XP Professional SP1.
My JDeveloper is installed in C:\Program Files\JDev
I started getting this error when running projects that worked in JDev 9.0.5
I then created a new Web Project with one simple JSP (no taglibs and no code, just some text in the body) and still get the error on that.

The entire text of the error I get is:

[Starting OC4J using the following ports: HTTP=8988, RMI=23791, JMS=9227.]

**** Unable to obtain password from principals.xml. Using default.

C:\Program Files\JDev\jdev\system\oracle.j2ee.10.1.3.36.73\embedded-oc4j\config>

"C:\Program Files\JDev\jdk\bin\javaw.exe" -ojvm "-Doracle.home=C:\Program Files\JDev" -classpath "C:\Program Files\JDev\j2ee\home\oc4j.jar;C:\Program Files\JDev\jdev\lib\jdev-oc4j-embedded.jar" -Xverify:none -DcheckForUpdates=adminClientOnly -Doracle.application.environment=development -Doracle.j2ee.dont.use.memory.archive=true -Doracle.j2ee.http.socket.timeout=500 -Doc4j.jms.usePersistenceLockFiles=false oracle.oc4j.loader.boot.BootStrap -config "C:\Program Files\JDev\jdev\system\oracle.j2ee.10.1.3.36.73\embedded-oc4j\config\server.xml"

[waiting for the server to complete its initialization...]

06/02/05 11:30:47 java.net.ConnectException: Connection timed out: connect

06/02/05 11:30:47 at java.net.PlainSocketImpl.socketConnect(Native Method)

06/02/05 11:30:47 at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)

06/02/05 11:30:47 at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)

06/02/05 11:30:47 at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)

06/02/05 11:30:47 at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:364)

06/02/05 11:30:47 at java.net.Socket.connect(Socket.java:507)

06/02/05 11:30:47 at java.net.Socket.connect(Socket.java:457)

06/02/05 11:30:47 at java.net.Socket.<init>(Socket.java:365)

06/02/05 11:30:47 at java.net.Socket.<init>(Socket.java:207)

06/02/05 11:30:47 at oracle.jdevimpl.runner.oc4j.Oc4jNotifier.sendMessage(Oc4jNotifier.java:98)

06/02/05 11:30:47 at oracle.jdevimpl.runner.oc4j.Oc4jNotifier.postInitApplicationServer(Oc4jNotifier.java:55)

06/02/05 11:30:47 at com.evermind.server.ApplicationServer.serverExtensionPostInit(ApplicationServer.java:1091)

06/02/05 11:30:47 at com.evermind.server.ApplicationServer.setConfig(ApplicationServer.java:951)

06/02/05 11:30:47 at com.evermind.server.ApplicationServerLauncher.run(ApplicationServerLauncher.java:113)

06/02/05 11:30:47 at java.lang.Thread.run(Thread.java:595)

06/02/05 11:30:47 Oracle Containers for J2EE 10g (10.1.3.0.0) initialized

Any help is appreciated.
Reinstall JDeveloper in a directory that doesn't have a space in it's path. (e.g not in program files, but rather in c:\jdev1013). Then create a new project and let us know if the problem is still there.
488269
Yes, that was the problem. I moved it to c:\Jdev and worked fine.

Thanks a ton! I was about ready to give up on it.
448717
Hello Every One,
I'm facing the same problem using older version of Jdeveloper (Jdev10.1.2)
I tried ur solution but it didn't work
My OS is Windows Server 2003
My Jdeveloper Home is D:\jdev1012

and the exception I get is here:

[waiting for the server to complete its initialization...]

06/02/22 13:34:09 Auto-deploying file:/D:/jdev1012/jdev/mywork/Application3/ViewController/public_html/ (New server version detected)...

06/02/22 13:34:31 java.net.ConnectException: Connection timed out: connect

06/02/22 13:34:31 at java.net.PlainSocketImpl.socketConnect(Native Method)

06/02/22 13:34:31 at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)

06/02/22 13:34:31 at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)

06/02/22 13:34:31 at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)

06/02/22 13:34:31 at java.net.Socket.connect(Socket.java:452)

06/02/22 13:34:31 at java.net.Socket.connect(Socket.java:402)

06/02/22 13:34:31 at java.net.Socket.<init>(Socket.java:309)

06/02/22 13:34:31 at java.net.Socket.<init>(Socket.java:153)

06/02/22 13:34:31 at oracle.jdevimpl.runner.oc4j.Oc4jNotifier.sendMessage(Oc4jNotifier.java:98)

06/02/22 13:34:31 at oracle.jdevimpl.runner.oc4j.Oc4jNotifier.postInitApplicationServer(Oc4jNotifier.java:55)

06/02/22 13:34:31 at com.evermind.server.ApplicationServer.setConfig(ApplicationServer.java:1629)

06/02/22 13:34:31 at com.evermind.server.ApplicationServerLauncher.run(ApplicationServerLauncher.java:92)

06/02/22 13:34:31 at java.lang.Thread.run(Thread.java:534)

06/02/22 13:34:31 Oracle Application Server Containers for J2EE 10g (10.1.2.0.0) initialized
488269
I found that I got this error when I didn't have enough available memory to run the application. By removing a bunch of my startup options and closing all other programs (including internet connection) I was able to use JDev with 512K memory. Since then I've upgraded with more memory and no problems.
4172
Hello,
I getting the some error in my JDev 10.1.3 with Service Update 2. I already check all suggestions from previous forum threads, but without any luck. It's very strange, because i only have problems when work from home (connection to internet via wireless router). At the company (Ethernet connection to internet), it works OK. Please help.

My computer: IBM ThinkPad R52 ; Window XP SP2 (Firewall is ON) ; JDev 10.1.3 + SU2

Regards,
Matic

06/04/17 09:40:32 java.net.ConnectException: Connection timed out: connect
06/04/17 09:40:32 at java.net.PlainSocketImpl.socketConnect(Native Method)
06/04/17 09:40:32 at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
06/04/17 09:40:32 at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
06/04/17 09:40:32 at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
06/04/17 09:40:32 at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:364)
06/04/17 09:40:32 at java.net.Socket.connect(Socket.java:507)
06/04/17 09:40:32 at java.net.Socket.connect(Socket.java:457)
06/04/17 09:40:32 at java.net.Socket.<init>(Socket.java:365)
06/04/17 09:40:32 at java.net.Socket.<init>(Socket.java:207)
06/04/17 09:40:32 at oracle.jdevimpl.runner.oc4j.Oc4jNotifier.sendMessage(Oc4jNotifier.java:98)
06/04/17 09:40:32 at oracle.jdevimpl.runner.oc4j.Oc4jNotifier.postInitApplicationServer(Oc4jNotifier.java:55)
06/04/17 09:40:32 at com.evermind.server.ApplicationServer.serverExtensionPostInit(ApplicationServer.java:1091)
06/04/17 09:40:32 at com.evermind.server.ApplicationServer.setConfig(ApplicationServer.java:951)
06/04/17 09:40:32 at com.evermind.server.ApplicationServerLauncher.run(ApplicationServerLauncher.java:113)
06/04/17 09:40:32 at java.lang.Thread.run(Thread.java:595)
antonio.gagliardi
Hello, i've got the same problem of connection time out.

This is my solution/workaround: disable the second network card!

I don't know why but, in a pc with 2 network card (generally a wifi card and an ethernet) embedded OC4J running inside JD choose the wrong host ip ( you can see the mistake Tool->Embedded OC4J Server Preferences->StartUp LocalHostFullName ) even if you set it manually .

If you run the server form command with ....\jdevstudiobase\jdev\bin\start_oc4j.bat all works fine but not inside JD.

So the workaround is to leave only one network card.

Regards
Antonio.
1 - 8
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Dec 7 2006
Added on Dec 7 2005
5 comments
7,392 views