File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases 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 REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "JDBC for Android not connecting" Watch "JDBC for Android not connecting" New topic

JDBC for Android not connecting

ahsan jafri

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:

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: 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:
subject: JDBC for Android not connecting
It's not a secret anymore!