473,385 Members | 1,470 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

jsp tomcat http 500 error

oll3i
679 512MB
i get http error 500 when trying to connect to mysql database
i use tomcat 5.5 ,connector mysql-connector-java-5.1.6-bin.jar and i get the following error
java.sql.SQLException: Access denied for user ''@'localhost' (using password: NO)

Thank You
May 16 '08 #1
3 4515
JosAH
11,448 Expert 8TB
I don't think that "@'localhost'" is a valid user name; check your connection URL.

kind regards,

Jos
May 16 '08 #2
oll3i
679 512MB
yes i added to DriverManager.getConnection username and password
connection = DriverManager.getConnection(connectionURL, "user_baza2004", "password");
and i get
SEVERE: Servlet.service() for servlet jsp threw exception
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorEx ception: Access denied for user 'user_baza2008'@'%' to database 'baza2008'


and my dbtest.jsp(just to test the connection to db) file displays



type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Exception in JSP: /dbtest.jsp:27

24: <body>
25: <%
26: Class.forName("com.mysql.jdbc.Driver").newInstance ();
27: connection = DriverManager.getConnection(connectionURL, "user_baza2004", "m1ssy0u");
28: statement = connection.createStatement();
29: rs = statement.executeQuery("SELECT * FROM candidates");
30: System.out.println("DB Connected");


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handle JspException(JspServletWrapper.java:451)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:355)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet .java:803)


root cause

javax.servlet.ServletException: Access denied for user 'user_baza2004'@'localhost' (using password: YES)
org.apache.jasper.runtime.PageContextImpl.doHandle PageException(PageContextImpl.java:841)
org.apache.jasper.runtime.PageContextImpl.handlePa geException(PageContextImpl.java:774)
org.apache.jsp.dbtest_jsp._jspService(dbtest_jsp.j ava:91)
org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet .java:803)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet .java:803)


root cause

java.sql.SQLException: Access denied for user 'user_baza2004'@'localhost' (using password: YES)
com.mysql.jdbc.SQLError.createSQLException(SQLErro r.java:1056)
com.mysql.jdbc.SQLError.createSQLException(SQLErro r.java:957)
com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.ja va:2938)
com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.ja va:855)
com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java: 3337)
com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:12 17)
com.mysql.jdbc.Connection.createNewIO(Connection.j ava:1930)
com.mysql.jdbc.Connection.<init>(Connection.java:7 16)
com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connect ion.java:46)
sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInsta nce(NativeConstructorAccessorImpl.java:39)
sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(DelegatingConstructorAccessorImpl.java:27)
java.lang.reflect.Constructor.newInstance(Construc tor.java:513)
com.mysql.jdbc.Util.handleNewInstance(Util.java:35 3)
com.mysql.jdbc.Connection.getInstance(Connection.j ava:295)
com.mysql.jdbc.NonRegisteringDriver.connect(NonReg isteringDriver.java:266)
java.sql.DriverManager.getConnection(DriverManager .java:582)
java.sql.DriverManager.getConnection(DriverManager .java:185)
org.apache.jsp.dbtest_jsp._jspService(dbtest_jsp.j ava:70)
org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet .java:803)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet .java:803)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.26 logs.


--------------------------------------------------------------------------------


but when i change user to root it displays nothing

Thank You
May 16 '08 #3
oll3i
679 512MB
hm i realized that i didnt grant prvileges to that user and that's why i got access denied
now what's left is displaying the data from the tables still cannt get it work

Expand|Select|Wrap|Line Numbers
  1. <%
  2. Class.forName("com.mysql.jdbc.Driver").newInstance();
  3. connection = DriverManager.getConnection(connectionURL, "user_baza2008", "password");
  4. statement = connection.createStatement();
  5. rs = statement.executeQuery("SELECT * FROM candidates");
  6. System.out.println("DB Connected");
  7. while (rs.next()) {
  8. System.out.println(rs.getString("name")+"<br>");
  9. }
  10.  
  11.  
  12.  
  13. rs.close();
  14. %>
  15.  
displaying doesnt work or maybe even the retrieving
Thank You
May 16 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Jagdeesh | last post by:
Hai Colleagues, I am using Tomcat 4.1.24 and JDK 1.4.0_03 in my winXP machine. I've transferred a set of folders(containing jsp files) into tomcat's webapps directory(to /webapps/bob ,...
6
by: DaiIchi | last post by:
I'm using Tomcat in standalone mode. When a URL without a filename is entered into the browser (ie. "http://myhost.mydomain.com"), and the default path does NOT have an index.html, but rather an...
2
by: devu | last post by:
Hello, I'm getting the following error when trying to start Apache Tomcat.The version shows up in the snapshot. I can't figure out why this is happening. It is aparently the <context-param> tag....
5
by: Tom Martin | last post by:
I'm a Java Web developer NEWBIE that has inherited a website that fails every 2 hours due to poor connection pooling between Tomcat 4.0.6 and mySQL. In efforts to resolve this problem, I've...
2
by: Jangley | last post by:
Hi Tomcat seems to be completely ignoring any resource that I specify in an <error-page> directive in the web.xml. The same webapp works under 4.0. Is there a bug in 4.1 that I'm not aware of?...
1
by: Liza | last post by:
Hi, I run Tomcat5.0.24 on Fedora Core 1. I have a jsp site that works without a problem on a Red Hat 9 box with Tomcat 4, but when I ran it on Fedora and Tomcat 5.0.24 I get the following error:...
1
by: ptaz | last post by:
Hi I'm trying to run a web page but I get the following error. Ca anyone please tell me a solution to this. Thanks Ptaz HTTP Status 500 - type Exception report
1
by: kommaraju | last post by:
iam a starter to db2 & jdbc.i have a servlet program which connects to ibm db2 using jdbc.when i run this using apache tomcat 4.1.34 , it is showing a error message of HTTP STATUS 500 my jdbc...
0
by: Arun21084 | last post by:
Hi, Recently I installed an application HP SIP(Service Information Portal) on a Windows 2000 server.The application comes along with an installation of Tomcat 5.0.19. Already there was an Apache...
10
by: swethak | last post by:
Hi, i am first installing the tomcat 5.5 in my hosting server system and created the one folder(like test) in webapps and place all the jsp files.And also created the another folder(like test2)...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.