Saku
Saku

Reputation: 180

Error in Connection net.sourceforge.jtds.jdbc.Driver

I'm trying to connect to SQL-Server from android app using jtds.jdbc Driver i downloaded jtds.1.3.0 from here

When i added this jar file into my application and tried to connect from my app, it gave the following Error

Error in connection net.sourceforge.jtds.jdbc.Driver

Here is the Sample code which i'm trying to Connect

String driver = "net.sourceforge.jtds.jdbc.Driver";

Class.forName(driver).newInstance();//Here it's breaking and Giving The Exception

String connString = "jdbc:jtds:sqlserver://server_ip_address :1433/DBNAME;encrypt=fasle;user=xxxxxxxxx;password=xxxxxxxx;instance=SQLEXPRESS;";

String username = "xxxxxx";

String password = "xxxxxxxxxx";

conn = DriverManager.getConnection(connString,username,password);

Log.w("Connection","open");

Please Help me to solve the Issue.

Upvotes: 1

Views: 12586

Answers (2)

jac1013
jac1013

Reputation: 408

jtds 1.3.0 still has problem with android, use 1.2.7 or below instead, that would fix the ClassNotFoundException you are getting there (yes, that's the exception you are getting).

Upvotes: 2

Josh
Josh

Reputation: 1744

The JTDS library does not use the encrypt=true configuration element. Instead use the ssl=require or ssl=request options

Example:

jdbc:jtds:sqlserver://[SERVER]/[DATABASE];ssl=require;

Upvotes: 0

Related Questions