Hi,
Everything is set up and running on Redhat7.1. Version 1.3.1 of jdk is
installed and tomcat version 3.2.1.
I also installed the mod_jserv module and started serving jsp pages
which worked perfectly.
I then downloaded the mysql jdbc drivers from the mysql site and
installed them and set the classpath to
correct path in /etc/profile. I get the following error when connecting
to the mysql database:
Root cause:
java.sql.SQLException: Server configuration denies access to data source
at org.gjt.mm.mysql.MysqlIO.init(MysqlIO.java:144)
at org.gjt.mm.mysql.Connection.(Connection.java:230)
at org.gjt.mm.mysql.Driver.connect(Driver.java:126)
at java.sql.DriverManager.getConnection(DriverManager.java:517)
at java.sql.DriverManager.getConnection(DriverManager.java:199)
at
jsp.num._0002fjsp_0002fnum_0002fnumguess_0002ejspnumguess_jsp_59._jspService(_0002fjsp_0002fnum_0002fnumguess_0002ejspnumguess_jsp_59.java:86)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java)
at org.apache.tomcat.core.Handler.service(Handler.java)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java)
at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java)
at java.lang.Thread.run(Thread.java:484)
***********************************************************************************
Heres the code that i used.
<html><body>
<%@ page import="java.io.*"%>
<%@ page import="java.util.*"%>
<%@ page import="java.sql.*"%>
<%@ page import="javax.servlet.*"%>
<%@ page import="javax.servlet.http.*"%>
<%
//try {
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
Connection Conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/mysql?user=root&password=");
Statement Stmt = Conn.createStatement();
String SQL="SELECT * from user";
ResultSet RS = Stmt.executeQuery(SQL);
while (RS.next()) {
System.out.println(RS.getString(1));
}
// Clean up after ourselves
RS.close();
Stmt.close();
Conn.close();
//}
//catch (SQLException E) {
// System.out.println("SQLException: " + E.getMessage());
// System.out.println("SQLState: " + E.getSQLState());
// System.out.println("VendorError: " + E.getErrorCode());
//}
%></body></html>
*******************************************************************************
Now if I uncomment the commented code I get no error but I also get no
results which is wrong.
I'm thinking there is a priviledge problem. The mysql database is set up
to alloow any user to connect.
Any help would be greatly appreciated.
Winston
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!