Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pool Manager with MySQL - JSP ... need help

 
Sophia Oscario
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I try to use Pool Manager 2.0 to handle database connection to MySQL from JSP.
But it returns an execption :
Exception Report:
javax.servlet.ServletException: javax/sql/ConnectionEventListener
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:442)
at org.apache.jsp.JDBCtest_jsp._jspService(JDBCtest_jsp.java:123)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:200)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:379)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:453)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:254)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:194)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:255)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:225)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2252)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:446)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:875)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:952)
at java.lang.Thread.run(Thread.java:484)

Here's My code :
<html>
<head>
<title>JDBC - MySQL</title>
</head>
<%@ page language="java" import="java.sql.*,com.codestudio.util.*" %>
<body>

<% SQLManager myManager = SQLManager.getInstance(); Connection myConn = myManager.requestConnection(); Statement st = myConn.createStatement(); ResultSet rs = st.executeQuery("select * from employee"); if (rs != null) { while (rs.next()) { String eid = rs.getString("empid"); String name = rs.getString("lastname") + ", " + rs.getString("firstname"); String extention = rs.getString("extention"); %> <% } } st.close(); myManager.returnConnection(myConn); %>
ID Name Extention
<%=eid %> <%=name %> <%=extention %>


</body>
</html>
Please anybody can tell me what's wrong ...
Thanks

------------------
** Science belongs to the world **
 
Robert Brunner
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sophia Oscario:
I try to use Pool Manager 2.0 to handle database connection to MySQL from JSP.
But it returns an execption :
Exception Report:
javax.servlet.ServletException: javax/sql/ConnectionEventListener
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:442)
at org.apache.jsp.JDBCtest_jsp._jspService(JDBCtest_jsp.java:123)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:200)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:379)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:453)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:254)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:194)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:255)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:225)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2252)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:446)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:875)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:952)
at java.lang.Thread.run(Thread.java:484)

Here's My code :
<html>
<head>
<title>JDBC - MySQL</title>
</head>
<%@ page language="java" import="java.sql.*,com.codestudio.util.*" %>
<body>

<% SQLManager myManager = SQLManager.getInstance(); Connection myConn = myManager.requestConnection(); Statement st = myConn.createStatement(); ResultSet rs = st.executeQuery("select * from employee"); if (rs != null) { while (rs.next()) { String eid = rs.getString("empid"); String name = rs.getString("lastname") + ", " + rs.getString("firstname"); String extention = rs.getString("extention"); %> <% } } st.close(); myManager.returnConnection(myConn); %>
ID Name Extention
<%=eid %> <%=name %> <%=extention %>


</body>
</html>
Please anybody can tell me what's wrong ...
Thanks



I can't see you code. Try to resubmit just your code.
 
Sophia Oscario
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry,
here is my code :
'<html>
'<head>
'<title>JDBC - MySQL</title>
'</head>
'<%@ page language="java" 'import="java.sql.*,com.codestudio.util.*" %><br /> '<body>
'
' ' ' ' ' ' '<% SQLManager myManager = SQLManager.getInstance(); Connection myConn = myManager.requestConnection(); Statement st = myConn.createStatement(); ResultSet rs = st.executeQuery("select * from employee"); if (rs != null) { while (rs.next()) { String eid = rs.getString("empid"); String name = rs.getString("lastname") + ", " + rs.getString("firstname"); String extention = rs.getString("extention"); %> ' ' ' ' ' <% } } st.close(); myManager.returnConnection(myConn); %> '
IDNameExtention
<%=eid %> <%=name %><%=extention %>

'

'</body>
'</html>

------------------
** Science belongs to the world **
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lets try this:

Hope this is clearer
Dave.
 
Jayanthimeena
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The coding has to look similar to this
String manager = SQLManager.getInstance();
String conn = manager.requestConnection();
String stmt = conn.createStatement();
Resultset rs=null;
rs=stmt.excuteQuery("select * from employee");
if(rs.next())
string one=rs.getString(1);
.
.
.
similarly all
rs.close();
if you are using pool class then it has to be present in correct class path and in currently using "command" or "cmd" promt.
hope this might help you.

 
Sophia Oscario
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is my code :

Is there something wrong in it ?

------------------
** Science belongs to the world **
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic