Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JDBC Code error  RSS feed

 
mert ozkaya
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am very new to JDBC programming.
I am using Mac OS X and trying get the following code run. I have already installed mysql into my machine. However, when I compiled and run the code, I got the error that I have given below the code. Can you please help me on finding out the reason for this error?

Code is :



 
Tapas Chand
Ranch Hand
Posts: 614
9
BSD Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure the database is started?
Looks like database port is not listening.
What is output of
 
Tim Cooke
Marshal
Posts: 3955
234
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also please BeForthrightWhenCrossPostingToOtherSites. We don't mind if you cross post to other sites, but we do ask that you tell us you've done so.

http://www.javaprogrammingforums.com/jdbc-databases/45128-jdbc-code-error.html
 
mert ozkaya
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Sorry for the cross posting - will delete the other.

I think that I have resolved the problem. The default port is 3307- not 3306. When I have made the regarding change, it seems that I got the code working.

Thanks.
 
Tapas Chand
Ranch Hand
Posts: 614
9
BSD Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good job.
But what about the blank string in password?
I thought we need to pass null instead of blank string for an user having no password.
 
K. Tsang
Bartender
Posts: 3648
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mert ozkaya wrote:

I think that I have resolved the problem. The default port is 3307- not 3306. When I have made the regarding change, it seems that I got the code working.

Thanks.


MySQL default port is 3306. Unless you have changed it to 3307, the port should have been 3306.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!