How does Mini Program connect to the local database through a remote server? Use JDBC

problem description

report HTTP Status 500

related codes

/ / Please paste the code text below (do not replace the code with pictures)

org.apache.jasper.JasperException: An exception occurred processing JSP page /form.jsp at line 15

12: Connection conn = null;<br>13: Statement st = null;<br>14: <br>15: Class.forName("com.mysql.jdbc.Driver;);<br>16: conn = DriverManager.getConnection(jdbc:mysql://xxxxxxx/xx?user=xxx&password=xxxx);<br>17: st = conn.createStatement();<br>18:

Stacktrace:

org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:594)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:476)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

Root Cause

javax.servlet.ServletException: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:916)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:845)
org.apache.jsp.form_jsp._jspService(form_jsp.java:145)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:453)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

Root Cause

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1928)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1771)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:126)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:63)
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Class.java:264)
org.apache.jsp.form_jsp._jspService(form_jsp.java:98)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:453)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

what result do you expect? What is the error message actually seen?

how to solve this problem?

Nov.02,2021

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

this means that your code did not find the class. Check whether
Class.forName ("com.mysql.jdbc.Driver");
can be read normally

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3808c-4066b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3808c-4066b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?