datacap icon indicating copy to clipboard operation
datacap copied to clipboard

✨ [Feature] SqlServer Versions

Open Smilewh888 opened this issue 3 years ago • 0 comments

Contribution guidelines

I want to suggest an idea and checked that ...

  • [ ] ... to my best knowledge, my idea wouldn't break something for other users
  • [ ] ... the documentation does not mention anything about my idea
  • [ ] ... there are no open or closed issues that are related to my idea

Description

也许你的SqlServer连接可能是对的,默认使用JdbcConnection#formatJdbcUrl 生成的通用的连接

但是我在测试的时候使用SqlServer版本是2017

必须要重写 JdbcConnection#formatJdbcUrl 方法才能使用。

Use Cases

重写代码如下:

protected String formatJdbcUrl() { JdbcConfigure jdbcConfigure = (JdbcConfigure) this.getConfigure(); StringBuffer buffer = new StringBuffer(); buffer.append("jdbc:"); buffer.append(jdbcConfigure.getJdbcType()); buffer.append("://"); buffer.append(jdbcConfigure.getHost()); buffer.append(":"); buffer.append(jdbcConfigure.getPort()); buffer.append(";"); if (jdbcConfigure.getDatabase().isPresent()) { buffer.append("databaseName="); buffer.append(jdbcConfigure.getDatabase().get()); buffer.append(";"); } if (jdbcConfigure.getSsl().isPresent()) { buffer.append(String.format("ssl=%s", jdbcConfigure.getSsl().get())); buffer.append(";"); } if (jdbcConfigure.getEnv().isPresent()) { Map<String, Object> env = jdbcConfigure.getEnv().get(); List flatEnv = env.entrySet() .stream() .map(value -> String.format("%s=%s", value.getKey(), value.getValue())) .collect(Collectors.toList()); buffer.append(String.join(";", flatEnv)); } return buffer.toString(); }

附上使用的SqlSever镜像,docker-compose.yml version: '3.3' services: sqlserver: image: microsoft/mssql-server-linux container_name: mssql-server restart: always environment: - ACCEPT_EULA=Y - SA_PASSWORD=TestH2023 ports: - 1433:1433 volumes: - ./mssql:/var/opt/mssql

Screenshots / Mockups

No response

Smilewh888 avatar Nov 13 '23 05:11 Smilewh888