原因是驱动程序尚未加载到库中,它没有在连接中实例化,因此连接失败:
try { String connectionURL = "jdbc:mysql://host/db"; Connection connection = null; Class.forName("com.mysql.jdbc.Driver").newInstance(); connection = DriverManager.getConnection(connectionURL, "username", "password"); if(!connection.isClosed()) out.println("Successfully connected to " + "MySQL server using TCP/IP..."); connection.close(); }catch(Exception ex){ out.println("Unable to connect to database"+ex); }下载驱动



