楼主: ~贝贝~

支持国产数据库,达梦数据库试用团DM7大体验,优缺点我来评!活动结束,获奖名单公布

[复制链接]
论坛徽章:
43
现任管理团队成员
日期:2011-05-07 01:45:08ITPUB元老
日期:2012-09-12 14:50:28版主5段
日期:2014-06-11 02:21:31阿斯顿马丁
日期:2013-11-19 10:38:16祖母绿
日期:2012-11-06 12:43:12路虎
日期:2013-11-20 11:37:53雪佛兰
日期:2013-09-05 13:28:25ITPUB9周年纪念徽章
日期:2010-10-08 09:28:512015中国数据库技术大会纪念徽章
日期:2015-04-24 16:04:24秀才
日期:2015-05-26 13:32:07
261#
发表于 2011-12-19 10:16 | 只看该作者
julia2011 发表于 2011-12-18 22:35
今天有空, 浏览了下DM_DBA手册,关注了一下高级功能部分。
感觉数据守护类似于oracle的dataguard物理主备 ...

呵呵,oracle的东西配置太复杂了,不符合国人的使用习惯。

使用道具 举报

回复
论坛徽章:
43
现任管理团队成员
日期:2011-05-07 01:45:08ITPUB元老
日期:2012-09-12 14:50:28版主5段
日期:2014-06-11 02:21:31阿斯顿马丁
日期:2013-11-19 10:38:16祖母绿
日期:2012-11-06 12:43:12路虎
日期:2013-11-20 11:37:53雪佛兰
日期:2013-09-05 13:28:25ITPUB9周年纪念徽章
日期:2010-10-08 09:28:512015中国数据库技术大会纪念徽章
日期:2015-04-24 16:04:24秀才
日期:2015-05-26 13:32:07
262#
发表于 2011-12-19 10:18 | 只看该作者
julia2011 发表于 2011-12-18 22:23
mpp也支持?很感兴趣,目前有这功能的数据库不多啊,期待。不知道能支持多大数据量,性能如何?

mpp目前测试通过了1TB的tpch,性能有很好的加速效果,还在继续完善中。

使用道具 举报

回复
论坛徽章:
43
现任管理团队成员
日期:2011-05-07 01:45:08ITPUB元老
日期:2012-09-12 14:50:28版主5段
日期:2014-06-11 02:21:31阿斯顿马丁
日期:2013-11-19 10:38:16祖母绿
日期:2012-11-06 12:43:12路虎
日期:2013-11-20 11:37:53雪佛兰
日期:2013-09-05 13:28:25ITPUB9周年纪念徽章
日期:2010-10-08 09:28:512015中国数据库技术大会纪念徽章
日期:2015-04-24 16:04:24秀才
日期:2015-05-26 13:32:07
263#
发表于 2011-12-19 10:18 | 只看该作者
buptdream 发表于 2011-12-17 16:12
DM7的动态性能视图较之以前的版本增加了不少,总共大约有67个动态视图。而在Oracle中动态性能视图有几百个。 ...

收到,辛苦了。

使用道具 举报

回复
论坛徽章:
43
现任管理团队成员
日期:2011-05-07 01:45:08ITPUB元老
日期:2012-09-12 14:50:28版主5段
日期:2014-06-11 02:21:31阿斯顿马丁
日期:2013-11-19 10:38:16祖母绿
日期:2012-11-06 12:43:12路虎
日期:2013-11-20 11:37:53雪佛兰
日期:2013-09-05 13:28:25ITPUB9周年纪念徽章
日期:2010-10-08 09:28:512015中国数据库技术大会纪念徽章
日期:2015-04-24 16:04:24秀才
日期:2015-05-26 13:32:07
264#
发表于 2011-12-19 10:58 | 只看该作者
〇〇 发表于 2011-12-17 13:49
发现2个bug,
1。加载失败
D:\dmdbms\bin>dmfldr userid=T/T12345  control='D:\soft\Tcp-h_windows\supp ...

加载失败的原因找到了没?没报什么错误啊

使用道具 举报

回复
招聘 : 数据库管理员
论坛徽章:
275
生肖徽章2007版:鼠
日期:2009-11-25 17:01:33生肖徽章2007版:牛
日期:2009-02-07 09:37:19生肖徽章2007版:虎
日期:2008-09-28 13:40:38生肖徽章2007版:兔
日期:2009-09-10 11:22:26生肖徽章2007版:龙
日期:2012-08-10 14:09:58生肖徽章2007版:蛇
日期:2013-02-25 15:21:30生肖徽章2007版:马
日期:2009-03-10 21:15:36生肖徽章2007版:羊
日期:2009-09-10 11:27:42生肖徽章2007版:猴
日期:2009-02-10 09:47:38生肖徽章2007版:鸡
日期:2012-09-29 11:39:23
265#
发表于 2011-12-19 16:12 | 只看该作者
hwtong 发表于 2011-12-16 20:03
good

