I have to use oracle database in android.
I have tried to work as usual java coding with oracle,but I have not succeed.
I have used this java code.
Class.forName("oracle.jdbc.driver.OracleDriver");
con=DriverManager.getConnection("jdbc:oracle:thin:#:1521:XE","SYSTEM","pis");
Statement s=con.createStatement();
s.executeUpdate("create table customer1(id int primary key,name varchar(20) not null,city varchar(20))");
s.close();
con.close();
I am new to android programming.
I don't think you should be talking directly to the Oracle database from the device itself. Aside from anything else, the security aspect would almost certainly prove challenging. You normally want to keep your database network access pretty limited.
Usually you'd host a web service of some kind exposing business-meaningful operations, and that web service would talk to Oracle. The Android device would then talk to the web service (probably via REST, although I dare say SOAP could work).
I have to use oracle database in android please help me.
AFAIK integrating Oracle into android is not possible as of now.What you can have is dump database on server and have your mobile talk to webserver to fetch data.Communication can be made via XML or JSON.
Using Web Service instead. You don't want to expose database connection in your mobile app
Related
I have developed a REST web-service in Java interacting with a MySQL database.I want to deploy the web-service and the create a database at a server so that I can invoke it from an application.I tried Microsoft Azure but was unable to get it done.Where can I find relevant information for this?
I had similar problems with a MySQL database using the third party option in the Azure Marketplace from ClearDb. What I ended up doing was switching my database from a MySQL instance to an Azure Database Instance (Subset of SQL Server's features.) This worked perfectly for me! I was able to query from my database feed data to my api, and access the API through my Azure Web App.
I understand this may not be an option for you, however, Digital Ocean is a great cloud hosting option (with scaling similar to Azure, although not as good in my honest opinion.) You can set up a Linux Environment with a MySQL Server and JVM and serve your whole API through there. Best of Luck!
#coderden, According to your description, I think you have been deployed your Java Application on an Azure WebApp. Then when you created a MySQL database on Azure for connection from the Java webapp, please make sure the webapp & mysql instance created in a same resource group and note the connection string of MySQL on Azure.
As reference, please see the article to try again although it's for PHP, the steps are the same for Java.
I'm trying to build a flash app that communicates with derby database without any JS, XML or any intermediate stuff. I've read about SQLConnection (adobe reference ) instance but dont quietly get if it's able to do same with derby.
I am quiet familiar with JSON, JAVA EE but newbie to flash development. Help would be really appreciated.
If that's not possible I'd love to try JSON Post requests to servlet ( which whill ofcourse get the stuff from db ).
No. As BotMaster said, SQLConnection only works for a SQLLite local connection. If you want to connect to any other DB technology, the standard procedure is to have what they call a Middle-Tier (Java,PHP,RoR,PHP) backend that manages the connection to your chosen DB tech.
To make this work, you would have to have a Java Web Container with the Derby stuff setup on that side. Your AS3 application would then communicate with the Web Container through whatever format you desired (AMF, Json, Raw HTTP call).
I have a Linux server which has a Database. I want to query the Database from my Android application.
All the tutorials I find tell me to use PHP for some reason.
Can't I just query like I would normally with a Java application? Which is, I connect to the Database then send my queries as Strings.
It seems I need something like this:
Why?
PHP is just a server-side programming language. You can use any language and any server. The main issue is
Can I Query MySQL Database Directly from Android without a Web Service?
Yes you can. Just open the port where your MySql database is set usually at 3306. You also need JDBC Driver to set up connection to it.
Should I Query MySQL Database Directly from Android without a Web Service?
Unless you want to make a Database Client app (like phpMyAdmin) where each user holds his own credentials then you should not. In such case everyone will be using their own credentials to access their own db. In your case, you'd be hardcoding your database credentials in the app for everyone to access.
Well, your database user is only allowed to connect from localhost not from the outer world. If you want to execute queries from outer world then you will have to allow access from all IPs i.e. You will have to create a user create user 'app'#'%' identified by password123 (In my opinion it will be a bad approach).
Moreover you can build REST Web Services either using PHP (Recommended) or JAVA to interact with the database without opening it to world wide.
I have my website(in php) running in Yahoo small business and Application(in java) in Rackspace.com.both server has got mysql database.
I want to query my application database(in rackspace) from my website(in Yahoo) and get the result set.
How to do it?
Please suggest me reference document to do it.
Is it a good idea to directly query a remote database ? means is there any performance issue will rise ?
It's always a bad idea to remotely access data that do not "belong" to your app. In this case, the PHP app should access a set of functions that are exposed on the Java side. This is to make sure that when you upgrade the Java side, you may change the schema of the database without affecting anyone interacting with it.
I recommend you look into Web Services -- there are many methods (eg look for RPC, REST, SOAP), and some might be a better fit for your needs than others.
If you open the database port, it should be easy but unsecure.
If you can access the database port in a secure manner (for example vpn tunnel), it would be easy and secure :)
My suggestion would be to implement the querys as SOAP Services in the Application and access them via PHP. Google should provide enough Results about SOAP in both languages.
AFAIK
if you would like to use the java function from php you should implement the web services in java in any of the web service types
You can access web services from php using the cURL calls
I need to connect my android application to my firebird DB
do someone knows how to do this?
please write the code!
I'm not particularly familiar with Firebird, but my guess is the best approach would be to use a web service of some sort (RESTful?) which allows your Android client to communicate with the database. This is the solution that is typically used for most apps since you can't connect directly to the database from Android. It's also good from a design standpoint because your application does not depend on the underlying database itself, but rather the web service which acts as a mediator, meaning you can swap database implementations without impacting your client.
Since Jaybird (Firebird JDBC driver) doesn't support Android, you need something more "hackish". Commercial solution would be using midware, eg RemObjects DataAbstract supports Android (pre-order/beta stage) and Firebird: http://www.remobjects.com/da/java.aspx
You can try this Jaybird port for Android:
http://sourceforge.net/projects/androidjaybird