• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP: Unable to connect to mysql in local drive [Solved]

 
Raghavan Chockalingam
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[You can straight away move to the last post to see the error message]
I am trying to connect to the local mysql database from the Jsp file. The username is root and I have the valid password with me. The file is shown below..any help is appreciated.


The error the system reports is...by the way I am running jdk1.5..don't know that info helps...


[ January 02, 2006: Message edited by: Raghavan Chockalingam ]

[ January 02, 2006: Message edited by: Raghavan Chockalingam ]

[ January 02, 2006: Message edited by: Raghavan Chockalingam ]
[ January 02, 2006: Message edited by: Raghavan Chockalingam ]
 
Paulo Aquino
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
do you have the mysql.jar with you?
 
Raghavan Chockalingam
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To be frank, I do not know what you are talking of...can you take a little time and explain me in detail what you want me to look for....thanks
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In order to connect to a database using JDBC, you need to have a JDBC driver for the specific RDBMS you are using. In this case the driver would be mysql.jar.

You can download this from mysql.org (not sure of the exact link).
Once you get it, put it in your application's WEB-INF/lib directory.

Later if you decide to move up to container managed connection pooling, you'll have to move it but put it there for now.
 
Raghavan Chockalingam
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It was really a good explanation....when I looked out mysql.jar file I came across this link...
http://dev.mysql.com/downloads/connector/odbc/3.51.html
can you tell me will this be any useful...do I have to just run the .exe version of Windows???
 
Raghavan Chockalingam
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I installed the .exe file, it installed itself somewhere in C: I guess but it was not useful....it actually calls itself as mysql-connector-odbc-3.5.1....
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ODBC is for connecting from Microsoft technologies.
You can get the JDBC driver here:
http://www.mysql.com/products/connector/j/
 
Raghavan Chockalingam
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I have got rid of that driver problem by putting the jar file in web-inf/lib but now it gives a different error saying that I do not have access. I can directly run the mysql command line client so I am sure of the right password....can you guess what the problem is...thanks for continuing support...

I thought this info would be useful

[ January 01, 2006: Message edited by: Raghavan Chockalingam ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like you've got all your files in the right place on the server so this is not really a JSP issue anymore.

I'll see if I can get this thread moved to JDBC where the database savvy hang out.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65120
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to the JDBC forum.
 
Raghavan Chockalingam
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry...i forgot to include the error message...here it is...
 
Raghavan Chockalingam
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have finally found the problem. The driver has to be changed and the URL was wrong so I altered the program as below...


Thanks for all your help...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic