This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes JDBC for Android not connecting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC for Android not connecting" Watch "JDBC for Android not connecting" New topic
Author

JDBC for Android not connecting

ahsan jafri
Greenhorn

Joined: Dec 22, 2011
Posts: 1
I'm using the Microsoft SQL Server JDBC Driver 3.0 (I think it's the latest).

Here is my java (android) code:

Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
DriverManager.setLoginTimeout(120);
Connection conn = DriverManager.getConnection("jdbc:sqlserver://74.__.171.___:1433;DatabaseName=________;User=_____;Password=_____");

I have obviously underscored out some of the credentials. The SQL Server is 2008.

I am not able to connect, and the message I'm getting is the following:

com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host 74.__.171.___, port 1433 has failed. Error: "Permission denied. Verify the connection properties, check that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port, and that no firewall is blocking TCP connections to the port.". (I have underscored out some of the IP address of course).

Keep in mind, that I am using the android emulator, API level 8 (Android 2.2). Also, this database WORKS. I have tested the TCP/IP connection in management studio and it works within seconds. I have connected with the TCP/IP protocol with 3 different applications. It all works. PLEASE HELP!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDBC for Android not connecting
 
Similar Threads
SQLServerException - could not connect to the host on port 1433
connection to mssql server database
JDBC SQL Server 2008 Express Vista and XP
Trouble Connectiing
SQL Server - netbeans Connection problem