jTDS 1.2.7 and SQL Server 2000 Default instance
Asked By: Ennio
Originally Asked On: 2014-01-05 18:30:20
Asked Via: stackoverflow
a very simple snippet:
private static final String mydriver="net.sourceforge.jtds.jdbc.Driver"; private static final String myurl="jdbc:jtds:sqlserver://xx.xxx.xxx.xxx/myDatabase"; private Connection myconn; [stuff] public int connect(final String username,final String password){ try{ Class.forName(mydriver); myconn=DriverManager.getConnection(myurl,username,password); } catch (ClassNotFoundException e) { return 1; } catch (SQLException e) { return 2; } return 0; }
Note please, a number of points:
1. As a control, I have installed a very simple client called MSSQL Client by Pascal Nunes. It takes IP,DB,user,pwd and connects SUCCESSFULLY (without specifying port 1433). I have verified with Pascal himself, he is using jTDS 1.2.7, so I made sure my jTDS version was in line with his.
2. I have tried a number of parameters and parameter combinations, but nothing seems to work
3. I know neither the server nor the network can be responsible, since Pascal’s app works
4. Pascal’s app has “Full Network Access” according to my Nexus 7. I have given my app:
android.permission.INTERNET in the manifest. I don’t see any other permissions that might apply, but I’m new at this
5. Otherwise, there must be jTDS parameters that need to be morphed away from their default. If so, damned if I can find ’em.Any ideas?
He received 1 answers
without selecting any answers.
If the selected answer did not help you out, the other answers might!
All Answers For: jTDS 1.2.7 and SQL Server 2000 Default instance
nunespascal’s answer to
jTDS 1.2.7 and SQL Server 2000 Default instance
I am not sure if you still face this problem. Happened to find this question while searching for something else. But I believe I am the Pascal you mention and MSSQL client is the application you are referring to. I will try to answer your question as best I can:
jtds doesn’t require you to specify a port. 1433 is taken by default.
Building a connection string is very well documented for jtds. This is how I build the connection string:
String properties = ";domain=" + domain + ";user=" + id + ";password=" + pass; String conn = "jdbc:jtds:sqlserver://" + Server + "/" + Database + properties;
The app only needs network(android.permission.INTERNET) access.
Hope the answer helps you and others who come along.
Of course, you should really check out the original question.
The post jTDS 1.2.7 and SQL Server 2000 Default instance appeared first on Tech ABC to XYZ.