connect JSP and Mysql
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Wednesday, July 10, 2002 01:51 AM

Hi, I get confuse when I try to connect JSP and Mysql. I use statement: <%@page import="java.sql.*"%> <% //Khai bao ket noi: Connection conn; Statement stm; ResultSet rs_matau; String sql_matau=""; //Create connection: // Class.forName("org.gjt.mm.mysql.Driver"); Class.forName("com.caucho.jdbc.mysql.Driver"); conn = DriverManager.getConnection ("jdbc:mysql_caucho://localhost/ticket","root@localhost",""); stm = conn.createStatement();    More>>

Hi,


I get confuse when I try to connect JSP and Mysql.



I use statement:



<%@page import="java.sql.*"%>



<%



//Khai bao ket noi:


Connection conn;


Statement stm;


ResultSet rs_matau;


String sql_matau="";



//Create connection:


// Class.forName("org.gjt.mm.mysql.Driver");


Class.forName("com.caucho.jdbc.mysql.Driver");


conn = DriverManager.getConnection

("jdbc:mysql_caucho://localhost/ticket","root@localhost","");


stm = conn.createStatement();


%>



After I browse, Netscape display error message:



org.apache.jasper.JasperException:

om.caucho.jdbc.mysql.Driver


at org.apache.jasper.servlet.JspServletWrapper.service(Unknown Source)


at org.apache.jasper.servlet.JspServlet.serviceJspFile(Unknown Source)


at org.apache.jasper.servlet.JspServlet.service(Unknown Source)


at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)


at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Unknown Source)


at org.apache.catalina.core.ApplicationFilterChain.doFilter(Unknown Source)


at org.apache.catalina.core.StandardWrapperValve.invoke(Unknown Source)


at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown Source)


at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)


at org.apache.catalina.core.ContainerBase.invoke(Unknown Source)


at org.apache.catalina.core.StandardContextValve.invoke(Unknown Source)


at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown Source)


at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)


at org.apache.catalina.core.ContainerBase.invoke(Unknown Source)


at org.apache.catalina.core.StandardContext.invoke(Unknown Source)


at org.apache.catalina.core.StandardHostValve.invoke(Unknown Source)


at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown Source)


at org.apache.catalina.valves.ErrorDispatcherValve.invoke(Unknown Source)


at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown Source)


at org.apache.catalina.valves.ErrorReportValve.invoke(Unknown Source)


at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown Source)


at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)


at org.apache.catalina.core.ContainerBase.invoke(Unknown Source)


at org.apache.catalina.core.StandardEngineValve.invoke(Unknown Source)


at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown Source)


at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)


at org.apache.catalina.core.ContainerBase.invoke(Unknown Source)


at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)


at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:376)


at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)


at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:518)

at java.lang.Thread.run(Thread.java:536)



root cause


javax.servlet.ServletException: com.caucho.jdbc.mysql.Driver


at org.apache.jasper.runtime.PageContextImpl.handlePageException(Unknown Source)


at org.apache.jsp.dangkyMoi$jsp._jspService(dangkyMoi$jsp.java:227)


at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source)


at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)


at org.apache.jasper.servlet.JspServletWrapper.service(Unknown Source)


at org.apache.jasper.servlet.JspServlet.serviceJspFile(Unknown Source)


at org.apache.jasper.servlet.JspServlet.service(Unknown Source)


at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)


at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Unknown Source)


at org.apache.catalina.core.ApplicationFilterChain.doFilter(Unknown Source)


at org.apache.catalina.core.StandardWrapperValve.invoke(Unknown Source)


at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown Source)


at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)


at org.apache.catalina.core.ContainerBase.invoke(Unknown Source)


at org.apache.catalina.core.StandardContextValve.invoke(Unknown Source)


at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown Source)


at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)


at org.apache.catalina.core.ContainerBase.invoke(Unknown Source)


at org.apache.catalina.core.StandardContext.invoke(Unknown Source)


at org.apache.catalina.core.StandardHostValve.invoke(Unknown Source)


at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown Source)


at org.apache.catalina.valves.ErrorDispatcherValve.invoke(Unknown Source)


at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown Source)


at org.apache.catalina.valves.ErrorReportValve.invoke(Unknown Source)


at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown Source)


at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)


at org.apache.catalina.core.ContainerBase.invoke(Unknown Source)


at org.apache.catalina.core.StandardEngineValve.invoke(Unknown Source)


at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown Source)


at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)

at org.apache.catalina.core.ContainerBase.invoke(Unknown Source)


at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)


at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:376)


at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)


at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:518)

at java.lang.Thread.run(Thread.java:536)



Help me!

   <<Less

Re: connect JSP and Mysql

Posted By:   Mandar_Pohnerkar  
Posted On:   Monday, July 22, 2002 05:42 AM

hey friend,

i just got connectivity of jsp with mysql after R&d of 2 hrs and i m writting to u.
If u need my assistance plz feel free to ask me.Well the error u r getting is ,its not locating the driver class file.

Get back to me incase u need any help

mandar

Re: connect JSP and Mysql

Posted By:   Mandar_Pohnerkar  
Posted On:   Monday, July 22, 2002 12:25 AM



Hi Hai,

Even i m getting error when i m trying to connect to mysql via jsp.

<%@ page import="java.sql.*"%>
<%

Connection con;
Statement st;
ResultSet rs;
out.println("before try");
try{
Class.forName("org.gjt.mm.mysql.Driver");
out.println("in try");
con=DriverManager.getConnection
("jdbc:mysql://localhost/abc?user=root=ancd");
rs=con.createStateent();
}
catch(Exception e){}

Now when i call this jsp page, it prints "before try" on the webpage but does not print "in try" ????????
Also there is no error

I m not understanding why its not showing "in try"


Need Help

mandar

About | Sitemap | Contact