[android-developers] Re: Accessing External Database
Thanks for correcting me bob.. I saw so many mails regarding this JDBC drivers in stackoverflow.. I finally decided to use RESTful webservice instead of JDBC drivers.. I've gone through one example code at http://senior.ceng.metu.edu.tr/2009/praeda/2009/01/11/a-simple-restful-client-at-android/ In this he used to get the data from a stream.. But wgen i use with database it's not working.. How do i get the table names,column/row names, a particular key from a row/column present in the database?? Dont get angry for asking again again the same question.. is it possible by writing like this?? http://WebAddresss:Port_num/DATABASE_NAME/Table_name/ if im giving like this is it going to work properly??? Is it compulsory to use XML files with REST webservice?? Waiting for ur help... Cheers Uday Kiran Pichika Bob Kerns wrote: Brion gave some good suggestions, so let me address this from a more architectural standpoint. You don't WANT to access the tables direction. A web service acts as an intermediary -- it sits between your application and the database. This allows more control over how the application can access the information. You can limit the application to change only certain fields, or apply different security models. It also allows you to CHANGE your database. For example, to split a table into two linked tables to achieve better normalization. If the application could access the database directly, the SQL queries would need to change (especially for updates). You would face an impossible situation, as you simply cannot force people to upgrade their applications. This is perhaps the biggest reason why web services are so popular, and direct database connections are almost never used in end-user applications these days. It also allows better performance -- through caching, connection pooling, and other techniques. Database servers are simply not designed for huge numbers of connections. A web service has direct connections to the database. It has as much access to the tables as it needs. It's up to the web service what that data looks like to the client application, and how much access the client has. It can certainly present a model that parallels the database schema. With a RESTful interfaice, you could have URIs that denote tables, returning a list of URIs denoting primary keys in the table, and those URIs in turn would return the content of the rows, etc. But usually it makes more sense to operate at a somewhat higher level, where the URIs in the interface denote domain entities. For example, a music service might have URIs that denote albums, composers, artists, tracks, etc. Or, more likely, it would not have 'tracks' at all, and asking for an album would return EVERYTHING about the album that the application might need, because you can do that in a single step, without repeatedly asking the server. This allows much better scaling, and much better performance and reliability in the application, than asking for the same information one piece at a time. This is yet another example of why you want a web service, rather than accessing things at the database level. On a phone in particular, there is a lot of latency. Each time you ask a question, you have to wait for the information to flow both ways, and all those delays add up. The web service has very fast connection to the database, and can do all that quickly, so you only need to ask ONE question, and get a faster answer. When designing a web service, it is entirely up to you what form the data comes back in. You can construct whatever JSON or XML objects that are convenient representations for the data the service provides or uses. Whether you use JSONObject or an XML parser is up to you. From: uday kiran uday.pic...@gmail.com Date: Mar 22, 8:15 am Subject: Accessing External Database To: Android Developers So, if we r using RESTful webservice is it possible to access the Tables present in the database??? and doing some operations on the database i.e) Adding/Deleting a row/ column into the database table?? I saw one example which uses JSON Object for getting the stream.. So if i want to access databases which class we need to use?? If u have any related code regarding this please let me know... Expecting more information regarding example code... Thanks in advance --Cheers Uday Kiran Pichika -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: [android-developers] Re: Accessing External Database
uday kiran wrote: Thanks for correcting me bob.. I saw so many mails regarding this JDBC drivers in stackoverflow.. I finally decided to use RESTful webservice instead of JDBC drivers.. I've gone through one example code at http://senior.ceng.metu.edu.tr/2009/praeda/2009/01/11/a-simple-restful-client-at-android/ In this he used to get the data from a stream.. But wgen i use with database it's not working.. How do i get the table names,column/row names, a particular key from a row/column present in the database?? Dont get angry for asking again again the same question.. Too late. is it possible by writing like this?? http://WebAddresss:Port_num/DATABASE_NAME/Table_name/ if im giving like this is it going to work properly??? Is it compulsory to use XML files with REST webservice?? I would recommend you spend some time getting familiar with Web services, REST in particular. This is not a Web service or REST support group. There are 30 books on the subject, at least according to Amazon.com. I have read _RESTful Web Services_ and can recommend that one, but there are others. You might choose one specific to whatever programming language you are going to use to build the Web service. Of course, there is also an extensive Wikipedia article: http://en.wikipedia.org/wiki/Representational_State_Transfer And this white paper: http://home.ccil.org/~cowan/restws.pdf Among many other links available from your favorite search engine. There are also about 500 questions related to Web services out on StackOverflow. If, after you have a Web service that meets your needs, you have problems using it from Android, then come back here, or to StackOverflow, and we can try to help. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _Android Programming Tutorials_ Version 2.0 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
[android-developers] Re: Accessing External Database
I'll second Mark's advice about where to go for REST help. I've done my job here by pointing you away from JDBC on Android. Going to more appropriate sources of information for REST will help you a lot, because you'll get answers to questions you don't even know how to ask right now. Seriously, it will work a lot better for you to read a book, and to join a list or forum on the topic. It's a significant topic itself, so approach it that way instead of as a little Android task, and you'll get it a lot easier. Asking a question, and then waiting for us to answer, is a very inefficient way to learn! To answer the questions below -- your web service can work that way, if you code your web service to work that way. You can work at the level of tables and rows. But I really recommend using a higher-level abstraction relevant to your problem domain. You also don't have to use XML. You can use anything that makes sense. Images, audio, applications -- anything you might want to retrieve. This can make it very easy to integrate into a browser. It's one reason why I recommend REST over SOAP for most people. On Mar 25, 5:33 am, uday kiran uday.pic...@gmail.com wrote: Thanks for correcting me bob.. I saw so many mails regarding this JDBC drivers in stackoverflow.. I finally decided to use RESTful webservice instead of JDBC drivers.. I've gone through one example code athttp://senior.ceng.metu.edu.tr/2009/praeda/2009/01/11/a-simple-restfu... In this he used to get the data from a stream.. But wgen i use with database it's not working.. How do i get the table names,column/row names, a particular key from a row/column present in the database?? Dont get angry for asking again again the same question.. is it possible by writing like this?? http://WebAddresss:Port_num/DATABASE_NAME/Table_name/ if im giving like this is it going to work properly??? Is it compulsory to use XML files with REST webservice?? Waiting for ur help... Cheers Uday Kiran Pichika Bob Kerns wrote: Brion gave some good suggestions, so let me address this from a more architectural standpoint. You don't WANT to access the tables direction. A web service acts as an intermediary -- it sits between your application and the database. This allows more control over how the application can access the information. You can limit the application to change only certain fields, or apply different security models. It also allows you to CHANGE your database. For example, to split a table into two linked tables to achieve better normalization. If the application could access the database directly, the SQL queries would need to change (especially for updates). You would face an impossible situation, as you simply cannot force people to upgrade their applications. This is perhaps the biggest reason why web services are so popular, and direct database connections are almost never used in end-user applications these days. It also allows better performance -- through caching, connection pooling, and other techniques. Database servers are simply not designed for huge numbers of connections. A web service has direct connections to the database. It has as much access to the tables as it needs. It's up to the web service what that data looks like to the client application, and how much access the client has. It can certainly present a model that parallels the database schema. With a RESTful interfaice, you could have URIs that denote tables, returning a list of URIs denoting primary keys in the table, and those URIs in turn would return the content of the rows, etc. But usually it makes more sense to operate at a somewhat higher level, where the URIs in the interface denote domain entities. For example, a music service might have URIs that denote albums, composers, artists, tracks, etc. Or, more likely, it would not have 'tracks' at all, and asking for an album would return EVERYTHING about the album that the application might need, because you can do that in a single step, without repeatedly asking the server. This allows much better scaling, and much better performance and reliability in the application, than asking for the same information one piece at a time. This is yet another example of why you want a web service, rather than accessing things at the database level. On a phone in particular, there is a lot of latency. Each time you ask a question, you have to wait for the information to flow both ways, and all those delays add up. The web service has very fast connection to the database, and can do all that quickly, so you only need to ask ONE question, and get a faster answer. When designing a web service, it is entirely up to you what form the data comes back in. You can construct whatever JSON or XML objects that are convenient representations for the data the service provides or uses. Whether you use JSONObject or an XML parser is
[android-developers] Re: Accessing External Database
Brion gave some good suggestions, so let me address this from a more architectural standpoint. You don't WANT to access the tables direction. A web service acts as an intermediary -- it sits between your application and the database. This allows more control over how the application can access the information. You can limit the application to change only certain fields, or apply different security models. It also allows you to CHANGE your database. For example, to split a table into two linked tables to achieve better normalization. If the application could access the database directly, the SQL queries would need to change (especially for updates). You would face an impossible situation, as you simply cannot force people to upgrade their applications. This is perhaps the biggest reason why web services are so popular, and direct database connections are almost never used in end-user applications these days. It also allows better performance -- through caching, connection pooling, and other techniques. Database servers are simply not designed for huge numbers of connections. A web service has direct connections to the database. It has as much access to the tables as it needs. It's up to the web service what that data looks like to the client application, and how much access the client has. It can certainly present a model that parallels the database schema. With a RESTful interfaice, you could have URIs that denote tables, returning a list of URIs denoting primary keys in the table, and those URIs in turn would return the content of the rows, etc. But usually it makes more sense to operate at a somewhat higher level, where the URIs in the interface denote domain entities. For example, a music service might have URIs that denote albums, composers, artists, tracks, etc. Or, more likely, it would not have 'tracks' at all, and asking for an album would return EVERYTHING about the album that the application might need, because you can do that in a single step, without repeatedly asking the server. This allows much better scaling, and much better performance and reliability in the application, than asking for the same information one piece at a time. This is yet another example of why you want a web service, rather than accessing things at the database level. On a phone in particular, there is a lot of latency. Each time you ask a question, you have to wait for the information to flow both ways, and all those delays add up. The web service has very fast connection to the database, and can do all that quickly, so you only need to ask ONE question, and get a faster answer. When designing a web service, it is entirely up to you what form the data comes back in. You can construct whatever JSON or XML objects that are convenient representations for the data the service provides or uses. Whether you use JSONObject or an XML parser is up to you. From: uday kiran uday.pic...@gmail.com Date: Mar 22, 8:15 am Subject: Accessing External Database To: Android Developers So, if we r using RESTful webservice is it possible to access the Tables present in the database??? and doing some operations on the database i.e) Adding/Deleting a row/ column into the database table?? I saw one example which uses JSON Object for getting the stream.. So if i want to access databases which class we need to use?? If u have any related code regarding this please let me know... Expecting more information regarding example code... Thanks in advance --Cheers Uday Kiran Pichika -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
[android-developers] Re: Accessing External Database
So, if we r using RESTful webservice is it possible to access the Tables present in the database??? and doing some operations on the database i.e) Adding/Deleting a row/ column into the database table?? I saw one example which uses JSON Object for getting the stream.. So if i want to access databases which class we need to use?? If u have any related code regarding this please let me know... Expecting more information regarding example code... Thanks in advance --Cheers Uday Kiran Pichika On Mar 19, 8:22 pm, Bob Kerns r...@acm.org wrote: No, you get a different set of headaches. Drivers (e.g. JDBC drivers) are not intended for this sort of application. You will have reliability problems, security problems, performance problems, problems upgrading your server once you have clients talking to it, because you can't upgrade all your clients at once, etc. You'll also have the problems getting the drivers to work on the Android platform, which lacks support for database drivers. I think it's probably possible to do, but since it's not a good thing to do, I don't know of anyone who has succeeded. I've seen a lot of messages from people who have tried and failed. Drivers are much too closely coupled to the database. A competent system administrator WILL NOT ALLOW YOU ACCESS to databases from outside their firewalls, for security reasons. You will normally would use database drivers when implementing the web server. Sqlite is an embedded server with its own API, but you could consider that a type of driver as well. But as I said earlier, a non-Sqlite database, such as MySQL, would be a far better choice for performance, scalability, and reliability reasons. Unfortunately, that means yet more stuff to learn. Fortunately, it's mostly fairly standard stuff, so you'll get to use what you learn later in your career -- but it's still something you'll need to learn up front. None of these things are that hard to learn, but it's a lot to learn all at once. Especially if you expected to do things one way, and are told you have to do them a different way. It'll be hard to switch your way of thinking. On Mar 19, 7:03 am, uday kiran uday.pic...@gmail.com wrote: Hey Bob,, Tell me one thing...instead of using Webservices,it is easy if we r using Drivers.. If we know which type of database they r using on server side,then we can access that database using related driver...so that the headache willl be reduced am i right??? what is the difference of using driver in place of Webservices On Mar 19, 1:16 am, Bob Kerns r...@acm.org wrote: On Mar 18, 2:37 am, uday kiran uday.pic...@gmail.com wrote: - So for communicatingdatabase(On remote server) from our application - it is compulsory to write a driver like odbc??? No, ODBC (or JDBC) is at the wrong level. You do not want to be doing SQL over the network. Instead, you want to create a web server that does the SQL -- and you just ask it questions (via HTTP GET) or give it commands (PUT, POST, DELETE). If you already know Java well, a Java Servlet would be the easiest way to go -- running in a servlet engine line Tomcat. Tools like Ruby on Rails are supposed to make this even easier, but will involve learning a new language. You're going to have to go and do some studying, and look at a number of examples. I'm not going to look for a pointer to an example for you, because if you do it yourself, you can chose ones that more closely relate to what you're trying to do, or better fit your style of learning. But you can start on the server side by writing a unit test that simply takes a URL, interprets the parameters, and does the corresponding SQL query, and returns the result as either XML or JSON. Once you have that, it's a simple matter to embed that in the appropriate bit of code for your web server technology (e.g. a Servlet, in the case of Java). The client side just requests the data from that URL and reads it. Once you get that far for one kind of data, and the GET operation, the next steps will be both easier and more clear to you. Part of your problem right now is you're trying to deal with the entire question at once. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
[android-developers] Re: Accessing External Database
I recommend that you take a look at an existing RESTful implementation and see how that works and you may be able to see how to do what you are doing. I think a beautiful example of RESTful architecture is that provided by Twitter. You can browse the Twitter API WIKI at: http://apiwiki.twitter.com/ And specifically the Getting Started section: http://apiwiki.twitter.com/Getting-Started There they explain how their RESTful implementation is Http based and you can find links that will take into greater and greater detail. That should give you lots of ideas. On Mar 22, 9:15 am, uday kiran uday.pic...@gmail.com wrote: So, if we r using RESTful webservice is it possible to access the Tables present in the database??? and doing some operations on the database i.e) Adding/Deleting a row/ column into the database table?? I saw one example which uses JSON Object for getting the stream.. So if i want to access databases which class we need to use?? If u have any related code regarding this please let me know... Expecting more information regarding example code... Thanks in advance --Cheers Uday Kiran Pichika On Mar 19, 8:22 pm, Bob Kerns r...@acm.org wrote: No, you get a different set of headaches. Drivers (e.g. JDBC drivers) are not intended for this sort of application. You will have reliability problems, security problems, performance problems, problems upgrading your server once you have clients talking to it, because you can't upgrade all your clients at once, etc. You'll also have the problems getting the drivers to work on the Android platform, which lacks support for database drivers. I think it's probably possible to do, but since it's not a good thing to do, I don't know of anyone who has succeeded. I've seen a lot of messages from people who have tried and failed. Drivers are much too closely coupled to the database. A competent system administrator WILL NOT ALLOW YOU ACCESS to databases from outside their firewalls, for security reasons. You will normally would use database drivers when implementing the web server. Sqlite is an embedded server with its own API, but you could consider that a type of driver as well. But as I said earlier, a non-Sqlite database, such as MySQL, would be a far better choice for performance, scalability, and reliability reasons. Unfortunately, that means yet more stuff to learn. Fortunately, it's mostly fairly standard stuff, so you'll get to use what you learn later in your career -- but it's still something you'll need to learn up front. None of these things are that hard to learn, but it's a lot to learn all at once. Especially if you expected to do things one way, and are told you have to do them a different way. It'll be hard to switch your way of thinking. On Mar 19, 7:03 am, uday kiran uday.pic...@gmail.com wrote: Hey Bob,, Tell me one thing...instead of using Webservices,it is easy if we r using Drivers.. If we know which type of database they r using on server side,then we can access that database using related driver...so that the headache willl be reduced am i right??? what is the difference of using driver in place of Webservices On Mar 19, 1:16 am, Bob Kerns r...@acm.org wrote: On Mar 18, 2:37 am, uday kiran uday.pic...@gmail.com wrote: - So for communicatingdatabase(On remote server) from our application - it is compulsory to write a driver like odbc??? No, ODBC (or JDBC) is at the wrong level. You do not want to be doing SQL over the network. Instead, you want to create a web server that does the SQL -- and you just ask it questions (via HTTP GET) or give it commands (PUT, POST, DELETE). If you already know Java well, a Java Servlet would be the easiest way to go -- running in a servlet engine line Tomcat. Tools like Ruby on Rails are supposed to make this even easier, but will involve learning a new language. You're going to have to go and do some studying, and look at a number of examples. I'm not going to look for a pointer to an example for you, because if you do it yourself, you can chose ones that more closely relate to what you're trying to do, or better fit your style of learning. But you can start on the server side by writing a unit test that simply takes a URL, interprets the parameters, and does the corresponding SQL query, and returns the result as either XML or JSON. Once you have that, it's a simple matter to embed that in the appropriate bit of code for your web server technology (e.g. a Servlet, in the case of Java). The client side just requests the data from that URL and reads it. Once you get that far for one kind of data, and the GET operation, the next steps will be both easier and more clear to you. Part of your problem right now is you're trying to deal with the entire question at once. --
[android-developers] Re: Accessing External Database
Hey Bob,, Tell me one thing...instead of using Webservices,it is easy if we r using Drivers.. If we know which type of database they r using on server side,then we can access that database using related driver...so that the headache willl be reduced am i right??? what is the difference of using driver in place of Webservices On Mar 19, 1:16 am, Bob Kerns r...@acm.org wrote: On Mar 18, 2:37 am, uday kiran uday.pic...@gmail.com wrote: - So for communicatingdatabase(On remote server) from our application - it is compulsory to write a driver like odbc??? No, ODBC (or JDBC) is at the wrong level. You do not want to be doing SQL over the network. Instead, you want to create a web server that does the SQL -- and you just ask it questions (via HTTP GET) or give it commands (PUT, POST, DELETE). If you already know Java well, a Java Servlet would be the easiest way to go -- running in a servlet engine line Tomcat. Tools like Ruby on Rails are supposed to make this even easier, but will involve learning a new language. You're going to have to go and do some studying, and look at a number of examples. I'm not going to look for a pointer to an example for you, because if you do it yourself, you can chose ones that more closely relate to what you're trying to do, or better fit your style of learning. But you can start on the server side by writing a unit test that simply takes a URL, interprets the parameters, and does the corresponding SQL query, and returns the result as either XML or JSON. Once you have that, it's a simple matter to embed that in the appropriate bit of code for your web server technology (e.g. a Servlet, in the case of Java). The client side just requests the data from that URL and reads it. Once you get that far for one kind of data, and the GET operation, the next steps will be both easier and more clear to you. Part of your problem right now is you're trying to deal with the entire question at once. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
[android-developers] Re: Accessing External Database
No, you get a different set of headaches. Drivers (e.g. JDBC drivers) are not intended for this sort of application. You will have reliability problems, security problems, performance problems, problems upgrading your server once you have clients talking to it, because you can't upgrade all your clients at once, etc. You'll also have the problems getting the drivers to work on the Android platform, which lacks support for database drivers. I think it's probably possible to do, but since it's not a good thing to do, I don't know of anyone who has succeeded. I've seen a lot of messages from people who have tried and failed. Drivers are much too closely coupled to the database. A competent system administrator WILL NOT ALLOW YOU ACCESS to databases from outside their firewalls, for security reasons. You will normally would use database drivers when implementing the web server. Sqlite is an embedded server with its own API, but you could consider that a type of driver as well. But as I said earlier, a non-Sqlite database, such as MySQL, would be a far better choice for performance, scalability, and reliability reasons. Unfortunately, that means yet more stuff to learn. Fortunately, it's mostly fairly standard stuff, so you'll get to use what you learn later in your career -- but it's still something you'll need to learn up front. None of these things are that hard to learn, but it's a lot to learn all at once. Especially if you expected to do things one way, and are told you have to do them a different way. It'll be hard to switch your way of thinking. On Mar 19, 7:03 am, uday kiran uday.pic...@gmail.com wrote: Hey Bob,, Tell me one thing...instead of using Webservices,it is easy if we r using Drivers.. If we know which type of database they r using on server side,then we can access that database using related driver...so that the headache willl be reduced am i right??? what is the difference of using driver in place of Webservices On Mar 19, 1:16 am, Bob Kerns r...@acm.org wrote: On Mar 18, 2:37 am, uday kiran uday.pic...@gmail.com wrote: - So for communicatingdatabase(On remote server) from our application - it is compulsory to write a driver like odbc??? No, ODBC (or JDBC) is at the wrong level. You do not want to be doing SQL over the network. Instead, you want to create a web server that does the SQL -- and you just ask it questions (via HTTP GET) or give it commands (PUT, POST, DELETE). If you already know Java well, a Java Servlet would be the easiest way to go -- running in a servlet engine line Tomcat. Tools like Ruby on Rails are supposed to make this even easier, but will involve learning a new language. You're going to have to go and do some studying, and look at a number of examples. I'm not going to look for a pointer to an example for you, because if you do it yourself, you can chose ones that more closely relate to what you're trying to do, or better fit your style of learning. But you can start on the server side by writing a unit test that simply takes a URL, interprets the parameters, and does the corresponding SQL query, and returns the result as either XML or JSON. Once you have that, it's a simple matter to embed that in the appropriate bit of code for your web server technology (e.g. a Servlet, in the case of Java). The client side just requests the data from that URL and reads it. Once you get that far for one kind of data, and the GET operation, the next steps will be both easier and more clear to you. Part of your problem right now is you're trying to deal with the entire question at once. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
[android-developers] Re: Accessing External Database
OK, it seems there's several things going on here. From your URL, it looks like you can download a copy of a sqllite database file. If this is just static content, that you're treating as a document -- then you don't need any of what I've been talking about so far. At this level, you have a file. You just copy it locally, perhaps to your SD card, and then access it using Android's built-in sqllite interfaces. You CANNOT access directly over the network this way. Sqllite depends on being able to manage concurrency, and update individual pages within the database file. It cannot do these things over an HTTP connection -- and shouldn't try to do it over any other kind of network connection, either. But once you have copied it to a local file, Android's sqllite should be able to work on it directly. If you make changes, you can save it over the network, treating it like any other docuument. But that's not really using it as a database in the usual sense of live shared data. It's a good approach, however, for static data, such as historical records. For example, baseball statistics for a specific year. On the other hand, if you want to be able to access the data simultaneously from multiple applications, and at least one process somewhere is making changes, then you DO need a shared database, and you DO want to expose it as a web service. Examples would be contacts databases, current sales figures, stock price tickers, etc. How I'd start, is to identify each logical kind of object, and define URL's to refer to each of them, and to each collection of them. These can be explicit entities in your database, or they can be the results of queries, where the query is encoded in the URL. Then I'd identify the data content of these, and write code to encode each entity into this format. I'd pick either JSON or XML as a base for my data format, just because they're readily available on most platforms. Then I'd define the operations on this data. I'm afraid I've been around this stuff to have a good beginning reference to suggest. But I will point out that the content: URIs used by the provider interface generally follow this pattern, so you can look at how the contacts provider has been designed. In terms of the actual mechanics, an HTTP-based RESTful interface uses regular HTTP connections and operations. The REST pattern is just an effective way to use HTTP to build a web application. On Mar 17, 9:40 pm, uday kiran uday.pic...@gmail.com wrote: Thanks Bob, I got very good information from this... Let me explain thing i want to do.. There is a database present at some IPhttp://10.117.23.45/databases/database.db I want to access this database from my android application.. for this im using HttpURLConnection interface.. The way that im accessing the database is fine r not try { URL url = new URL(http://www.uploadhub.com/mobile9/ gallery/gallery_android/); HttpURLConnection conn = (HttpURLConnection)url.openConnection(); conn.setDoInput(true); conn.setDoOutput(true); conn.setUseCaches(false); conn.setRequestMethod(POST); } The code above i have given is some sample only.. As u said how to implement RESTful interface instead of doing this?? If u have any idea of code please let me know... Thanks for the information in advance.. Cheers Uday On Mar 18, 4:26 am, Bob Kerns r...@acm.org wrote: Please don't do this. You really, really don't want to do this. I've written about this before -- it's the wrong way for a lot of reasons -- security, interoperability, performance, maintainability, upgradability, compatibility with firewalls... What you want to do instead, is to build a web service, that exposes the proper functionality. I'd suggest a RESTful interface (google it; there are lots of examples and documents available), as it's more flexible and simpler than SOAP. You don't even want to expose yourdatabaseserver to the internet. It should be securely behind a firewall. And think about what happens when you want to change yourdatabase, and you have all these applications out there, expecting to be able to use specific SQL queries to get at the data. You cannot force users to upgrade. You can just break, of course -- but you'll lose a lot of customers, and a lot of them will tell other customers to stay away -- and they'd be right. Actually, I just saw the message that says you're using Sqllite. So you CAN'T even do it anyway, even if you wanted to. There is no network access to Sqllite. I'd saw sqllite isn't a good choice for a server application in any event. I'd suggest MySQL as an alternative. To quote the sqllite documentation: On the other hand, adatabaseengine that uses a server can provide better protection from bugs in the client application - stray pointers in a client cannot corrupt memory on
[android-developers] Re: Accessing External Database
On Mar 18, 11:49 am, Bob Kerns r...@acm.org wrote: OK, it seems there's several things going on here. From your URL, it looks like you can download a copy of a sqllitedatabasefile. If this is just static content, that you're treating as a document -- then you don't need any of what I've been talking about so far. At this level, you have a file. You just copy it locally, perhaps to your SD card, and then access it using Android's built-in sqllite interfaces. You CANNOT access directly over the network this way. Sqllite depends on being able to manage concurrency, and update individual pages within thedatabasefile. It cannot do these things over an HTTP connection -- and shouldn't try to do it over any other kind of network connection, either. So SQlite can't use over networks for accessing database... I dont want to save this database file into my local folder..i want to change the contents in the file by online.. But once you have copied it to a local file, Android's sqllite should be able to work on it directly. If you make changes, you can save it over the network, treating it like any other docuument. This is not a good idea to use as a document.. But that's not really using it as adatabasein the usual sense of live shared data. It's a good approach, however, for static data, such as historical records. For example, baseball statistics for a specific year. On the other hand, if you want to be able to access the data simultaneously from multiple applications, and at least one process somewhere is making changes, then you DO need a shareddatabase, and you DO want to expose it as a web service. Examples would be contacts databases, current sales figures, stock price tickers, etc. How to expose any database as a webservice?? If u have any example code pls provide me..because im new to android as well as database concepts.. Thats y i dont have clear idea on this.. How I'd start, is to identify each logical kind of object, and define URL's to refer to each of them, and to each collection of them. These can be explicit entities in yourdatabase, or they can be the results of queries, where the query is encoded in the URL. Then I'd identify the data content of these, and write code to encode each entity into this format. I'd pick either JSON or XML as a base for my data format, just because they're readily available on most platforms. So for communicating database(On remote server) from our application it is compulsory to write a driver like odbc??? Then I'd define the operations on this data. I'm afraid I've been around this stuff to have a good beginning reference to suggest. But I will point out that the content: URIs used by the provider interface generally follow this pattern, so you can look at how the contacts provider has been designed. In terms of the actual mechanics, an HTTP-based RESTful interface uses regular HTTP connections and operations. The REST pattern is just an effective way to use HTTP to build a web application. On Mar 17, 9:40 pm, uday kiran uday.pic...@gmail.com wrote: Thanks Bob, I got very good information from this... Let me explain thing i want to do.. There is adatabasepresent at some IPhttp://10.117.23.45/databases/database.db I want to access thisdatabasefrom my android application.. for this im using HttpURLConnection interface.. The way that imaccessingthedatabaseis fine r not try { URL url = new URL(http://www.uploadhub.com/mobile9/ gallery/gallery_android/); HttpURLConnection conn = (HttpURLConnection)url.openConnection(); conn.setDoInput(true); conn.setDoOutput(true); conn.setUseCaches(false); conn.setRequestMethod(POST); } The code above i have given is some sample only.. As u said how to implement RESTful interface instead of doing this?? If u have any idea of code please let me know... Thanks for the information in advance.. Cheers Uday On Mar 18, 4:26 am, Bob Kerns r...@acm.org wrote: Please don't do this. You really, really don't want to do this. I've written about this before -- it's the wrong way for a lot of reasons -- security, interoperability, performance, maintainability, upgradability, compatibility with firewalls... What you want to do instead, is to build a web service, that exposes the proper functionality. I'd suggest a RESTful interface (google it; there are lots of examples and documents available), as it's more flexible and simpler than SOAP. You don't even want to expose yourdatabaseserver to the internet. It should be securely behind a firewall. And think about what happens when you want to change yourdatabase, and you have all these applications out there, expecting to be able to use specific SQL queries to get at the data. You cannot force users to upgrade. You can
[android-developers] Re: Accessing External Database
Look at line 395 of this sql access. It hits a php file I can send you if you go this route. Good Luck. jp http://code.google.com/p/speedlimit/source/browse/BackSeatDriverV-X-Ship-Pulp/src/org/wikispeedia/backseatdriverV/TranslateTask.java -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Accessing External Database
On Mar 18, 2:37 am, uday kiran uday.pic...@gmail.com wrote: - So for communicating database(On remote server) from our application - it is compulsory to write a driver like odbc??? No, ODBC (or JDBC) is at the wrong level. You do not want to be doing SQL over the network. Instead, you want to create a web server that does the SQL -- and you just ask it questions (via HTTP GET) or give it commands (PUT, POST, DELETE). If you already know Java well, a Java Servlet would be the easiest way to go -- running in a servlet engine line Tomcat. Tools like Ruby on Rails are supposed to make this even easier, but will involve learning a new language. You're going to have to go and do some studying, and look at a number of examples. I'm not going to look for a pointer to an example for you, because if you do it yourself, you can chose ones that more closely relate to what you're trying to do, or better fit your style of learning. But you can start on the server side by writing a unit test that simply takes a URL, interprets the parameters, and does the corresponding SQL query, and returns the result as either XML or JSON. Once you have that, it's a simple matter to embed that in the appropriate bit of code for your web server technology (e.g. a Servlet, in the case of Java). The client side just requests the data from that URL and reads it. Once you get that far for one kind of data, and the GET operation, the next steps will be both easier and more clear to you. Part of your problem right now is you're trying to deal with the entire question at once. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
[android-developers] Re: Accessing External Database
Thanks for ur quick reply jim.. I want to access an existing database which is present on some server.. Cheers Uday On Mar 17, 6:51 pm, Jim Blackler jimblack...@gmail.com wrote: Hi Uday Is there an existing, specific external database that you wish to access? Or do you wish to set up a new database? Jim On 17 March 2010 13:32, uday kiran uday.pic...@gmail.com wrote: Hi folks, Im new bie to android.. i want to access external database from my android application.. I've searched so much time in the internet but could not get exact idea how to implement?? Please help me If any one is having idea on that and post if u have any code related to it... Thanks for the information in advance.. Cheers Uday -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Accessing External Database
OK what can you tell us about this database. Is it on the internet? What software is it running? On 17 March 2010 13:54, uday kiran uday.pic...@gmail.com wrote: Thanks for ur quick reply jim.. I want to access an existing database which is present on some server.. Cheers Uday On Mar 17, 6:51 pm, Jim Blackler jimblack...@gmail.com wrote: Hi Uday Is there an existing, specific external database that you wish to access? Or do you wish to set up a new database? Jim On 17 March 2010 13:32, uday kiran uday.pic...@gmail.com wrote: Hi folks, Im new bie to android.. i want to access external database from my android application.. I've searched so much time in the internet but could not get exact idea how to implement?? Please help me If any one is having idea on that and post if u have any code related to it... Thanks for the information in advance.. Cheers Uday -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Accessing External Database
YES..The database is present on the internet only.. The database should be in SQLite..OS is windows.. On Mar 17, 6:59 pm, Jim Blackler jimblack...@gmail.com wrote: OK what can you tell us about this database. Is it on the internet? What software is it running? On 17 March 2010 13:54, uday kiran uday.pic...@gmail.com wrote: Thanks for ur quick reply jim.. I want to access an existing database which is present on some server.. Cheers Uday On Mar 17, 6:51 pm, Jim Blackler jimblack...@gmail.com wrote: Hi Uday Is there an existing, specific external database that you wish to access? Or do you wish to set up a new database? Jim On 17 March 2010 13:32, uday kiran uday.pic...@gmail.com wrote: Hi folks, Im new bie to android.. i want to access external database from my android application.. I've searched so much time in the internet but could not get exact idea how to implement?? Please help me If any one is having idea on that and post if u have any code related to it... Thanks for the information in advance.. Cheers Uday -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en-Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Accessing External Database
As of my knowledge in android we use HttpURLConnection to connect to the database in the internet.. am i right Jim?? On Mar 17, 7:05 pm, uday kiran uday.pic...@gmail.com wrote: YES..The database is present on the internet only.. The database should be in SQLite..OS is windows.. On Mar 17, 6:59 pm, Jim Blackler jimblack...@gmail.com wrote: OK what can you tell us about this database. Is it on the internet? What software is it running? On 17 March 2010 13:54, uday kiran uday.pic...@gmail.com wrote: Thanks for ur quick reply jim.. I want to access an existing database which is present on some server.. Cheers Uday On Mar 17, 6:51 pm, Jim Blackler jimblack...@gmail.com wrote: Hi Uday Is there an existing, specific external database that you wish to access? Or do you wish to set up a new database? Jim On 17 March 2010 13:32, uday kiran uday.pic...@gmail.com wrote: Hi folks, Im new bie to android.. i want to access external database from my android application.. I've searched so much time in the internet but could not get exact idea how to implement?? Please help me If any one is having idea on that and post if u have any code related to it... Thanks for the information in advance.. Cheers Uday -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en-Hidequoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en-Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Accessing External Database
Provided the database exposes an HTTP-based API, yes. On 17 March 2010 14:09, uday kiran uday.pic...@gmail.com wrote: As of my knowledge in android we use HttpURLConnection to connect to the database in the internet.. am i right Jim?? On Mar 17, 7:05 pm, uday kiran uday.pic...@gmail.com wrote: YES..The database is present on the internet only.. The database should be in SQLite..OS is windows.. On Mar 17, 6:59 pm, Jim Blackler jimblack...@gmail.com wrote: OK what can you tell us about this database. Is it on the internet? What software is it running? On 17 March 2010 13:54, uday kiran uday.pic...@gmail.com wrote: Thanks for ur quick reply jim.. I want to access an existing database which is present on some server.. Cheers Uday On Mar 17, 6:51 pm, Jim Blackler jimblack...@gmail.com wrote: Hi Uday Is there an existing, specific external database that you wish to access? Or do you wish to set up a new database? Jim On 17 March 2010 13:32, uday kiran uday.pic...@gmail.com wrote: Hi folks, Im new bie to android.. i want to access external database from my android application.. I've searched so much time in the internet but could not get exact idea how to implement?? Please help me If any one is having idea on that and post if u have any code related to it... Thanks for the information in advance.. Cheers Uday -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en-Hidequoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en-Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Accessing External Database
OK... u have any example code which is used to work on this concept?? On Mar 17, 7:11 pm, Jim Blackler jimblack...@gmail.com wrote: Provided the database exposes an HTTP-based API, yes. On 17 March 2010 14:09, uday kiran uday.pic...@gmail.com wrote: As of my knowledge in android we use HttpURLConnection to connect to the database in the internet.. am i right Jim?? On Mar 17, 7:05 pm, uday kiran uday.pic...@gmail.com wrote: YES..The database is present on the internet only.. The database should be in SQLite..OS is windows.. On Mar 17, 6:59 pm, Jim Blackler jimblack...@gmail.com wrote: OK what can you tell us about this database. Is it on the internet? What software is it running? On 17 March 2010 13:54, uday kiran uday.pic...@gmail.com wrote: Thanks for ur quick reply jim.. I want to access an existing database which is present on some server.. Cheers Uday On Mar 17, 6:51 pm, Jim Blackler jimblack...@gmail.com wrote: Hi Uday Is there an existing, specific external database that you wish to access? Or do you wish to set up a new database? Jim On 17 March 2010 13:32, uday kiran uday.pic...@gmail.com wrote: Hi folks, Im new bie to android.. i want to access external database from my android application.. I've searched so much time in the internet but could not get exact idea how to implement?? Please help me If any one is having idea on that and post if u have any code related to it... Thanks for the information in advance.. Cheers Uday -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en-Hidequoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en-Hidequoted text - - Show quoted text -- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Accessing External Database
Hi Uday, I have to bow out here because this is too general a question for this list really. There are a great many ways to do what you are describing. I'd recommend getting a textbook or two on the topic. On 17 March 2010 14:13, uday kiran uday.pic...@gmail.com wrote: OK... u have any example code which is used to work on this concept?? On Mar 17, 7:11 pm, Jim Blackler jimblack...@gmail.com wrote: Provided the database exposes an HTTP-based API, yes. On 17 March 2010 14:09, uday kiran uday.pic...@gmail.com wrote: As of my knowledge in android we use HttpURLConnection to connect to the database in the internet.. am i right Jim?? On Mar 17, 7:05 pm, uday kiran uday.pic...@gmail.com wrote: YES..The database is present on the internet only.. The database should be in SQLite..OS is windows.. On Mar 17, 6:59 pm, Jim Blackler jimblack...@gmail.com wrote: OK what can you tell us about this database. Is it on the internet? What software is it running? On 17 March 2010 13:54, uday kiran uday.pic...@gmail.com wrote: Thanks for ur quick reply jim.. I want to access an existing database which is present on some server.. Cheers Uday On Mar 17, 6:51 pm, Jim Blackler jimblack...@gmail.com wrote: Hi Uday Is there an existing, specific external database that you wish to access? Or do you wish to set up a new database? Jim On 17 March 2010 13:32, uday kiran uday.pic...@gmail.com wrote: Hi folks, Im new bie to android.. i want to access external database from my android application.. I've searched so much time in the internet but could not get exact idea how to implement?? Please help me If any one is having idea on that and post if u have any code related to it... Thanks for the information in advance.. Cheers Uday -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en-Hidequoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en-Hidequoted text - - Show quoted text -- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Accessing External Database
okk. i may get the quick reference if i go to http://developer.android.com site?? Where this funtionality is to be added in android code?? in onCreate() method? On Mar 17, 7:16 pm, Jim Blackler jimblack...@gmail.com wrote: Hi Uday, I have to bow out here because this is too general a question for this list really. There are a great many ways to do what you are describing. I'd recommend getting a textbook or two on the topic. On 17 March 2010 14:13, uday kiran uday.pic...@gmail.com wrote: OK... u have any example code which is used to work on this concept?? On Mar 17, 7:11 pm, Jim Blackler jimblack...@gmail.com wrote: Provided the database exposes an HTTP-based API, yes. On 17 March 2010 14:09, uday kiran uday.pic...@gmail.com wrote: As of my knowledge in android we use HttpURLConnection to connect to the database in the internet.. am i right Jim?? On Mar 17, 7:05 pm, uday kiran uday.pic...@gmail.com wrote: YES..The database is present on the internet only.. The database should be in SQLite..OS is windows.. On Mar 17, 6:59 pm, Jim Blackler jimblack...@gmail.com wrote: OK what can you tell us about this database. Is it on the internet? What software is it running? On 17 March 2010 13:54, uday kiran uday.pic...@gmail.com wrote: Thanks for ur quick reply jim.. I want to access an existing database which is present on some server.. Cheers Uday On Mar 17, 6:51 pm, Jim Blackler jimblack...@gmail.com wrote: Hi Uday Is there an existing, specific external database that you wish to access? Or do you wish to set up a new database? Jim On 17 March 2010 13:32, uday kiran uday.pic...@gmail.com wrote: Hi folks, Im new bie to android.. i want to access external database from my android application.. I've searched so much time in the internet but could not get exact idea how to implement?? Please help me If any one is having idea on that and post if u have any code related to it... Thanks for the information in advance.. Cheers Uday -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en-Hidequoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en-Hidequoted text - - Show quoted text -- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en-Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at
[android-developers] Re: Accessing External Database
Please don't do this. You really, really don't want to do this. I've written about this before -- it's the wrong way for a lot of reasons -- security, interoperability, performance, maintainability, upgradability, compatibility with firewalls... What you want to do instead, is to build a web service, that exposes the proper functionality. I'd suggest a RESTful interface (google it; there are lots of examples and documents available), as it's more flexible and simpler than SOAP. You don't even want to expose your database server to the internet. It should be securely behind a firewall. And think about what happens when you want to change your database, and you have all these applications out there, expecting to be able to use specific SQL queries to get at the data. You cannot force users to upgrade. You can just break, of course -- but you'll lose a lot of customers, and a lot of them will tell other customers to stay away -- and they'd be right. Actually, I just saw the message that says you're using Sqllite. So you CAN'T even do it anyway, even if you wanted to. There is no network access to Sqllite. I'd saw sqllite isn't a good choice for a server application in any event. I'd suggest MySQL as an alternative. To quote the sqllite documentation: On the other hand, a database engine that uses a server can provide better protection from bugs in the client application - stray pointers in a client cannot corrupt memory on the server. And because a server is a single persistent process, it is able to control database access with more precision, allowing for finer grain locking and better concurrency. On Mar 17, 6:32 am, uday kiran uday.pic...@gmail.com wrote: Hi folks, Im new bie to android.. i want to access external database from my android application.. I've searched so much time in the internet but could not get exact idea how to implement?? Please help me If any one is having idea on that and post if u have any code related to it... Thanks for the information in advance.. Cheers Uday -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Accessing External Database
Thanks Bob, I got very good information from this... Let me explain thing i want to do.. There is a database present at some IP http://10.117.23.45/databases/database.db I want to access this database from my android application.. for this im using HttpURLConnection interface.. The way that im accessing the database is fine r not try { URL url = new URL(http://www.uploadhub.com/mobile9/ gallery/gallery_android/); HttpURLConnection conn = (HttpURLConnection)url.openConnection(); conn.setDoInput(true); conn.setDoOutput(true); conn.setUseCaches(false); conn.setRequestMethod(POST); } The code above i have given is some sample only.. As u said how to implement RESTful interface instead of doing this?? If u have any idea of code please let me know... Thanks for the information in advance.. Cheers Uday On Mar 18, 4:26 am, Bob Kerns r...@acm.org wrote: Please don't do this. You really, really don't want to do this. I've written about this before -- it's the wrong way for a lot of reasons -- security, interoperability, performance, maintainability, upgradability, compatibility with firewalls... What you want to do instead, is to build a web service, that exposes the proper functionality. I'd suggest a RESTful interface (google it; there are lots of examples and documents available), as it's more flexible and simpler than SOAP. You don't even want to expose yourdatabaseserver to the internet. It should be securely behind a firewall. And think about what happens when you want to change yourdatabase, and you have all these applications out there, expecting to be able to use specific SQL queries to get at the data. You cannot force users to upgrade. You can just break, of course -- but you'll lose a lot of customers, and a lot of them will tell other customers to stay away -- and they'd be right. Actually, I just saw the message that says you're using Sqllite. So you CAN'T even do it anyway, even if you wanted to. There is no network access to Sqllite. I'd saw sqllite isn't a good choice for a server application in any event. I'd suggest MySQL as an alternative. To quote the sqllite documentation: On the other hand, adatabaseengine that uses a server can provide better protection from bugs in the client application - stray pointers in a client cannot corrupt memory on the server. And because a server is a single persistent process, it is able to controldatabaseaccess with more precision, allowing for finer grain locking and better concurrency. On Mar 17, 6:32 am, uday kiran uday.pic...@gmail.com wrote: Hi folks, Im new bie to android.. i want to accessexternaldatabasefrom my android application.. I've searched so much time in the internet but could not get exact idea how to implement?? Please help me If any one is having idea on that and post if u have any code related to it... Thanks for the information in advance.. Cheers Uday- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en