| Author |
JSP: Unable to connect to mysql in local drive [Solved]
|
Raghavan Chockalingam
Ranch Hand
Joined: Dec 20, 2005
Posts: 77
|
|
[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 ]
|
Raghavan
SCJP 6
|
 |
Paulo Aquino
Ranch Hand
Joined: Apr 29, 2002
Posts: 200
|
|
|
do you have the mysql.jar with you?
|
Be Afraid...Be very Afraid...
|
 |
Raghavan Chockalingam
Ranch Hand
Joined: Dec 20, 2005
Posts: 77
|
|
|
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
Joined: Dec 11, 2004
Posts: 13410
|
|
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.
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
Raghavan Chockalingam
Ranch Hand
Joined: Dec 20, 2005
Posts: 77
|
|
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
Joined: Dec 20, 2005
Posts: 77
|
|
|
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
Joined: Dec 11, 2004
Posts: 13410
|
|
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
Joined: Dec 20, 2005
Posts: 77
|
|
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
Joined: Dec 11, 2004
Posts: 13410
|
|
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
Joined: Jan 10, 2002
Posts: 56532
|
|
|
Moved to the JDBC forum.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Raghavan Chockalingam
Ranch Hand
Joined: Dec 20, 2005
Posts: 77
|
|
Sorry...i forgot to include the error message...here it is...
|
 |
Raghavan Chockalingam
Ranch Hand
Joined: Dec 20, 2005
Posts: 77
|
|
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...
|
 |
 |
|
|
subject: JSP: Unable to connect to mysql in local drive [Solved]
|
|
|