Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I am impressed with this website so thought I may get some help from here

I am new to Android development try to do something on Android Studio

I need to connect SQL database 2012 from app
I have tried everything but nothing works.

Checks I have made
SQL Service and browser services are running
SQL config Manager - Protocol TCP/IP enabled, IPAll is set 1433
SQL Server allows remote connection
it has mix authentication (user + windows), I have tested
sqljdbc_auth and sqljdbc4 are in app folder and java folder.

Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); //(This Works)

String url = "jdbc:sqlserver://DBSPC\\SQL2012;databaseName=PFPRD;";
String url = "jdbc:sqlserver://localhost;databaseName=PFPRD;integratedSecurity=true";
String url = "jdbc:sqlserver://DBS-PC\\SQL2012;databaseName=PFPRD;user=android;password=jolly";

I have tried all different string as above

conn = DriverManager.getConnection(url);

it returns null

what could be the issue?, do I need to uninstall 2012 and get sql 2008
Please help
Posted
Updated 12-Mar-15 6:23am
v2
Comments
Peter Leow 12-Mar-15 21:14pm    
Try changing DBSPC to the sql server ip address.
However, you should consider having a web service to add as a broker between the android app and the sql server for security sake.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900