Skupiny Google už nepodporujú nové príspevky ani odbery Usenet. Historický obsah zostáva viditeľný.

Database:getColumns NullpointerException

42 zobrazení
Preskočiť na prvú neprečítanú správu

Rolf Gohla

neprečítané,
11. 3. 2002, 11:45:3211. 3. 2002
komu:
If i use as database collation name 'German_PhoneBbook_CS_AS' instead of
'Latin1_General_CI_AS', i get a null pointer exception during the execution
of the method DatabaseMetaData:getColumn().

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.

Sridhar Paladugu[MS]

neprečítané,
27. 3. 2002, 10:36:1827. 3. 2002
komu:
Hi,
the driver is not able to identify certain type of collations. We expect to fix
this by next RTM.

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>.


0 nových správ