File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Communications link failure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Communications link failure" Watch "Communications link failure" New topic
Author

Communications link failure

Prasad prap
Greenhorn

Joined: Sep 26, 2008
Posts: 28
Hi
I have been trying this code but to my failure i get this message
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.


ERROR:




My CODE extract:


WHAT COULD BE THE PROBLEM?
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3704
    
    5

PLEASE do not put JDBC code inside of a JSP. It's really really bad.


My Blog: Down Home Country Coding with Scott Selikoff
Prasad prap
Greenhorn

Joined: Sep 26, 2008
Posts: 28
My SQL status:
mysql> status
--------------
c:/wamp/bin/mysql/mysql5.1.36/bin/mysql.exe Ver 14.14 Distrib 5.1.36, for Win32
(ia32)

Connection id: 1
Current database:
Current user: root@localhost
SSL: Not in use
Using delimiter: ;
Server version: 5.1.36-community-log MySQL Community Server (GPL)
Protocol version: 10
Connection: localhost via TCP/IP
Server characterset: latin1
Db characterset: latin1
Client characterset: latin1
Conn. characterset: latin1
TCP port: 3306
Uptime: 1 min 37 sec

Threads: 1 Questions: 4 Slow queries: 0 Opens: 15 Flush tables: 1 Open tabl
es: 8 Queries per second avg: 0.41
--------------


Is it because my TCS port is 3306 and url parameter in DriverManager is http://127.0.0.1:8080? What could be the problem?

I am gettin error in addtion to above error:
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Prapia prap wrote:Is it because my TCS port is 3306 and url parameter in DriverManager is http://127.0.0.1:8080?


Well, yeah. If your database server is listening at port 3306, and you want to connect to the database server, then you'll want to connect to it on port 3306. Not port 8080.
Prasad prap
Greenhorn

Joined: Sep 26, 2008
Posts: 28
I am still getting this issue. I have googled this a lot and didnt find any solution.



my CLASSPATH


Mahesh Kedari
Ranch Hand

Joined: Nov 28, 2009
Posts: 111
Can you please post the connection string you are using... Probably it is incorrect...!!!


Regards,
Mahesh Kedari - Fidus Technologies Ltd.
Smitesh Shinde
Ranch Hand

Joined: Feb 16, 2008
Posts: 45

You are probably still using 8080 as database port.Your connection string should be

String connectionURL = "jdbc:mysql://127.0.0.1:3306/auction";


As your web server is already running on port 8080 and you are trying to connect to the database on same port it is giving you AccessControlException.Correcting connection string should solve your purpose.
Prasad prap
Greenhorn

Joined: Sep 26, 2008
Posts: 28
I checked with both 3306 and 8080 but not solved! MySql is at port 3306. What shud i do?

This is for keeping port 3306 in connection URL

Mahesh Kedari
Ranch Hand

Joined: Nov 28, 2009
Posts: 111


Are you passing a blank password??? probably that is the problem. Can you try with some password other than blank?
Prasad prap
Greenhorn

Joined: Sep 26, 2008
Posts: 28
there is no password for the database. I dont think that no password is an issue
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Communications link failure