0

I am attempting to using jTDS to connect to SQLServer 2000 in an Android application. I originally tried this using jTDS 1.3.1 but this resulted in class not found errors so I switched to 1.2.8. Now when I create my connection I receive the following exception when I try to create a connection:

10-14 14:04:07.812: W/System.err(15375): java.sql.SQLException: Charset 0x0404D00000/MS950 is not supported by the JVM.
10-14 14:04:07.822: W/System.err(15375):    at net.sourceforge.jtds.jdbc.ConnectionJDBC2.loadCharset(ConnectionJDBC2.java:1445)
10-14 14:04:07.822: W/System.err(15375):    at net.sourceforge.jtds.jdbc.ConnectionJDBC2.setCollation(ConnectionJDBC2.java:1525)
10-14 14:04:07.832: W/System.err(15375):    at net.sourceforge.jtds.jdbc.TdsCore.tdsEnvChangeToken(TdsCore.java:3285)
10-14 14:04:07.832: W/System.err(15375):    at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2352)
10-14 14:04:07.832: W/System.err(15375):    at net.sourceforge.jtds.jdbc.TdsCore.login(TdsCore.java:616)
10-14 14:04:07.832: W/System.err(15375):    at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:356)
10-14 14:04:07.832: W/System.err(15375):    at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:188)
10-14 14:04:07.832: W/System.err(15375):    at java.sql.DriverManager.getConnection(DriverManager.java:175)

I have seen similar errors elsewhere where the problem was a malformed JVM installation but as I am in an Android environment this does not make sense.

I also tried 1.2.7 given the asker's success in this question but it was to no avail.

EDIT :

Here is my calling code although I'm not sure it is helpful in decerning the problem. It is in an AsyncTask's doInBackground method:

if(this.sqlConnection==null){
    Properties connectionProps = new Properties();
    connectionProps.put("user", "sa");
    connectionProps.put("password", **REMOVED**);
    this.sqlConnection = DriverManager.getConnection("jdbc:jtds:sqlserver://192.100.100.6/MES", connectionProps);
    this.checkTestsStatement = this.sqlConnection.prepareStatement("SELECT TOP 10 * from ATE_Test_Log where EndTime < ?");
}
Community
  • 1
  • 1
Fr33dan
  • 4,227
  • 3
  • 35
  • 62
  • can you show the code where you tried to connect to local sqlserver db – Ranjit Oct 14 '13 at 18:23
  • @RanjitPati I have edited my question to include my code. – Fr33dan Oct 14 '13 at 18:28
  • check my answer here: http://stackoverflow.com/questions/14322135/is-there-a-way-to-access-mssql-database-directly-from-android-application/18402319#18402319 – Ranjit Oct 14 '13 at 18:30
  • @RanjitPati I do not see how your answer there does anything differently than I have. The only difference I see is that you use the `getConnection` implementation that takes the username and password instead of a [Properties](http://docs.oracle.com/javase/7/docs/api/java/util/Properties.html) object. Which if you look at the [source](http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/sql/DriverManager.java#DriverManager.getConnection%28java.lang.String%2Cjava.lang.String%2Cjava.lang.String%29) does exactly what I'm doing. I also tried it just to make sure. – Fr33dan Oct 14 '13 at 18:38
  • have you tried my code ??its good if you try it rather than differentiate. coz i know how the silly ignorance make the connection problem. hope you add the jtds lib in your lib folder and and use 10.0.2.2 as your host address for testing with emulator or bluestack.. – Ranjit Oct 14 '13 at 18:59
  • @RanjitPati Your comments are confusing to me. As best I can tell our code is the same. The jTDS library is in my libs and I know it is being reached or I would get a different error about not being able to find a driver (I have encountered and fixed this already). I would definitely not want to use 10.0.2.2 as my host address as that is not where the server is located. I am testing on a physical device (a Galaxy S3), not an emulator of any kind. – Fr33dan Oct 14 '13 at 19:11

0 Answers0