简体   繁体   English

通过WIFI从SQL Server检索数据

[英]Retrieve Data from SQL server across WIFI

I work for a company as a developer. 我作为开发人员为公司工作。 Right now I'm trying to develop an app for the company in Android Studio in Java. 现在我正在尝试使用Java在Android Studio中为该公司开发应用程序。 They want me to develop an app that brings data from an SQL server on the Wi-Fi, from what I believe is stored on an Access webservice. 他们希望我开发一个应用程序,从Wi-Fi上的SQL服务器中提取数据,我认为它存储在Access Web服务上。 (I just have the IP, the Database name and schemas, and credentials to log on.) (我只有IP,数据库名称和模式以及登录凭据。)

Basically I just need help on how to retrieve data from the server and display it in the app. 基本上我只需要帮助如何从服务器检索数据并在应用程序中显示它。 All they want is for me to make a button that displays data from the server right now. 他们想要的只是让我创建一个按钮,立即显示来自服务器的数据。 I've tried going to SQLiteOpenHelper , and I'm trying to figure out jdbc again. 我试过去SQLiteOpenHelper ,我试图再次找出jdbc。

Is this even possible through an app? 这甚至可以通过应用程序? And if so, what would be the best way to achieve it? 如果是这样,实现它的最佳方法是什么?

This is a very common use case for an app. 这是应用程序的一个非常常见的用例。

Instead of going through the trouble of using an `SQLiteOpenHelper, I'd suggest using Google's Room library : https://developer.android.com/topic/libraries/architecture/room 我没有遇到使用`SQLiteOpenHelper的麻烦,而是建议使用Google的Room库: https//developer.android.com/topic/libraries/architecture/room

And for making network calls I suggest using retrofit: https://github.com/square/retrofit 为了进行网络呼叫,我建议使用改造: https//github.com/square/retrofit

Both are very well documented. 两者都有很好的记录。

I've tried going to SQLiteOpenHelper 我试过去SQLiteOpenHelper

That is for a local on-device SQLite database. 这适用于本地设备上的SQLite数据库。

I'm trying to figure out jdbc again 我想再次找出jdbc

Android has limited support for JDBC, and IMHO JDBC is not well-suited for use by mobile devices. Android对JDBC的支持有限,而且IMHO JDBC不适合移动设备使用。

The typical way that an Android app would get data from a remote database is by means of an intermediary Web service. Android应用程序从远程数据库获取数据的典型方式是通过中间Web服务。 So, the Web service would talk directly to your SQL database, and the Android app would talk to the Web service. 因此,Web服务将直接与您的SQL数据库对话,Android应用程序将与Web服务进行通信。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM