安装和加载JDBC驱动程序
下载JDBC驱动程序mysql-connector-java-5.1.7.zip
https://.mysql.jdbc.Driver");//加载JDBC驱动程序 Connection conn = DriverManager.getConnection(url,user,password);//链接数据库 }catch(ClassNotFoundException e){ out.println("找不到驱动类");//抛出异常时,提示信息 }catch(SQLException e){ out.println("链接MySQL数据库失败");//处理SQLException异常 } %> </body></html>