Reputation: 1556
It is widely known fact that to develop and android app with web content we need to have WebAPIs, In that case,
we are going to write the Database access logic in Web application API and mobile app development part in Android
I am asking this out of my curiosity, Why can't we write stored procedures in the database and consume them from the mobile app directly using JDBC? Here we are trying to eliminate the usage of Web APIs
Is using JDBC in Android app a good practice?
Upvotes: 2
Views: 175
Reputation: 3763
A JDBC connection to the Oracle Database is a stateful connection and one that's expensive to establish. It can also end up making multiple roundtrips for doing things like fetching rows from a query, doing a transaction or calling a stored procedure. For all these reasons it's preferable to make mobile apps call REST APIs which implementation can leverage JDBC connection pooling, make multiple roundtrips to the DB that's in the same network, etc.
Upvotes: 2