title: Unable to connect to mysql database using jsp page but below error java.sql.SQLException: No suitable driver found jdbc:mysql://localhost:3306/dbname
body: <p><strong>Here is my code:</strong>   </p>
  
  <pre><code> &lt;%@page import="java.io.FileInputStream"%&gt;
      &lt;%@page import="java.io.File"%&gt;
      &lt;%@page import="java.io.InputStreamReader"%&gt;
      &lt;%@page import="java.net.URL"%&gt;
      &lt;%@page import="java.io.FileReader"%&gt;
      &lt;%@page import="java.io.BufferedReader"%&gt;
      &lt;%@page import="java.io.IOException"%&gt;
      &lt;%@page import="java.text.DateFormat"%&gt;
      &lt;%@page import="java.text.SimpleDateFormat"%&gt;
      &lt;%@page import="java.util.Arrays"%&gt;
      &lt;%@page import="java.util.Calendar"%&gt;
      &lt;%@page import="java.util.ArrayList"%&gt;
      &lt;%@page import="java.util.List"%&gt;
      &lt;%@ page import="java.sql.*" %&gt;
      &lt;%@ page import ="javax.sql.*" %&gt;
  
      &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
      &lt;html&gt;
      &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
      &lt;link rel="stylesheet" href="styles.css"&gt;
      &lt;link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"&gt;
      &lt;script src="https://code.jquery.com/jquery-1.12.4.js"&gt;&lt;/script&gt;
      &lt;script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"&gt;&lt;/script&gt;
  
  
      &lt;/head&gt;
      &lt;body&gt;
          &lt;%
              try{    
                  //Database Code
                  java.sql.Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/prodnotification?autoReconnect=true&amp;useSSL=false", "root","Rahulhi123"); 
                          Statement st= con.createStatement();
                  if (null == con) {
                      System.out.println("Database Connection Error.");
                  } else {
                      System.out.println("Database Connected.");//Database connection
                  }
                  }catch(SQLException e)
                  {
                      e.printStackTrace();
                  }
              %&gt;
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>This is my code getting below error:</p>
  
  <pre class="lang-none prettyprint-override"><code>java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/prodnotification?autoReconnect=true&amp;useSSL=false
      at java.sql.DriverManager.getConnection(DriverManager.java:689)
      at java.sql.DriverManager.getConnection(DriverManager.java:247)
      at org.apache.jsp.Home_jsp._jspService(Home_jsp.java:180)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:443)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:522)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
      at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
      at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:1102)
      at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
      at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:788)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1485)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      at java.lang.Thread.run(Thread.java:745)
  </code></pre>