修改密码

请输入密码
请输入密码 请输入8-64长度密码 和 email 地址不相同 至少包括数字、大写字母、小写字母、半角符号中的 3 个
请输入密码
提交

修改昵称

当前昵称:
提交

申请证书

证书详情

Please complete this required field.

  • Ultipa Graph V4

Standalone

Please complete this required field.

Please complete this required field.

服务器的MAC地址

Please complete this required field.

Please complete this required field.

取消
申请
ID
产品
状态
核数
申请天数
审批时间
过期时间
MAC地址
申请理由
审核信息
关闭
基础信息
  • 用户昵称:
  • 手机号:
  • 公司名称:
  • 公司邮箱:
  • 地区:
  • 语言:
修改密码
申请证书

当前未申请证书.

申请证书
Certificate Issued at Valid until Serial No. File
Serial No. Valid until File

Not having one? Apply now! >>>

ProductName CreateTime ID Price File
ProductName CreateTime ID Price File

No Invoice

v5.0
搜索
    v5.0

      连接

      安装嬴图Java驱动并部署一个嬴图实例后,就可以将应用与数据库连接了。

      你可以使用UltipaConfig配置连接,点击查看UltipaConfig属性

      建立连接

      使用UltipaDriver()创建连接:

      package com.ultipa.www.sdk.api;
      
      import com.ultipa.sdk.UltipaDriver;
      import com.ultipa.sdk.connect.conf.UltipaConfig;
      import org.assertj.core.util.Lists;
      
      public class Main {
          public static void main(String[] args) {
              UltipaConfig ultipaConfig = UltipaConfig.config()
                      // URI example: .hosts(Lists.newArrayList("d3026ac361964633986849ec43b84877s.eu-south-1.cloud.ultipa.com:8443"))
                      .hosts(Lists.newArrayList("192.168.1.85:60061","192.168.1.88:60061","192.168.1.87:60061"))
                      .username("<username>")
                      .password("<password>");
      
              UltipaDriver driver = null;
      
              try {
                  driver = new UltipaDriver(ultipaConfig);
                  Boolean isSuccess = driver.test();
                  System.out.println("Connection succeeds: " + isSuccess);
              } catch (InterruptedException e) {
                  throw new RuntimeException(e);
              } finally {
                  if (driver != null) {
                      driver.close();
                  }
              }
          }
      }
      

      Connection succeeds: true
      

      UltipaConfig属性

      UltipaConfig类有以下属性:

      属性
      类型
      默认
      描述
      hosts List<String> / 必填,逗号分隔的数据库服务器IP或URL地址;自动识别协议,不允许在URL开头写https://http://
      username String / 必填,服务器验证的用户名
      password String / 必填,服务器验证的密码
      defaultGraph String / 默认使用的图名称
      crt String / 建立安全连接所需的SSL证书文件路径
      passwordEncrypt String MD5 驱动的密码加密方式,支持MD5LDAPNOTHING
      connectTimeout Integer 2000 连接超时阈值(单位:毫秒);每台服务器默认尝试连接三次
      timeout Integer 15 请求超时阈值(单位:秒)
      heartbeat Integer 0 用于保持连接为活跃状态的心跳间隔(单位:毫秒),设置为0关闭心跳
      maxRecvSize Integer 32 接收数据的最大大小(单位:MB)
      poolConfig PoolConfig / 配置连接池
      keepAlive Integer 120 在向主机发送保持活跃探针以维持连接响应性前,允许处于非活动状态的最大时长(单位:秒)(可能增加服务负载)
      keepAliveWithoutCalls Boolean false 连接处于非活动状态时,仍激活保持活跃机制
      overrideAuthority String / 使用ultipa覆盖hostname以匹配服务器证书颁发机构

      连接池

      Ultipa.poolConfig包含使用Apache Commons池库的配置。连接数据库时,需完成这些设置,以便高效处理和重用连接。

      PoolConfig类有以下属性:

      属性
      类型
      默认
      描述
      maxTotal int 8 连接池中允许的最大连接数(活动连接 + 空闲连接)
      maxIdle int 8 连接池中允许的最大空闲连接数
      minIdle int 1 连接池中应保持的最小空闲连接数
      minEvictableIdleTimeMillis long 1800000L(30分钟) 连接在空闲多久后可以被驱逐
      timeBetweenEvictionRunsMillis long 600000L(10分钟) 执行空闲连接驱逐检查的时间间隔
      numTestsPerEvictionRun int 3 每次驱逐运行中要检查的连接数量
      testOnBorrow boolean false 借出连接前是否进行验证
      testOnReturn boolean true 归还连接时是否进行验证
      testWhileIdle boolean true 在空闲期间是否验证连接
      maxWaitMillis long -1L 当连接池耗尽时,获取连接的最大等待时间(默认无限等待)
      lifo boolean true 是否按LIFO(后进先出)顺序获取连接
      blockWhenExhausted boolean true 当连接池耗尽时,是否阻塞等待还是立即抛出异常

      package com.ultipa.www.sdk.api;
      
      import com.ultipa.sdk.UltipaDriver;
      import com.ultipa.sdk.connect.conf.PoolConfig;
      import com.ultipa.sdk.connect.conf.UltipaConfig;
      import org.assertj.core.util.Lists;
      
      public class Main {
          public static void main(String[] args) {
              UltipaConfig ultipaConfig = UltipaConfig.config()
                      // URI example: .hosts(Lists.newArrayList("d3026ac361964633986849ec43b84877s.eu-south-1.cloud.ultipa.com:8443"))
                      .hosts(Lists.newArrayList("192.168.1.85:60061","192.168.1.88:60061","192.168.1.87:60061"))
                      .username("<username>")
                      .password("<password>");
      
              PoolConfig poolConfig = ultipaConfig.getPoolConfig();
              poolConfig.setMaxIdle(50);
              poolConfig.setMinIdle(2);
              poolConfig.setMaxTotal(200);
      
              UltipaDriver driver = null;
      
              try {
                  driver = new UltipaDriver(ultipaConfig);
                  Boolean isSuccess = driver.test();
                  System.out.println("Connection succeeds: " + isSuccess);
              } catch (InterruptedException e) {
                  throw new RuntimeException(e);
              } finally {
                  if (driver != null) {
                      driver.close();
                  }
              }
          }
      }
      

      Connection succeeds: true
      
      请完成以下信息后可下载此书
      *
      公司名称不能为空
      *
      公司邮箱必须填写
      *
      你的名字必须填写
      *
      你的电话必须填写
      *
      你的电话必须填写