Hi, I am attempting to connect to a MySQL database I just created and I believe I am missing some java piece. I have installed the NetBeans IDE 4.1 and MySQL 5.0. I have created users for the database, created tables, and can access the tables from query tools. Now I am hoping to query the database from a jsp page.
However, when I try to run this jsp page it yields the following error:
When you run a jsp in a servlet container the servlet container compiles the jsp into a servlet and runs it. That is why you should put it where the servlet container can find it so that it can compile your code.
If you are using Tomcat you can place it in <JAKARTA_HOME>/common/lib so that it is available for all applications you will write using mysql or in the lib folder of the respective webapp. If you are not using Tomcat the solution is pretty much the same find the manual and you will figure it out.
Good luck! George
Joined: Sep 19, 2006
Thanks for the idea. I am not sure where the startup script is, I assume it is accessible from the IDE. So I have now tried the following:
going to the web project, right click for properties. Choose libraries Choose the tab that says "compile tests"
Then, I click "add jar/folder" and browse to the jar file
Then choose the tab that says "run tests"
Then I click "add jar/folder" and browse to the jar file
Now I would assume this would be added to my class path for startup
After much experimentation, it turned out I was putting the jar file into WEB-INF/Lib/Jar
and it needed to go into WEB-INF/Lib
So now I can query my database! It is time to start constructing accounts, and putting together some actual content, servlets, and so forth.
Thank you all for your assistance in this. It is very frustrating to come against a large toolkit which has many layers of possibilities of functioning. Your answers provided me with the needed context with which to effectively search on google.