I've been talking with someone about the possibility of a iPhone development contract gig. All I really know at this point is that there is a company that wants to make an iPhone app that will hit their internal database. I'm not sure what the database type is( Oracle, MySQL, etc...).
我一直在和某人讨论iPhone开发合同的可能性。在这一点上我真正知道的是,有一家公司想要制作一款能够打入其内部数据库的iPhone应用程序。我不确定数据库类型是什么(Oracle,MySQL等等)。
I've wanted to know if the database type was Oracle or MySQL if there is a big learning curve for connecting to one of these across the internet?
我想知道数据库类型是Oracle还是MySQL,如果有一个很大的学习曲线连接到互联网上的其中一个?
If it's a real pain I may do more research before accepting the conract.
如果这是一个真正的痛苦,我可能会在接受conract之前做更多的研究。
5 个解决方案
#1
14
I would advise against directly accessing the database from the iPhone application.
我建议不要直接从iPhone应用程序访问数据库。
Usually, you would create a web service which accesses the database, and then you consume that web service from the iPhone application.
通常,您将创建一个访问数据库的Web服务,然后从iPhone应用程序中使用该Web服务。
#2
3
Create a web service. This allows you to make the iphone app more of a thin client. Let the application push commands to the web service for processing and interaction with the database returning only the data needed by the app.
创建一个Web服务。这使您可以使iphone应用程序更像瘦客户端。让应用程序将命令推送到Web服务以进行处理并与数据库交互,仅返回应用程序所需的数据。
This option is better for the app, the database, and the customer's security.
此选项更适合应用程序,数据库和客户的安全性。
#3
1
You can easily perform the connection over the internet, the same way you would locally, but you are opening the database up to attacks if it will accept communication from any remote IP address. Typically you will just connect via a socket open to the server's remote IP address over the open port, MySQL's default port is 3306.
您可以像在本地一样轻松地通过互联网执行连接,但如果它接受来自任何远程IP地址的通信,您将打开数据库以进行攻击。通常,您只需通过开放端口通过套接字连接到服务器的远程IP地址,MySQL的默认端口为3306。
I would recommend against this sort of system in general unless there is some critical reason they want their internal database exposed to the world's hacker community.
除非有一些关键原因,他们希望他们的内部数据库暴露给全世界的黑客社区,否则我会建议不要使用这种系统。
#4
1
What I am doing is creating a web service using Sinatra to access the online database.
我正在做的是使用Sinatra创建一个Web服务来访问在线数据库。
#5
1
Those answers from 2009 are mostly obsolete now.
2009年的答案现在已经过时了。
http://ODBCrouter.com/ipad (new) has XCode client-side ODBC libraries, header files and multi-threaded Objective C objects that let your apps send SQL to server-side ODBC drivers and get back binary results! This reduces the need to stop and separately maintain SOAP/REST servers that can get pretty frightening anyway after a while maintaining it.
http://ODBCrouter.com/ipad(new)具有XCode客户端ODBC库,头文件和多线程Objective C对象,可让您的应用程序将SQL发送到服务器端ODBC驱动程序并获取二进制结果!这减少了停止和单独维护SOAP / REST服务器的需要,这些服务器在维护它之后无论如何都会变得非常可怕。
The XML schemes were okay for transferring static configurations to mobile devices "every once in a while", but XML was meant for infrequent inter-company type transfers in a "server environment" (with power cords, wired networks and air conditioning) and is definitely not efficient for frequent database queries coming in from n-copies of a mobile app. There are third-party JSON libraries that help things, but even with JSON, everything has to be encoded (and decoded) from the binary representation in the database to text representation on the server (only fine if it's going to be shown to the user in a web browser anyway, but not fine if the mobile app is going to translate it right back into binary so that it can perform calculations "behind the scenes" to what is going on with the user). Aside from the higher network overhead and battery power the mobile CPU will draw with XML and JSON, it will also make you buy more RAM and CPU power on the back-end server faster than just using an ODBC connection to the database.
XML方案可以“偶尔”将静态配置传输到移动设备,但XML适用于“服务器环境”(带有电源线,有线网络和空调)的不频繁的公司间类型传输,并且对于来自移动应用程序的n份副本的频繁数据库查询来说,效率绝对不高。有第三方JSON库可以提供帮助,但即使使用JSON,一切都必须从数据库中的二进制表示编码(和解码)到服务器上的文本表示(只有当它将显示给用户时才会很好)无论如何,在网络浏览器中,如果移动应用程序要将其转换回二进制文件,以便它可以“幕后”执行与用户正在进行的计算,则不会很好。除了更高的网络开销和电池电量,移动CPU将使用XML和JSON绘制,它还将使您在后端服务器上购买更多的RAM和CPU能力,而不仅仅是使用ODBC连接到数据库。
#1
14
I would advise against directly accessing the database from the iPhone application.
我建议不要直接从iPhone应用程序访问数据库。
Usually, you would create a web service which accesses the database, and then you consume that web service from the iPhone application.
通常,您将创建一个访问数据库的Web服务,然后从iPhone应用程序中使用该Web服务。
#2
3
Create a web service. This allows you to make the iphone app more of a thin client. Let the application push commands to the web service for processing and interaction with the database returning only the data needed by the app.
创建一个Web服务。这使您可以使iphone应用程序更像瘦客户端。让应用程序将命令推送到Web服务以进行处理并与数据库交互,仅返回应用程序所需的数据。
This option is better for the app, the database, and the customer's security.
此选项更适合应用程序,数据库和客户的安全性。
#3
1
You can easily perform the connection over the internet, the same way you would locally, but you are opening the database up to attacks if it will accept communication from any remote IP address. Typically you will just connect via a socket open to the server's remote IP address over the open port, MySQL's default port is 3306.
您可以像在本地一样轻松地通过互联网执行连接,但如果它接受来自任何远程IP地址的通信,您将打开数据库以进行攻击。通常,您只需通过开放端口通过套接字连接到服务器的远程IP地址,MySQL的默认端口为3306。
I would recommend against this sort of system in general unless there is some critical reason they want their internal database exposed to the world's hacker community.
除非有一些关键原因,他们希望他们的内部数据库暴露给全世界的黑客社区,否则我会建议不要使用这种系统。
#4
1
What I am doing is creating a web service using Sinatra to access the online database.
我正在做的是使用Sinatra创建一个Web服务来访问在线数据库。
#5
1
Those answers from 2009 are mostly obsolete now.
2009年的答案现在已经过时了。
http://ODBCrouter.com/ipad (new) has XCode client-side ODBC libraries, header files and multi-threaded Objective C objects that let your apps send SQL to server-side ODBC drivers and get back binary results! This reduces the need to stop and separately maintain SOAP/REST servers that can get pretty frightening anyway after a while maintaining it.
http://ODBCrouter.com/ipad(new)具有XCode客户端ODBC库,头文件和多线程Objective C对象,可让您的应用程序将SQL发送到服务器端ODBC驱动程序并获取二进制结果!这减少了停止和单独维护SOAP / REST服务器的需要,这些服务器在维护它之后无论如何都会变得非常可怕。
The XML schemes were okay for transferring static configurations to mobile devices "every once in a while", but XML was meant for infrequent inter-company type transfers in a "server environment" (with power cords, wired networks and air conditioning) and is definitely not efficient for frequent database queries coming in from n-copies of a mobile app. There are third-party JSON libraries that help things, but even with JSON, everything has to be encoded (and decoded) from the binary representation in the database to text representation on the server (only fine if it's going to be shown to the user in a web browser anyway, but not fine if the mobile app is going to translate it right back into binary so that it can perform calculations "behind the scenes" to what is going on with the user). Aside from the higher network overhead and battery power the mobile CPU will draw with XML and JSON, it will also make you buy more RAM and CPU power on the back-end server faster than just using an ODBC connection to the database.
XML方案可以“偶尔”将静态配置传输到移动设备,但XML适用于“服务器环境”(带有电源线,有线网络和空调)的不频繁的公司间类型传输,并且对于来自移动应用程序的n份副本的频繁数据库查询来说,效率绝对不高。有第三方JSON库可以提供帮助,但即使使用JSON,一切都必须从数据库中的二进制表示编码(和解码)到服务器上的文本表示(只有当它将显示给用户时才会很好)无论如何,在网络浏览器中,如果移动应用程序要将其转换回二进制文件,以便它可以“幕后”执行与用户正在进行的计算,则不会很好。除了更高的网络开销和电池电量,移动CPU将使用XML和JSON绘制,它还将使您在后端服务器上购买更多的RAM和CPU能力,而不仅仅是使用ODBC连接到数据库。