Click here to Skip to main content
14,299,986 members
Rate this:
Please Sign up or sign in to vote.
See more:
i successfully connect android to sql server and get data but i want also insert data in server database so any one give me code or tutorial.......
Posted
Comments
sureshpatelvora 3-Dec-13 6:35am
   
i want to retrive the data from sql server in android but i dont know php or .net any body can help me? any demo example?
Rate this:
Please Sign up or sign in to vote.

Solution 2

Hello Kishan,

I Suppose you must have used SQL Server JDBC Driver to connect to the SQL Server. This is not really a good way to communicate with the database from a mobile device. Connecting in this manner will actually expose your database over internet, which you may not really want. Suggest you to create simple web services (SOAP Or REST) and access those from the device. For REST+JSON services you can use DefaultHttpClient class available in Android SDK. You can even search[^] this very site to find some interesting articles describing this scenario.

Assuming that you still want to continue with the JDBC approach then where is the problem. You can always use Statement/PreparedStatement classes to fire your INSERT/UPDATE SQL's to get the job done.

Regards,
   
Comments
kishan dhingani 29-Jun-13 7:52am
   
i agree with u but i just try to connect jdbc so.....10x boss
kishan dhingani 29-Jun-13 7:54am
   
Prasad u have any working tutorial??
Prasad Khandekar 29-Jun-13 7:57am
   
I don't have a ready to share a tutorial, but the link shared in my solution will show you multiple articles some of them talk about webservices and some about consuming web services from android devices. You can actually combine the concepts shown in those articles and create your code.

Regards,

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100