mysql+jsp配置测试

首先是mysql的下载地址:

http://power4.onlinedown.net/down/mysql-5.0.41-win32.zip

l的图形化配置工具,browser以及administration都在这里里面 

http://dev.mysql.com/get/Downloads/MySQLGUITools/mysql-gui-tools-5.0-r12-win32.msi/from/http://ftp.iij.ad.jp/pub/db/mysql/

mysql的jdbc驱动下载地址:

http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.0.8.zip/from/http://mysqlmirror.netandhost.in

jdk1.5的下载地址:

http://192.18.108.137/ECom/EComTicketServlet/BEGINBB56F7CE2C6C6E95AE076D1BD6C64B94/-2147483648/2537678367/1/869090/868922/2537678367/2ts+/westCoastFSEND/jdk-1.5.0_14-oth-JPR/jdk-1.5.0_14-oth-JPR:3/jdk-1_5_0_14-windows-i586-p.exe

mysql+jsp测试的程序如下,关于数据库自己创建,easy!

<%@ page contentType="text/html; charset=gb2312"%>
<%@ page language="java"%>
<%@ page import="com.mysql.jdbc.Driver"%>
<%@ page import="java.sql.*"%>
<%
 //驱动程序名
 String driverName = "com.mysql.jdbc.Driver";
 //数据库用户名
 String userName = "root";
 //密码
 String userPasswd = "123";
 //数据库名
 String dbName = "mydb";
 //表名
 String tableName = "users";
 //联结字符串
 String url = "jdbc:mysql://localhost/" + dbName + "?user="
   + userName + "&password=" + userPasswd;
 Class.forName("com.mysql.jdbc.Driver").newInstance();
 Connection connection = DriverManager.getConnection(url);
 Statement statement = connection.createStatement();
 String sql = "SELECT * FROM " + tableName;
 ResultSet rs = statement.executeQuery(sql);
 //获得数据结果集合
 ResultSetMetaData rmeta = rs.getMetaData();
 //确定数据集的列数,亦字段数
 int numColumns = rmeta.getColumnCount();
 // 输出每一个数据值
 out.print("id");
 out.print("|");
 out.print("num");
 out.print("<br>");
 while (rs.next()) {
  out.print(rs.getString(1) + " ");
  out.print("|");
  out.print(rs.getString(2));
 out.print("<br>");
 }
 out.print("<br>");
 out.print("数据库操作成功,恭喜你");
 rs.close();
 statement.close();
 connection.close();
%>

后来,在官方文档看到了一些话,应该是mysql+web的jdbc驱动的指导了 ,

地址在这里:

http://dev.mysql.com/doc/refman/5.0/en/connector-mxj-install-jboss.html

复制如下:

http://dev.mysql.com/doc/refman/5.0/en/connector-mxj-install-jboss.html

1.Download Connector/MXJ and copy the connector-mxj.jar file to the $JBOSS_HOME/server/default/lib directory.

If you are using Connector/MXJ v5.0.4 or later you will also need to copy the connector-mxj-db-files.jar file to

$JBOSS_HOME/server/default/lib.

2.Download Connector/J and copy the mysql-connector-java-5.0.4-bin.jar file to the $JBOSS_HOME/server/default/lib directory.

3.Create an MBean service xml file in the $JBOSS_HOME/server/default/deploy directory with any attributes set, for instance

the datadir and autostart.

4.Set the JDBC parameters of your web application to use:

String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql:///test?propertiesTransform="+
             "com.mysql.management.jmx.ConnectorMXJPropertiesTransform";
String user = "root";
String password = "";
Class.forName(driver);
Connection conn = DriverManager.getConnection(url, user, password);


You may wish to create a separate users and database table spaces for each application, rather than using "root and test".

We highly suggest having a routine backup procedure for backing up the database files in the datadir.

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值