0

I work as a student in a big company.

The company has asked if i could make an android app that shows some statistics.

The statistics i need to get is on our company internal database and the user of the android app will use it within our building (there by being on our internal network and should per say have access to our internal data).

Now i am UNABLE to add PHP scripts to our company's website because we run on ASP, I have no experiance with ASP and i do not think that i am allowed to alter any of the existing Asp sites.

Is it possible for me to access our database from the android device? Or do you HAVE to go through a website that does the database request for you?

Marc Rasmussen
  • 19,771
  • 79
  • 203
  • 364

2 Answers2

1

Create your application based in this platform: https://cordova.apache.org/

With Cordova, you can create your app based on HTML, CSS and Javascript. By using Javascript you can make PHP requests to the company's database just like if you were accessing an PHP page hosted in the internet.

Here is how your Eclipse project may look like.

cordova eclipse project

Here is an excerpt of your html page.

Index.html

<body>
    <div id="main">
        <span id="screen1"></span>
    </div>

    <script>
    $(document).ready(function(){
        //first php query
        $.post('http://www.example.com/request.php', function(retorno_busca){
            $('#screen1').html(retorno_busca);  
        });
    }); 

    </script>
</body>

You will need to host some PHP code somewhere in the internet, not necessarily in your's company's website.

Spend some time learning about Cordova.

Math
  • 3,334
  • 4
  • 36
  • 51
  • First of all Thank you so much for your response. Secondly do you know any where i can see tutorials, documentation ect. i cannot seem to find it on the link you gave me – Marc Rasmussen Jul 05 '13 at 12:16
  • Maybe here `http://phonegap.com/` and here `http://phonegap.com/2012/03/19/phonegap-cordova-and-what%E2%80%99s-in-a-name/` – Math Jul 05 '13 at 12:22
1

It is possible for you to access the database, however, the database should be set up so that it just doesn't handle request from anywhere. What that means is that you can control which addresses (IP) can make queries this is possible with quite a fair amount of control at least with MySQL. I assume it's the same for a ordinary Oracle DB.

That being said, there are quite a few reasons for you and the company that you work for to have a middle layer that provides access to the database. The information in the database could be sensitive, and almost certainly the DB-username and DB-password is sensitive information even if it only has access within the company wifi. What I'm getting at is that if you're going to access the database directly from the phone you'll have to store the username and password somewhere(on the phone), which is a security risk if a phone gets in the wrong hands.

So how would you go about creating a middle-layer, well ask for help or read one of the many tutorials on the web, heres one.

If you still want to go with accessing the DB directly from the phone you should check out this thread and the links.

Community
  • 1
  • 1
Daniel Figueroa
  • 10,348
  • 5
  • 44
  • 66