工作中对达梦数据库调研

达梦数据库调研

 

1.这里使用DM7-windows-64位版本

链接:https://pan.baidu.com/s/1f1rghuay6ENWMFcZJTmnyw 

提取码:wdul

 

2.安装达梦数据库

达梦数据库管理系统安装手册.pdf

用户名、密码(默认和用户名一致)

SYSDBA

Adm@163.com

DMHR

Adm@163.com

 

3.遇到的问题

//dmhr无法登录问题

https://www.cndba.cn/dave/article/3640

表权限

https://www.it610.com/article/1298012583663575040.htm

赋权用户 查看

GRANT SELECT ON V$CIPHERS TO DMHR;

 

4.连接示例

jdbc连接示例

 public static void main(String[] args) {

       Connection con;

       String driver = "dm.jdbc.driver.DmDriver";

       String url = "jdbc:dm://127.0.0.1:5236/DEMO";

       String user = "DEMO";

       String password = "DEMODEMODEMO";

       try {

           Class.forName(driver);

           con = DriverManager.getConnection(url,user,password);

           if(!con.isClosed())

               System.out.println("Succeeded connecting to the Database!");

 

           Statement statement = con.createStatement();

           //要执行的SQL语句

           String sql = "select * from Persons";

           //3.ResultSet类,用来存放获取的结果集!!

           ResultSet rs = statement.executeQuery(sql);

           System.out.println("-----------------");

           System.out.println("执行结果如下所示:");

           System.out.println("-----------------");

           System.out.println("编号" + "\t" + "姓名");

           System.out.println("-----------------");

 

           String id = null;

           String name = null;

           while(rs.next()){

               id = rs.getString("ID");

               name = rs.getString("Name");

 

               System.out.println(id + "\t" + name);

           }

           rs.close();

           con.close();

       } catch(ClassNotFoundException e) {

           System.out.println("Sorry,can`t find the Driver!");

           e.printStackTrace();

       } catch(SQLException e) {

           //数据库连接失败异常处理

           e.printStackTrace();

       }catch (Exception e) {

           e.printStackTrace();

       }finally{

           System.out.println("数据库数据成功获取!!");

       }

   }

语法:

sql操作和oracle语法类似

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值