Here the source code of the test program:
package test;
import java.sql.*;
public class MSSql {
public static void main(String[] args) {
try {
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection c =
DriverManager.getConnection("jdbc:microsoft:sqlserver://xxx:1433", "xxx",
"xxx");
System.out.println("Retrieving column meta data");
DatabaseMetaData dbMetaData = c.getMetaData();
ResultSet rs= dbMetaData.getColumns(null, null, "%", "%");
while(rs.next()) {
System.out.print(".");
}
}
catch (Exception ex) {
ex.printStackTrace();
}
}
}
Below the outputs of two test runs using databases, which differs only in
the collation.
Newly created empty test database with collation 'Latin1_General_CI_AS'
program output:
Retrieving column meta data
............................................................................
.
Newly created empty test database with collation 'German_PhoneBbook_CS_AS'
program output:
Retrieving column meta data
java.lang.NullPointerException
at
com.microsoft.jdbc.sqlserver.tds.TDSConnection.getTransliteratorForCodePage(
Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processColMetaData(Unknown
Source)
at
com.microsoft.jdbc.sqlserver.tds.TDSExecuteRequest.processReplyToken(Unknown
Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
at
com.microsoft.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknow
n Source)
at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.executeQueryInternal(Unknown
Source)
at com.microsoft.jdbc.base.BaseStatement.executeQuery(Unknown Source)
at com.microsoft.jdbc.base.BaseDatabaseMetaData.getColumns(Unknown Source)
at test.MSSql.main(MSSql.java:13)
If tables exists in the database the exception occurrs anyway.
Thank you
Sridhar Paladugu
Microsoft Developer Support
JDBC Webdata
This posting is provided "AS IS" with no warranties, and confers no rights.
Are you secure? For information about the Strategic Technology Protection
Program and to order
your FREE Security Tool Kit, please visit
<http://www.microsoft.com/security>.