谢谢。我是入门级选手,提出的问题比较幼稚,见笑了。

使用道具 举报

回复
论坛徽章:
26
ITPUB伯乐
日期:2012-05-22 15:05:35喜羊羊
日期:2015-05-14 12:15:30美羊羊
日期:2015-07-02 22:22:59秀才
日期:2015-08-24 09:51:48天枰座
日期:2015-11-05 16:53:35双鱼座
日期:2015-12-05 19:22:56巨蟹座
日期:2015-12-20 18:46:10摩羯座
日期:2016-05-19 09:54:17ITPUB15周年纪念
日期:2016-10-13 13:15:34秀才
日期:2017-02-22 15:16:26
266#
发表于 2011-12-19 16:44 | 只看该作者
phoenix1981 发表于 2011-12-19 16:12
谢谢。我是入门级选手,提出的问题比较幼稚,见笑了。

没有啊..我没觉得什么...
因为是也是一个新手,我觉得你想到的 我没想到.所以觉得不错啊.
不是因为什么幼不幼稚的问题..
不好意思,让你误解了.

使用道具 举报

回复
招聘 : 数据库管理员
论坛徽章:
275
生肖徽章2007版:鼠
日期:2009-11-25 17:01:33生肖徽章2007版:牛
日期:2009-02-07 09:37:19生肖徽章2007版:虎
日期:2008-09-28 13:40:38生肖徽章2007版:兔
日期:2009-09-10 11:22:26生肖徽章2007版:龙
日期:2012-08-10 14:09:58生肖徽章2007版:蛇
日期:2013-02-25 15:21:30生肖徽章2007版:马
日期:2009-03-10 21:15:36生肖徽章2007版:羊
日期:2009-09-10 11:27:42生肖徽章2007版:猴
日期:2009-02-10 09:47:38生肖徽章2007版:鸡
日期:2012-09-29 11:39:23
267#
发表于 2011-12-19 17:23 | 只看该作者
hwtong 发表于 2011-12-19 16:44
没有啊..我没觉得什么...
因为是也是一个新手,我觉得你想到的 我没想到.所以觉得不错啊.
不是因为什么幼 ...

使用道具 举报

回复
论坛徽章:
63
2010广州亚运会纪念徽章:台球
日期:2010-10-18 12:43:48茶鸡蛋
日期:2013-01-09 10:59:002013年新春福章
日期:2013-02-25 14:51:24奥运会纪念徽章:帆船
日期:2013-04-02 17:07:052013年新春福章
日期:2013-04-08 17:42:48奥运纪念徽章
日期:2013-07-18 13:55:12优秀写手
日期:2013-12-18 09:29:10马上有车
日期:2014-03-20 16:13:24马上有房
日期:2014-03-20 16:14:11马上有钱
日期:2014-03-20 16:14:11
268#
发表于 2011-12-19 17:29 | 只看该作者
本帖最后由 chszs 于 2011-12-19 17:29 编辑

基于jieforest的代码进一步对达梦数据库测试。

1、环境条件
· 软件版本
达梦数据库:DM  v7.1
MySQL:5.1.44 community 32位
· 其它
其它软硬件相同,在同一台台式机,Windows XP操作系统上运行。
MySQL 5.1与DM 7.1均未做优化,都为默认配置。
2、数据库脚本
MySQL:
  1. CREATE DATABASE /*!32312 IF NOT EXISTS*/`dm7` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_bin */;
  2. USE `dm7`;
  3. CREATE TABLE `forum` (  `fid` int(11) NOT NULL AUTO_INCREMENT,  `link` varchar(256) COLLATE latin1_bin DEFAULT NULL,  `title` varchar(256) COLLATE latin1_bin DEFAULT NULL,  `author` varchar(128) COLLATE latin1_bin DEFAULT NULL,  `publishtime` date DEFAULT NULL,  `content` varchar(20000) COLLATE latin1_bin DEFAULT NULL,  `createtime` timestamp NULL DEFAULT NULL,  PRIMARY KEY (`fid`)) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin;
复制代码
DM:
  1. --创建表空间
  2. CREATE TABLESPACE dm7 DATAFILE 'dm7.DBF' size 60;
  3. --创建模式
  4. CREATE SCHEMA social;
  5. --创建表
  6. --CREATE social.forum
  7. CREATE TABLE social.forum
  8. (
  9.         fid INT IDENTITY(1,1) PRIMARY KEY,
  10.         links VARCHAR(256),
  11.         title VARCHAR(256),
  12.         author VARCHAR(128),
  13.         publishtime DATE,
  14.         content VARCHAR(8188),
  15.         createtime TIMESTAMP
  16. )STORAGE(ON dm7);
复制代码
3、程序(借用jieforest的部分代码)
  1. // MYSQL
  2. import java.sql.Connection;
  3. import java.sql.DriverManager;
  4. import java.sql.PreparedStatement;
  5. import java.sql.ResultSet;
  6. import java.sql.SQLException;
  7. import java.sql.Statement;
  8. import java.util.Date;

  9. public class MySQLtest {
  10.         private static String driver = "com.mysql.jdbc.Driver";
  11.         private static String db_url = "jdbc:mysql://localhost:3306/dm7";
  12.         private static String user = "sysdba";
  13.         private static String password = "adminadmin";

  14.         public void insertTest(int times) throws SQLException {
  15.                 PreparedStatement stmt = null;
  16.                 Connection conn = null;
  17.                 try {
  18.                         Class.forName(driver);
  19.                         conn = DriverManager.getConnection(db_url, user, password);
  20.                         String sql = "INSERT INTO forum(link,title,author,publishtime,content,createtime) VALUES(?,?,?,?,?,?)";
  21.                         
  22.                         for(int i=0; i<times; i++){
  23.                                 stmt = conn.prepareStatement(sql);
  24.                                 
  25.                                 String link = Utils.randomString(256);
  26.                                 String title = Utils.randomString(256);
  27.                                 String author = Utils.randomString(128);
  28.                                 long publishtime = new Date().getTime();
  29.                                 String content = Utils.randomString(1024);
  30.                                 java.sql.Timestamp createtime = new java.sql.Timestamp(new Date().getTime());
  31.                                 
  32.                                 stmt.setString(1, link);
  33.                                 stmt.setString(2, title);
  34.                                 stmt.setString(3, author);
  35.                                 stmt.setDate(4, new java.sql.Date(publishtime));
  36.                                 stmt.setString(5, content);
  37.                                 stmt.setTimestamp(6, createtime);

  38.                                 stmt.executeUpdate();
  39.                         }
  40.                 } catch (Exception e) {
  41.                         System.err.println("插入失败: " + e.getMessage());
  42.                         e.printStackTrace();
  43.                 } finally {
  44.                         stmt.close();
  45.                         conn.close();
  46.                 }
  47.         }
  48.         
  49.         public int queryTest(String str) throws SQLException{
  50.                 int number = 0;
  51.                 Statement stmt = null;
  52.                 Connection conn = null;
  53.                 ResultSet rs = null;
  54.                 try {
  55.                         Class.forName(driver);
  56.                         try {
  57.                                 conn = DriverManager.getConnection(db_url, user, password);
  58.                         } catch (SQLException e) {
  59.                                 throw new SQLException("Connect to DM7 Database Server Error : "
  60.                                    + e.getMessage());
  61.                         }
  62.                         String sql = "SELECT COUNT(*) AS total FROM forum WHERE content LIKE '%" + str + "%'";
  63.                         stmt = conn.createStatement();
  64.                         
  65.                         rs = stmt.executeQuery(sql);
  66.                         if(rs.next()){
  67.                                 number = rs.getInt("total");
  68.                         }
  69.                 } catch (Exception e) {
  70.                         System.err.println("查询失败: " + e.getMessage());
  71.                         e.printStackTrace();
  72.                 } finally {
  73.                         rs.close();
  74.                         stmt.close();
  75.                         conn.close();
  76.                 }
  77.                 return number;
  78.         }
  79.         
  80.         public int deleteTest(String str) throws SQLException{
  81.                 int number = 0;
  82.                 Statement stmt = null;
  83.                 Connection conn = null;
  84.                 try {
  85.                         Class.forName(driver);
  86.                         try {
  87.                                 conn = DriverManager.getConnection(db_url, user, password);
  88.                         } catch (SQLException e) {
  89.                                 throw new SQLException("Connect to DM7 Database Server Error : "
  90.                                    + e.getMessage());
  91.                         }
  92.                         String sql = "DELETE FROM forum WHERE content LIKE '%" + str + "%'";
  93.                         stmt = conn.createStatement();
  94.                         
  95.                         number = stmt.executeUpdate(sql);

  96.                 } catch (Exception e) {
  97.                         System.err.println("删除失败: " + e.getMessage());
  98.                         e.printStackTrace();
  99.                 } finally {
  100.                         stmt.close();
  101.                         conn.close();
  102.                 }
  103.                 return number;
  104.         }
  105.         
  106.         public void updateTest(String str) throws SQLException{
  107.                 Statement stmt = null;
  108.                 Connection conn = null;
  109.                 try {
  110.                         Class.forName(driver);
  111.                         try {
  112.                                 conn = DriverManager.getConnection(db_url, user, password);
  113.                         } catch (SQLException e) {
  114.                                 throw new SQLException("Connect to DM7 Database Server Error : "
  115.                                    + e.getMessage());
  116.                         }
  117.                         String sql = "UPDATE forum SET link = \"" + str + "\"";
  118.                         stmt = conn.createStatement();
  119.                         
  120.                         stmt.executeUpdate(sql);

  121.                 } catch (Exception e) {
  122.                         System.err.println("修改失败: " + e.getMessage());
  123.                         e.printStackTrace();
  124.                 } finally {
  125.                         stmt.close();
  126.                         conn.close();
  127.                 }
  128.         }
  129.         
  130.         public static void main(String[] args) throws SQLException{
  131.                 MySQLtest test = new MySQLtest();
  132.                
  133.                 long d1 = new Date().getTime();
  134.                 test.insertTest(100);
  135.                 long d2 = new Date().getTime();
  136.                 System.out.println("插入100条记录所需的时间为: " + (d2-d1) + "毫秒");
  137.                 int n = test.queryTest("AA");
  138.                 long d3 = new Date().getTime();
  139.                 System.out.println("遍历100条记录, 查询CONTENT字段包含‘AA’得到记录数:" + n + "条");
  140.                 System.out.println("遍历100条记录, 查询CONTENT字段包含‘AA’记录所需的时间为: " + (d3-d2) + "毫秒");
  141.                 test.updateTest("http://www.google.com.hk");
  142.                 long d4 = new Date().getTime();
  143.                 System.out.println("修改100条记录所需的时间为: " + (d4-d3) + "毫秒");
  144.                
  145.                 d1 = new Date().getTime();
  146.                 test.insertTest(1000);
  147.                 d2 = new Date().getTime();
  148.                 System.out.println("插入1000条记录所需的时间为: " + (d2-d1) + "毫秒");
  149.                 n = test.queryTest("AA");
  150.                 d3 = new Date().getTime();
  151.                 System.out.println("遍历1000条记录, 查询CONTENT字段包含‘AA’得到记录数:" + n + "条");
  152.                 System.out.println("遍历1000条记录, 查询CONTENT字段包含‘AA’记录所需的时间为: " + (d3-d2) + "毫秒");
  153.                 test.updateTest("http://www.google.com.hk");
  154.                 d4 = new Date().getTime();
  155.                 System.out.println("修改1000条记录所需的时间为: " + (d4-d3) + "毫秒");
  156.                
  157.                 d1 = new Date().getTime();
  158.                 test.insertTest(5000);
  159.                 d2 = new Date().getTime();
  160.                 System.out.println("插入5000条记录所需的时间为: " + (d2-d1) + "毫秒");
  161.                 n = test.queryTest("AA");
  162.                 d3 = new Date().getTime();
  163.                 System.out.println("遍历5000条记录, 查询CONTENT字段包含‘AA’得到记录数:" + n + "条");
  164.                 System.out.println("遍历5000条记录, 查询CONTENT字段包含‘AA’记录所需的时间为: " + (d3-d2) + "毫秒");
  165.                 test.updateTest("http://www.google.com.hk");
  166.                 d4 = new Date().getTime();
  167.                 System.out.println("修改5000条记录所需的时间为: " + (d4-d3) + "毫秒");
  168.                
  169.                 d1 = new Date().getTime();
  170.                 n = test.deleteTest("AA");
  171.                 d2 = new Date().getTime();
  172.                 System.out.println("删除所有记录中CONTENT字段包含‘AA’的记录所需的时间为: " + (d2-d1) + "毫秒");
  173.                 System.out.println("删除的记录数:" + n + "条");
  174.                
  175.         }
  176. }
  177. // DM7
  178. import java.sql.Connection;
  179. import java.sql.DriverManager;
  180. import java.sql.PreparedStatement;
  181. import java.sql.ResultSet;
  182. import java.sql.SQLException;
  183. import java.sql.Statement;
  184. import java.util.Date;

  185. public class DMtest {
  186.         private static String driver = "dm7.jdbc.driver.DmDriver";
  187.         private static String db_url = "jdbc:dm://localhost:5236";
  188.         private static String user = "SYSDBA";
  189.         private static String password = "adminadmin";
  190.         
  191.         public void insertTest(int times) throws SQLException {
  192.                 PreparedStatement stmt = null;
  193.                 Connection conn = null;
  194.                 try {
  195.                         Class.forName(driver);
  196.                         try {
  197.                                 conn = DriverManager.getConnection(db_url, user, password);
  198.                         } catch (SQLException e) {
  199.                                 throw new SQLException("Connect to DM Server Error : "
  200.                                    + e.getMessage());
  201.                         }
  202.                         String sql = "INSERT INTO social.forum(links,title,author,publishtime,content,createtime) VALUES(?,?,?,?,?,?)";
  203.                         
  204.                         for(int i=0; i<times; i++){
  205.                                 stmt = conn.prepareStatement(sql);
  206.                                 
  207.                                 String links = Utils.randomString(256);
  208.                                 String title = Utils.randomString(256);
  209.                                 String author = Utils.randomString(128);
  210.                                 long publishtime = new Date().getTime();
  211.                                 String content = Utils.randomString(1024);
  212.                                 java.sql.Timestamp createtime = new java.sql.Timestamp(new Date().getTime());
  213.                                 
  214.                                 stmt.setString(1, links);
  215.                                 stmt.setString(2, title);
  216.                                 stmt.setString(3, author);
  217.                                 stmt.setDate(4, new java.sql.Date(publishtime));
  218.                                 stmt.setString(5, content);
  219.                                 stmt.setTimestamp(6, createtime);

  220.                                 stmt.executeUpdate();
  221.                         }
  222.                 } catch (Exception e) {
  223.                         System.err.println("插入失败: " + e.getMessage());
  224.                         e.printStackTrace();
  225.                 } finally {
  226.                         stmt.close();
  227.                         conn.close();
  228.                 }
  229.         }
  230.         
  231.         public int queryTest(String str) throws SQLException{
  232.                 int number = 0;
  233.                 Statement stmt = null;
  234.                 Connection conn = null;
  235.                 ResultSet rs = null;
  236.                 try {
  237.                         Class.forName(driver);
  238.                         try {
  239.                                 conn = DriverManager.getConnection(db_url, user, password);
  240.                         } catch (SQLException e) {
  241.                                 throw new SQLException("Connect to DM7 Database Server Error : "
  242.                                    + e.getMessage());
  243.                         }
  244.                         String sql = "SELECT COUNT(*) AS TOTALS FROM social.forum WHERE content LIKE '%" + str + "%'";
  245.                         stmt = conn.createStatement();
  246.                         
  247.                         rs = stmt.executeQuery(sql);
  248.                         if(rs.next()){
  249.                                 number = rs.getInt("TOTALS");
  250.                         }
  251.                 } catch (Exception e) {
  252.                         System.err.println("查询失败: " + e.getMessage());
  253.                         e.printStackTrace();
  254.                 } finally {
  255.                         rs.close();
  256.                         stmt.close();
  257.                         conn.close();
  258.                 }
  259.                 return number;
  260.         }
  261.         
  262.         public int deleteTest(String str) throws SQLException{
  263.                 int number = 0;
  264.                 Statement stmt = null;
  265.                 Connection conn = null;
  266.                 try {
  267.                         Class.forName(driver);
  268.                         try {
  269.                                 conn = DriverManager.getConnection(db_url, user, password);
  270.                         } catch (SQLException e) {
  271.                                 throw new SQLException("Connect to DM7 Database Server Error : "
  272.                                    + e.getMessage());
  273.                         }
  274.                         String sql = "DELETE FROM social.forum WHERE content LIKE '%" + str + "%'";
  275.                         stmt = conn.createStatement();
  276.                         
  277.                         number = stmt.executeUpdate(sql);

  278.                 } catch (Exception e) {
  279.                         System.err.println("删除失败: " + e.getMessage());
  280.                         e.printStackTrace();
  281.                 } finally {
  282.                         stmt.close();
  283.                         conn.close();
  284.                 }
  285.                 return number;
  286.         }
  287.         
  288.         public void updateTest(String str) throws SQLException{
  289.                 Statement stmt = null;
  290.                 Connection conn = null;
  291.                 try {
  292.                         Class.forName(driver);
  293.                         try {
  294.                                 conn = DriverManager.getConnection(db_url, user, password);
  295.                         } catch (SQLException e) {
  296.                                 throw new SQLException("Connect to DM7 Database Server Error : "
  297.                                    + e.getMessage());
  298.                         }
  299.                         String sql = "UPDATE social.forum SET links = '" + str + "'";
  300.                         stmt = conn.createStatement();
  301.                         
  302.                         stmt.executeUpdate(sql);

  303.                 } catch (Exception e) {
  304.                         System.err.println("修改失败: " + e.getMessage());
  305.                         e.printStackTrace();
  306.                 } finally {
  307.                         stmt.close();
  308.                         conn.close();
  309.                 }
  310.         }
  311.         
  312.         public static void main(String[] args) throws SQLException{
  313.                 DMtest test = new DMtest();
  314.                
  315.                 long d1 = new Date().getTime();
  316.                 test.insertTest(100);
  317.                 long d2 = new Date().getTime();
  318.                 System.out.println("插入100条记录所需的时间为: " + (d2-d1) + "毫秒");
  319.                 int n = test.queryTest("AA");
  320.                 long d3 = new Date().getTime();
  321.                 System.out.println("遍历100条记录, 查询CONTENT字段包含‘AA’得到记录数:" + n + "条");
  322.                 System.out.println("遍历100条记录, 查询CONTENT字段包含‘AA’记录所需的时间为: " + (d3-d2) + "毫秒");
  323.                 test.updateTest("http://www.google.com.hk");
  324.                 long d4 = new Date().getTime();
  325.                 System.out.println("修改100条记录所需的时间为: " + (d4-d3) + "毫秒");
  326.                
  327.                 d1 = new Date().getTime();
  328.                 test.insertTest(1000);
  329.                 d2 = new Date().getTime();
  330.                 System.out.println("插入1000条记录所需的时间为: " + (d2-d1) + "毫秒");
  331.                 n = test.queryTest("AA");
  332.                 d3 = new Date().getTime();
  333.                 System.out.println("遍历1000条记录, 查询CONTENT字段包含‘AA’得到记录数:" + n + "条");
  334.                 System.out.println("遍历1000条记录, 查询CONTENT字段包含‘AA’记录所需的时间为: " + (d3-d2) + "毫秒");
  335.                 test.updateTest("http://www.google.com.hk");
  336.                 d4 = new Date().getTime();
  337.                 System.out.println("修改1000条记录所需的时间为: " + (d4-d3) + "毫秒");
  338.                
  339.                 d1 = new Date().getTime();
  340.                 test.insertTest(5000);
  341.                 d2 = new Date().getTime();
  342.                 System.out.println("插入5000条记录所需的时间为: " + (d2-d1) + "毫秒");
  343.                 n = test.queryTest("AA");
  344.                 d3 = new Date().getTime();
  345.                 System.out.println("遍历5000条记录, 查询CONTENT字段包含‘AA’得到记录数:" + n + "条");
  346.                 System.out.println("遍历5000条记录, 查询CONTENT字段包含‘AA’记录所需的时间为: " + (d3-d2) + "毫秒");
  347.                 test.updateTest("http://www.google.com.hk");
  348.                 d4 = new Date().getTime();
  349.                 System.out.println("修改5000条记录所需的时间为: " + (d4-d3) + "毫秒");
  350.                
  351.                 d1 = new Date().getTime();
  352.                 n = test.deleteTest("AA");
  353.                 d2 = new Date().getTime();
  354.                 System.out.println("删除所有记录中CONTENT字段包含‘AA’的记录所需的时间为: " + (d2-d1) + "毫秒");
  355.                 System.out.println("删除的记录数:" + n + "条");
  356.         }
  357. }
复制代码
  1. // DM7
  2. import java.sql.Connection;
  3. import java.sql.DriverManager;
  4. import java.sql.PreparedStatement;
  5. import java.sql.ResultSet;
  6. import java.sql.SQLException;
  7. import java.sql.Statement;
  8. import java.util.Date;

  9. public class DMtest {
  10.         private static String driver = "dm7.jdbc.driver.DmDriver";
  11.         private static String db_url = "jdbc:dm://localhost:5236";
  12.         private static String user = "SYSDBA";
  13.         private static String password = "adminadmin";
  14.         
  15.         public void insertTest(int times) throws SQLException {
  16.                 PreparedStatement stmt = null;
  17.                 Connection conn = null;
  18.                 try {
  19.                         Class.forName(driver);
  20.                         try {
  21.                                 conn = DriverManager.getConnection(db_url, user, password);
  22.                         } catch (SQLException e) {
  23.                                 throw new SQLException("Connect to DM Server Error : "
  24.                                    + e.getMessage());
  25.                         }
  26.                         String sql = "INSERT INTO social.forum(links,title,author,publishtime,content,createtime) VALUES(?,?,?,?,?,?)";
  27.                         
  28.                         for(int i=0; i<times; i++){
  29.                                 stmt = conn.prepareStatement(sql);
  30.                                 
  31.                                 String links = Utils.randomString(256);
  32.                                 String title = Utils.randomString(256);
  33.                                 String author = Utils.randomString(128);
  34.                                 long publishtime = new Date().getTime();
  35.                                 String content = Utils.randomString(1024);
  36.                                 java.sql.Timestamp createtime = new java.sql.Timestamp(new Date().getTime());
  37.                                 
  38.                                 stmt.setString(1, links);
  39.                                 stmt.setString(2, title);
  40.                                 stmt.setString(3, author);
  41.                                 stmt.setDate(4, new java.sql.Date(publishtime));
  42.                                 stmt.setString(5, content);
  43.                                 stmt.setTimestamp(6, createtime);

  44.                                 stmt.executeUpdate();
  45.                         }
  46.                 } catch (Exception e) {
  47.                         System.err.println("插入失败: " + e.getMessage());
  48.                         e.printStackTrace();
  49.                 } finally {
  50.                         stmt.close();
  51.                         conn.close();
  52.                 }
  53.         }
  54.         
  55.         public int queryTest(String str) throws SQLException{
  56.                 int number = 0;
  57.                 Statement stmt = null;
  58.                 Connection conn = null;
  59.                 ResultSet rs = null;
  60.                 try {
  61.                         Class.forName(driver);
  62.                         try {
  63.                                 conn = DriverManager.getConnection(db_url, user, password);
  64.                         } catch (SQLException e) {
  65.                                 throw new SQLException("Connect to DM7 Database Server Error : "
  66.                                    + e.getMessage());
  67.                         }
  68.                         String sql = "SELECT COUNT(*) AS TOTALS FROM social.forum WHERE content LIKE '%" + str + "%'";
  69.                         stmt = conn.createStatement();
  70.                         
  71.                         rs = stmt.executeQuery(sql);
  72.                         if(rs.next()){
  73.                                 number = rs.getInt("TOTALS");
  74.                         }
  75.                 } catch (Exception e) {
  76.                         System.err.println("查询失败: " + e.getMessage());
  77.                         e.printStackTrace();
  78.                 } finally {
  79.                         rs.close();
  80.                         stmt.close();
  81.                         conn.close();
  82.                 }
  83.                 return number;
  84.         }
  85.         
  86.         public int deleteTest(String str) throws SQLException{
  87.                 int number = 0;
  88.                 Statement stmt = null;
  89.                 Connection conn = null;
  90.                 try {
  91.                         Class.forName(driver);
  92.                         try {
  93.                                 conn = DriverManager.getConnection(db_url, user, password);
  94.                         } catch (SQLException e) {
  95.                                 throw new SQLException("Connect to DM7 Database Server Error : "
  96.                                    + e.getMessage());
  97.                         }
  98.                         String sql = "DELETE FROM social.forum WHERE content LIKE '%" + str + "%'";
  99.                         stmt = conn.createStatement();
  100.                         
  101.                         number = stmt.executeUpdate(sql);

  102.                 } catch (Exception e) {
  103.                         System.err.println("删除失败: " + e.getMessage());
  104.                         e.printStackTrace();
  105.                 } finally {
  106.                         stmt.close();
  107.                         conn.close();
  108.                 }
  109.                 return number;
  110.         }
  111.         
  112.         public void updateTest(String str) throws SQLException{
  113.                 Statement stmt = null;
  114.                 Connection conn = null;
  115.                 try {
  116.                         Class.forName(driver);
  117.                         try {
  118.                                 conn = DriverManager.getConnection(db_url, user, password);
  119.                         } catch (SQLException e) {
  120.                                 throw new SQLException("Connect to DM7 Database Server Error : "
  121.                                    + e.getMessage());
  122.                         }
  123.                         String sql = "UPDATE social.forum SET links = '" + str + "'";
  124.                         stmt = conn.createStatement();
  125.                         
  126.                         stmt.executeUpdate(sql);

  127.                 } catch (Exception e) {
  128.                         System.err.println("修改失败: " + e.getMessage());
  129.                         e.printStackTrace();
  130.                 } finally {
  131.                         stmt.close();
  132.                         conn.close();
  133.                 }
  134.         }
  135.         
  136.         public static void main(String[] args) throws SQLException{
  137.                 DMtest test = new DMtest();
  138.                
  139.                 long d1 = new Date().getTime();
  140.                 test.insertTest(100);
  141.                 long d2 = new Date().getTime();
  142.                 System.out.println("插入100条记录所需的时间为: " + (d2-d1) + "毫秒");
  143.                 int n = test.queryTest("AA");
  144.                 long d3 = new Date().getTime();
  145.                 System.out.println("遍历100条记录, 查询CONTENT字段包含‘AA’得到记录数:" + n + "条");
  146.                 System.out.println("遍历100条记录, 查询CONTENT字段包含‘AA’记录所需的时间为: " + (d3-d2) + "毫秒");
  147.                 test.updateTest("http://www.google.com.hk");
  148.                 long d4 = new Date().getTime();
  149.                 System.out.println("修改100条记录所需的时间为: " + (d4-d3) + "毫秒");
  150.                
  151.                 d1 = new Date().getTime();
  152.                 test.insertTest(1000);
  153.                 d2 = new Date().getTime();
  154.                 System.out.println("插入1000条记录所需的时间为: " + (d2-d1) + "毫秒");
  155.                 n = test.queryTest("AA");
  156.                 d3 = new Date().getTime();
  157.                 System.out.println("遍历1000条记录, 查询CONTENT字段包含‘AA’得到记录数:" + n + "条");
  158.                 System.out.println("遍历1000条记录, 查询CONTENT字段包含‘AA’记录所需的时间为: " + (d3-d2) + "毫秒");
  159.                 test.updateTest("http://www.google.com.hk");
  160.                 d4 = new Date().getTime();
  161.                 System.out.println("修改1000条记录所需的时间为: " + (d4-d3) + "毫秒");
  162.                
  163.                 d1 = new Date().getTime();
  164.                 test.insertTest(5000);
  165.                 d2 = new Date().getTime();
  166.                 System.out.println("插入5000条记录所需的时间为: " + (d2-d1) + "毫秒");
  167.                 n = test.queryTest("AA");
  168.                 d3 = new Date().getTime();
  169.                 System.out.println("遍历5000条记录, 查询CONTENT字段包含‘AA’得到记录数:" + n + "条");
  170.                 System.out.println("遍历5000条记录, 查询CONTENT字段包含‘AA’记录所需的时间为: " + (d3-d2) + "毫秒");
  171.                 test.updateTest("http://www.google.com.hk");
  172.                 d4 = new Date().getTime();
  173.                 System.out.println("修改5000条记录所需的时间为: " + (d4-d3) + "毫秒");
  174.                
  175.                 d1 = new Date().getTime();
  176.                 n = test.deleteTest("AA");
  177.                 d2 = new Date().getTime();
  178.                 System.out.println("删除所有记录中CONTENT字段包含‘AA’的记录所需的时间为: " + (d2-d1) + "毫秒");
  179.                 System.out.println("删除的记录数:" + n + "条");
  180.         }
  181. }
复制代码
4、结果

结论1:DM数据库的INSERT插入INSERT语句执行特别快,速度为MySQL的7、8倍;
结论2:DM数据库的UPDATE修改语句执行也比较快,速度为MySQL的2、3倍,随着数据量的增加,与MySQL的速度差异逐步下降;
结论3:DM数据库的DELETE删除语句也比MySQL快,大约是1.5倍的速度;
结论4:DM数据库的查询SELECT语句与MySQL差别不大。


总结:增删改查语句是数据库操作最常用的语句,对基本语句的测试有助于客观看待达梦数据库。






使用道具 举报

回复
论坛徽章:
6
2012新春纪念徽章
日期:2012-01-04 11:53:292013年新春福章
日期:2013-02-25 14:51:24林肯
日期:2013-09-12 15:57:33优秀写手
日期:2013-12-18 09:29:09慢羊羊
日期:2015-03-04 14:51:352015年新春福章
日期:2015-03-06 11:57:31
269#
发表于 2011-12-19 17:43 | 只看该作者
测试很专业啊!

有时间再试试百万级的数据量, 体现一下dm 与 mysql 的查询性能差异,  就更好了。

使用道具 举报

回复
论坛徽章:
43
现任管理团队成员
日期:2011-05-07 01:45:08ITPUB元老
日期:2012-09-12 14:50:28版主5段
日期:2014-06-11 02:21:31阿斯顿马丁
日期:2013-11-19 10:38:16祖母绿
日期:2012-11-06 12:43:12路虎
日期:2013-11-20 11:37:53雪佛兰
日期:2013-09-05 13:28:25ITPUB9周年纪念徽章
日期:2010-10-08 09:28:512015中国数据库技术大会纪念徽章
日期:2015-04-24 16:04:24秀才
日期:2015-05-26 13:32:07
270#
发表于 2011-12-19 17:46 | 只看该作者
chszs 发表于 2011-12-19 17:29
基于jieforest的代码进一步对达梦数据库测试。

1、环境条件

呵呵,楼主辛苦了。

您的程序可以作为我们新员工学习jdbc的教程了!

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表