Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mysql jdbc connection takes lot of time

 
loganathan kalyan
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If i try to create a jdbc connection for the My sql using a port which is already used by another application (oracle), it takes lot of time to get the error message.

Can anyone help to solve this issue?
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's may be because of the MySQL Servers instance "connection_timeout"(I don't remember that attribute, it may be "timeout", Consult MySQL site) has set to some big value.

But that's shouldn't be the issue, the point is why are you connecting to a port which is already captured by some other application(oracle) ??
 
loganathan kalyan
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sagar Rohankar wrote:That's may be because of the MySQL Servers instance "connection_timeout"(I don't remember that attribute, it may be "timeout", Consult MySQL site) has set to some big value.

But that's shouldn't be the issue, the point is why are you connecting to a port which is already captured by some other application(oracle) ??


i dont know whether the port is used by anyother application. In my project i have to provide a faciltiy to user to create connection in the port he whises. User dosent need to know whether the port is alreay used but i must show him a message if he tries to create a connection using such ports
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
loganathan kalyan wrote:i dont know whether the port is used by anyother application.

Use netstat -a command for windows machine to get port occupied by which app/process, for another OS, Google.
loganathan kalyan wrote:In my project i have to provide a faciltiy to user to create connection in the port he whises. User dosent need to know whether the port is alreay used but i must show him a message if he tries to create a connection using such ports

Either you need to run 65,536 DB Server instances for 65,536 ports OR User has to guess from 65,536 ports at which port DB Server instance is running

Whats exactly you want to do ? The way you're doing is NOT at all feasible.
 
Jan Cumps
Bartender
Posts: 2596
12
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my project i have to provide a faciltiy to user to create connection in the port he whises. User dosent need to know whether the port is alreay used but i must show him a message if he tries to create a connection using such ports
This will make your application unpopular for server / security administrators. They will think that you have built an application that is scamming their server.

Why do you need to implement this logic? What is the underlying problem that you want top solve by letting the user guess the port where a database is listening?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic