title: How do I install JDBC to work in Java 8 on Debian 10?
body: <p>I'm trying to connect into MySQL database on Java 8 using this code, but I'm getting an exception that JDBC driver class was not found. What is the solution for Debian 10? java.lang.ClassNotFoundException: com.mysql.jdbc.Driver</p>
  
  <pre><code>import java.sql.*; 
  
  class MysqlCon {
  
   public static void main(String args[]) {  
      try {  
         Class.forName("com.mysql.jdbc.Driver");  
         Connection con = DriverManager.getConnection(
             "jdbc:mysql://localhost:3306/sonoo","root","root");  
         //here sonoo is database name, root is username and password  
         Statement stmt=con.createStatement();  
         ResultSet rs=stmt.executeQuery("select * from emp");  
         while(rs.next())  
         System.out.println(rs.getInt(1) + "  " + rs.getString(2) + " " + rs.getString(3));  
         con.close();  
      } catch(Exception e) {
           System.out.println(e);
      }  
   }  
  } 
  </code></pre>