Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can get mysql DB connection from class, but can't get from servlet.

 
Boris Lyadov
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All.
In my simplest training application I have to create Class DbConnector.class which is returning mysql DB connection. I'm calling this class from LoginManager.class where I'm checking username and password. Runnig in Eclipse console and it's working properly. After that I made export my project into connector.jar file.
Now I create a new tomcat project and add this connector.jar into the buildpath. In class LoginServlet I made import of connector and calling LoginManager.class. So when I'm calling LoginServlet from login.jsp file I'm getting error
"com.mysql.jdbc.CommunicationsException: Communications link failure"
Driver loaded, but cannot connect to db: jdbc:mysql://localhost:3306/bill_base?useUnicode=yes&characterEncoding=utf-8

Below please find source of DbConnector, LoginManager,LoginServlet and login.jsp
Please help.
_______________________________________________________________________________________________________________
 
Nishan Patel
Ranch Hand
Posts: 689
Eclipse IDE Java Scala
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Boris,

welcome to Java Ranch !!

UseCodeTags. Code is difficult to read. You can edit your post to include them using the button or re-post the question with proper formatting.

 
Boris Lyadov
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you. Excuse me, didn't pay my attention to the tags from the begining.
 
Boris Lyadov
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok. I've deployed this application directly on Tomcat, instead running it from Eclipse tomcat plugin. Now it's working.
Any idea?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64182
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As this is now an Eclipse question, it has been moved to the IDEs forum.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic