Solved

external database and mobile web

Posted on 2013-01-20
11
291 Views
Last Modified: 2013-01-25
Can mobile web sites connect easily to an external database now? In past I havent been able to do this and cant really find much about this on Internet.

Say mysql or sql2010 DB connection from external site. Is this possible?
0
Comment
Question by:jagguy
  • 5
  • 3
  • 2
  • +1
11 Comments
 
LVL 28

Expert Comment

by:chilternPC
ID: 38799467
do you mean Mobile websites or  mobile Apps?
Mobile websites are the same as other websites except for layout of theirdisplay - they all live on a server and access databases the same way.
Mobile Apps - that's probably another matter depends on what mobile (iPhone,android,Windows)
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 38799470
There is no difference in connecting a mobile web site to a database or a "standard" web site to a database.  If the server connection scripts work, then they work.  Any trouble experienced is likely due to poor coding.
0
 
LVL 28

Expert Comment

by:chilternPC
ID: 38799471
or do you mean websites living on a mobile device?
MySQL databases are connected to by thier IP address, database name and username and password, so it shouldn't be a problem except for maybe performance
0
 

Author Comment

by:jagguy
ID: 38799499
website on a server mobile web not apps.

There is no difference for mobile web/ desktop web and database connection?

eg a mobile web and sql2010 db can work just as well as desktop db connection?
i thought there was a problem
0
 
LVL 28

Accepted Solution

by:
chilternPC earned 500 total points
ID: 38799528
no the only difference with a "mobile website" is the way it is displayed.
the back end is exactly the same.
my latest "mobile website" noe dispalys on any device (smartphone , Tablet, PC) and the only difference is the CSS files
see www.kpequestrian.com and see  how it changes fro the device.  
websites all live on a server which is where the database is or even if the database is on a separate database server its the same.
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 38800003
I would be carful.... there is a difference in how you connect to your database with a web app vs mobile NATIVE app.   It was pointed out that in some cases an app can look like a native but it is not, this would be a web view.   For this purpose, let's call that a non native as it is still browser based and relying on the server.     When you are relying on the server, you will use server side code like php or asp with connection strings and coding that talk with the database and can never bee seen by the end  user unless the site is hacked into where the hacker can get  access to files on the server.

With a native app, while you could have a connection string in the same fashion, you would not want to do this as breaking into the app program is possible and the last thing you want is having 1 million devices with connection strings and passwords that would be difficult to change with out an update to the app.  Therefor, your calls to a database in a native app will be via a web service you create.  Typically you will send some data to your server that would include parameters and keys, maybe even base64 encrypted.  Then on the server, you decrypt the base64, apply the parameters and verify with another key such as sha/md5.  Then you process the data on the server as if it were a web form and lastly return a response as json or xml that is then read by the native app to display content.

To answer more directly, "Can mobile web sites connect easily to an external database now?" You shouldn't.  Use a post to your server, scrub input and return json/xml to be read by the app.
0
 
LVL 28

Expert Comment

by:chilternPC
ID: 38800551
@padas - sorry ???   mobile websites CAN connect in the same way as PC based websites and do.
 they are NOT mobile Apps.
jagguy said he was intrested in mobile website not mobile native app
I agree with your explanation about native apps.
but not mobile displayed websites.
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 38801492
chilternPC, please read my first line, there is a difference in how you connect to your database with a web app vs mobile NATIVE app.   Otherwise, a website is a website.  I explained the difference.

Like most everything on the web, it's all smoke and mirrors and there are multiple ways to get to the same visual end and just as many opinions on which way to do it.  As @jason1178 pointed out if what @jagguy experienced may be a coding issue.

eg a mobile web and sql2010 db can work just as well as desktop db connection?
i thought there was a problem

What specific problems were you having or worried about?  Security and speed are the two major areas I can think of outside of not working at all.  

I'm sure you can search for a more formal list of best practices.  But this is what I use of the top of my head.
Speed
1) Open and close your database.  Get the data you need, throw it into a variable or array, close the db then use the array to extract data you need in your code instead of multiple calls to the db.

2) Pull out only the data you need.  Instead of, "select * from myTable..." use, "select name, email from myTable..."

3) Avoid over using wild card searches in large text fields.  

4) Avoid a query that will send too many results at once and only using some of them.  

5) Learn to add index's.  However, this can also slow things down

6) Normalize your data.  

Security
1) Scrub your data.  If you are expecting a date, use your server side code to make sure the incoming data is a date.  If you are expecting text, use the code of your choice to take out or convert any single quotes, html like characters.

2) Use parameter queries

3) Use sha or hash of your choice to create a key on your posting page and use the same formula on the receiving page.   var=sha1(field1&field2&field3&secretword1&secretword2) This helps insure you know where the data is from.

4) Don't post your password on your questions in EE
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 38801812
4) Don't post your password on your questions in EE

Spoilsport.
0
 
LVL 28

Expert Comment

by:chilternPC
ID: 38801963
so to summerise..
Author>>>website on a server mobile web not apps.
me>>>ok lets not mention mobiles app and confuse the question and just answer about  websites on mobiles.

Author>>>There is no difference for mobile web/ desktop web and database connection?
me>>>that's correct.

Author>>>eg a mobile web and sql2010 db can work just as well as desktop db connection?
i thought there was a problem
Me>>>>mobiles supporting  web browsers will use wi-fi or 3G or better the same as a laptop away from home., the only problem as Padas says is would be the speed of connection causing possible timeouts, and security (but that's true of a PC/laptop)
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 38802016
...3g - can be very slow.  Especially during prime time.  If you have a small database w/few users, treat wifi and mobile the same.  If you are on a shared data server such as godaddy where you are paying $2 to $20 for hosting, or have a large query, bigger database, lots of users... account for 3g by presenting less data and html.  The responsive sites that simply present the same data in a different format for mobile vs not mobile (whatever "mobile" is depending on your detection script) can cause 3g phone experiences to be slow.  Have you tried using 3g phone on this site?  I have an android galaxy almost done with 2 yr contract and I find this site hard to use on it.

We have done a good job here addressing and defining mobile and speed and security... But I'm not sure we have addressed the exact problem @jagguy is having or experienced.  Has this info overload helped you?
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Performance is the key factor for any successful data integration project, knowing the type of transformation that you’re using is the first step on optimizing the SSIS flow performance, by utilizing the correct transformation or the design alternat…
I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now