资源简介

html5下,连接MySQL数据库的实例,包含增删查改,并登录的实例

资源截图

代码片段和文件信息

package javacode;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class Connectionhelper 
{
public static Connection getConnection()
{
String driver = “com.mysql.jdbc.Driver“;
String url = “jdbc:mysql://127.0.0.1:3306/testjs“;
String user = “root“;
String password = “admin“;
Connection conn = null;
try {
Class.forName(driver);
conn = DriverManager.getConnection(url user password);
if (!conn.isClosed())
System.out.println(“Succeeded connecting to the Database!“);
} catch (ClassNotFoundException e) {
System.out.println(“Sorrycan‘t find the Driver!“);
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
return conn;
}
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2015-11-03 09:27  ChatRoom\
     文件         779  2014-03-06 17:54  ChatRoom\.classpath
     目录           0  2014-03-06 20:24  ChatRoom\.myeclipse\
     文件         297  2014-03-06 14:32  ChatRoom\.mymetadata
     文件        1751  2014-03-06 16:07  ChatRoom\.project
     目录           0  2015-11-03 09:27  ChatRoom\.settings\
     文件         500  2014-03-06 14:32  ChatRoom\.settings\.jsdtscope
     文件         395  2014-03-06 14:32  ChatRoom\.settings\org.eclipse.jdt.core.prefs
     文件         462  2014-03-06 14:32  ChatRoom\.settings\org.eclipse.wst.common.component
     文件         252  2014-03-06 14:32  ChatRoom\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2014-03-06 14:32  ChatRoom\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2014-03-06 14:32  ChatRoom\.settings\org.eclipse.wst.jsdt.ui.superType.name
     目录           0  2015-11-03 09:27  ChatRoom\src\
     目录           0  2015-11-03 09:27  ChatRoom\src\javacode\
     文件         823  2014-03-06 16:06  ChatRoom\src\javacode\Connectionhelper.java
     文件        1713  2014-03-06 18:20  ChatRoom\src\javacode\LoginHandle.java
     目录           0  2015-11-03 09:27  ChatRoom\src\servlet\
     文件        2943  2014-03-06 14:34  ChatRoom\src\servlet\ChatServlet.java
     文件        1202  2014-03-06 20:08  ChatRoom\src\servlet\LoginServlet.java
     目录           0  2015-11-03 09:27  ChatRoom\WebRoot\
     文件         834  2014-03-06 14:31  ChatRoom\WebRoot\index.jsp
     目录           0  2015-11-03 09:27  ChatRoom\WebRoot\js\
     文件       78601  2014-03-06 15:06  ChatRoom\WebRoot\js\jquery-1.4.4.min.js
     文件       30330  2014-03-06 15:17  ChatRoom\WebRoot\js\jquery.form.js
     文件      129738  2014-03-06 15:07  ChatRoom\WebRoot\js\prototype-1.6.0.3.js
     文件        1478  2014-03-06 19:55  ChatRoom\WebRoot\login.html
     目录           0  2015-11-03 09:27  ChatRoom\WebRoot\meta-INF\
     文件          36  2014-03-06 14:31  ChatRoom\WebRoot\meta-INF\MANIFEST.MF
     目录           0  2015-11-03 09:27  ChatRoom\WebRoot\WEB-INF\
     目录           0  2015-11-03 09:27  ChatRoom\WebRoot\WEB-INF\classes\
     目录           0  2015-11-03 09:27  ChatRoom\WebRoot\WEB-INF\classes\javacode\
............此处省略7个文件信息

评论

共有 条评论