How to check username and password in a PostgreSQL

2019-06-10 11:10发布

I am using the Android 2.2 API. I want to know how to connect to a PostgreSQL database server.

I am new to this and so have no ideas, so please help me with some sample code.

1条回答
放荡不羁爱自由
2楼-- · 2019-06-10 11:38

You usually don't connect directly to a database. To achieve the results you want, you can do a RESTful request.

This means, send either a JSON string or xml file to a server(which you can program in php, ruby and what not)

I'm not going to give you sample code cause there are literally tons of code on a simple google search "android restful login" Example tutorial

The process is usually:

Enter login credentials on android device -> send post request to server -> validate credentials to the database(postgres in this case) -> send verification back -> android device act upon verification(usually by loading a new activity as a result if logged in successfully)

查看更多
登录 后发表回答