提交 d57bd6a6 编写于 作者: S serge-rider

#6554 SQL Server driver version upgrade

上级 92baeefd
......@@ -139,7 +139,7 @@
<replace provider="mssql" driver="mssql_jdbc_ms_new"/>
<file type="jar" path="maven:/com.microsoft.sqlserver:mssql-jdbc:RELEASE[7.2.1.jre8]" bundle="!drivers.mssql.new"/>
<file type="jar" path="maven:/com.microsoft.sqlserver:mssql-jdbc:RELEASE[7.4.1.jre8]" bundle="!drivers.mssql.new"/>
<!--<file type="jar" path="maven:/com.microsoft.azure:adal4j:RELEASE" optional="true" />-->
<file type="lib" os="win32" arch="x86" path="repo:/drivers/mssql/auth/x86/sqljdbc_auth.dll" bundle="!drivers.mssql.new"/>
<file type="lib" os="win32" arch="x86_64" path="repo:/drivers/mssql/auth/x64/sqljdbc_auth.dll" bundle="!drivers.mssql.new"/>
......@@ -167,7 +167,7 @@
<replace provider="mssql" driver="mssql_jdbc_azure"/>
<file type="jar" path="maven:/com.microsoft.sqlserver:mssql-jdbc:RELEASE[7.2.1.jre8]" bundle="!drivers.mssql.new"/>
<file type="jar" path="maven:/com.microsoft.sqlserver:mssql-jdbc:RELEASE[7.4.1.jre8]" bundle="!drivers.mssql.new"/>
<file type="jar" path="drivers/mssql/new/mssql-jdbc.jar" bundle="drivers.mssql.new"/>
<!-- Active directory auth -->
......@@ -289,7 +289,7 @@
<parameter name="native-format-time" value="''HH:mm:ss.SSS''"/>
<parameter name="script-delimiter-after-query" value="true"/>
<file type="jar" path="maven:/com.microsoft.sqlserver:mssql-jdbc:RELEASE[7.0.0.jre8]" bundle="!drivers.mssql.new"/>
<file type="jar" path="maven:/com.microsoft.sqlserver:mssql-jdbc:RELEASE[7.4.1.jre8]" bundle="!drivers.mssql.new"/>
<file type="lib" os="win32" arch="x86" path="repo:/drivers/mssql/auth/x86/sqljdbc_auth.dll" bundle="!drivers.mssql.new"/>
<file type="lib" os="win32" arch="x86_64" path="repo:/drivers/mssql/auth/x64/sqljdbc_auth.dll" bundle="!drivers.mssql.new"/>
......
package org.jkiss.dbeaver.ext.test;
import java.sql.*;
import java.util.Properties;
public class SQLServerFetchTest {
public static void main(String[] args) throws Exception {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
Properties props = new Properties();
props.put("integratedSecurity", "true");
Connection dbCon = DriverManager.getConnection("jdbc:sqlserver://;serverName=localhost;databaseName=master", props);
dbCon.setAutoCommit(false);
try (Statement dbStat = dbCon.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY)) {
int rsCount = 0;
if (dbStat.execute("sp_help TestTable")) {
dumpResultSet(dbStat, rsCount);
rsCount++;
}
while (dbStat.getMoreResults() || dbStat.getUpdateCount() != -1) {
dumpResultSet(dbStat, rsCount);
rsCount++;
}
System.out.println("Total result = " + rsCount);
}
}
public static void dumpResultSet(Statement dbStat, int number) throws SQLException {
System.out.println("================================================ " + number);
try (ResultSet dbResult = dbStat.getResultSet()) {
ResultSetMetaData md = dbResult.getMetaData();
int count = md.getColumnCount();
dumpResultSetMetaData(dbResult);
while (dbResult.next()) {
for (int i = 1; i <= count; i++) {
String colValue = dbResult.getString(i);
System.out.print(colValue + "\t");
}
System.out.println();
}
System.out.println();
} catch (SQLException e) {
e.printStackTrace();
}
}
public static void dumpResultSetMetaData(ResultSet dbResult)
{
try {
ResultSetMetaData md = dbResult.getMetaData();
int count = md.getColumnCount();
for (int i = 1; i <= count; i++) {
System.out.print(md.getColumnName(i) + " [" + md.getColumnTypeName(i) + "]\t");
}
System.out.println();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册