zoukankan      html  css  js  c++  java
  • JDBC 连接 带实例名的SQL Server

    1、直接指定实例名

    jdbcDriverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver 
    jdbcUrl=jdbc:sqlserver://192.168.xxx.xxx;instanceName=sql_03;DatabaseName=edu;integratedSecurity=false 
    hibernate.dialect=org.hibernate.dialect.SQLServerDialect 
    jdbcUsername=sa 
    jdbcPassword=xxxxx

    DBCP Pool settings 
    jdbcInitialSize=5 
    jdbcMaxActive=10 
    jdbcMaxIdle=5 
    jdbcMaxWait=30000 
    jdbcValidationQuery=select 1


    2、指定端口

    jdbcDriverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver 
    jdbcUrl=jdbc:sqlserver://192.168.xxx.xxx:64150;DatabaseName=edu;integratedSecurity=false 
    hibernate.dialect=org.hibernate.dialect.SQLServerDialect 
    jdbcUsername=sa 
    jdbcPassword=xxx 
    # DBCP Pool settings 
    jdbcInitialSize=5 
    jdbcMaxActive=10 
    jdbcMaxIdle=5 
    jdbcMaxWait=30000 
    jdbcValidationQuery=select 1 

    指定的多个 SQL Server 实例SQL Server 2000 和 SQL Server 2005 允许在每台服务器上安装多个数据库实例。每个实例都由一个专用名称所标识。若要连接到指定的 SQL Server 实例,可以使用指定实例的端口号(首选),也可将实例名指定为 JDBC URL 属性或 datasource 属性。如果未指定实例名属性或端口号属性,则会创建与默认实例的连接。如以下实例所示: 
    若要使用端口号,请执行下列操作: 
    jdbc:sqlserver://localhost:1433;integratedSecurity=true;<more properties as required>; 
    若要使用 JDBC URL 属性,请执行下列操作: 
    jdbc:sqlserver://localhost;instanceName=instance1;integratedSecurity=true;<more properties as required>;

     

  • 相关阅读:
    生成数据库结构设计说明书的存储过程
    C#检测上传图片是否安全函数
    设定下拉列表控件DropDownList,复选按钮CheckBox,RadioButton默认值总结测试
    C#批量重命名工具V2.0
    个人一些工作经验方式积累办法
    修身《孟子》尽心篇
    linux 命令 lspci lsusb
    重拾信心
    linux eclipse
    A lunch in Gordon Market with WWF
  • 原文地址:https://www.cnblogs.com/martian6125/p/9631076.html
Copyright © 2011-2022 走看看