Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

Sockets  RSS feed

 
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there.

I am trying to connect to a mysql server that does not have a port number, but does have a socket.

My understanding is that in the past JDBC did not support sockets. Does it now? How do I go about setting up a connection using the socket if I already have the code below?

Thanks.

 
author
Posts: 4105
23
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried the default port number? I'm sure there's a port number configured for the mysql server.
 
Sam Bluesman
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

No - there is no port number when i type 'status' at the MySQL prompt. I have tried the default 3306 and this did not work...

I get the error:

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
Last packet sent to the server was 0 ms ago.
 
Scott Selikoff
author
Posts: 4105
23
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you view the MySQL config file? my.ini in windows, my.cnf in mac/linux.
 
Scott Selikoff
author
Posts: 4105
23
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Sam Bluesman wrote:No - there is no port number when i type 'status' at the MySQL prompt. I have tried the default 3306 and this did not work...

I get the error:

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
Last packet sent to the server was 0 ms ago.



Ok first, the fact that you can't connect may indicate a firewall or configuration error. Second, *how* are you connecting to the server to send the status command?
 
Sam Bluesman
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't have priviliges to see that.
 
Scott Selikoff
author
Posts: 4105
23
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Sam Bluesman wrote:I don't have priviliges to see that.



It would definitively answer which port to use. The file usually contains a [client] port value in it.

Either way, how are you connecting to MySQL to send commands? My guess would be you are using the port you are looking for.
 
Sam Bluesman
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

OK so I have been using putty to connect to the server and then logged into mysql from there, using the defauly port:22 option.

That seems to have done something but given the code above I am not getting the following error:

com.mysql.jdbc.PacketTooBigException: Packet for query is too large

But this still does not put "Sucess" as it should in the code so not sure if it connecting. Any advice?

Thanks
 
Scott Selikoff
author
Posts: 4105
23
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) Contact the DBA and find out the port. You shouldn't be guessing.

2) Use the standard driver and driverName. The mm driver hasn't been updated in 8 years
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!