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
Related
I want to connect to oracle 10g databases in java without help from odbc and jdbc drivers. Is there any way to do that??? Thanks in advance
No. That's exactly what the JDBC drivers are for. To connect to the database.
Strictly speaking you could write your own driver (and call it something else), but that would be an immense amount of work, just because you refuse to do things the correct way.
Yes, it is possible. Oracle can act as a web service provider.
In the 10g version, you can only publish REST XML/JSON services; in 11g, support for SOAP web services was added.
Please note that the services provided by Oracle need to be implemented in PL/SQL; essentially you would be writing stored procedures that wrap the SQL queries you normally send over JDBC. Compared to JDBC, the web service / REST API is a very different tool as it works on a higher level of abstraction. You should only use it when required (e.g. if you don't want to mix SQL with your Java code), not because of false beliefs about security issues with JDBC drivers.
See this Oracle-Base article for more information.
I'm a Java EE developer and we typically use Weblogic to deploy our apps. Now I'm faced with a new desktop application which requires logging, database connectivity and mail.
After some investigation I'm realizing that desktop apps are a completely new world to me and I'm not sure if I'm choosing the right libraries to support my app.
These are my questions:
In our Weblogic projects we used Log4j and I want to use it again in my desktop app. Is it a bad idea? Should I use a better logging framework?
In Weblogic we retrieve database connections with JNDI but now it seems impossible to do the same. How do I perform the same action in a desktop application so I can connect with a remote database? Is the combination c3p0 + database driver a good approach for this?
Is there any framework/JAR which provides all this stuff (log + ddbb + mail) as an integrated solution? Workmates told me Spring could help. I also found Warework.
In our Weblogic projects we used Log4j and I want to use it again in
my desktop app. Is it a bad idea? Should I use a better logging
framework?
No, it is not a bad idea and perfectly works. Personally, I'd go with java.util.logging as it does the job fairly well and it reduces your applications' footprint (storage). Although, it's configuration is a bit tricky.
In Weblogic we retrieve database connections with JNDI but now it
seems impossible to do the same. How do I perform the same action in a
desktop application so I can connect with a remote database? Is the
combination c3p0 + database driver a good approach for this?
You can directly connect to your database using pure java.sql JDBC API (tons of examples available in the internet), but always have to distribute the proprietary database drivers as part of your application (mySQL, Oracle, DB2, etc.). Furthermore it's possible to directly use connection pools provided with those drivers by using their proprietary APIs (fairly easy to encapsulate). Nevertheless, there are a number of issues:
latency; database protocols are fairly sensitive when it comes to latency (distance between client and database server). Having a database in the UK and desktop clients in US is probably not a good idea.
security 1; you have to distribute database user credentials to each and every desktop client. Be aware of that.
security 2; your database security requirements may demand for transport security (packet encryption).
change management; applying non-backward compatible updates to your database requires you to update all desktop clients (believe me - it's not fun).
network; depending on your environment, certain ports and/or protocols may be blocked.
Is there any framework/JAR which provides all this stuff (log + ddbb +
mail) as an integrated solution? Workmates told me Spring could help.
I also found Warework.
Logging and database access are not an issue and work fairly well without any third-party framework. Of course, those frameworks might provide value regarding other aspects (abstraction, DI, JDBC abstraction, etc.), but this is a topic of detailed software design. Sending emails directly from a desktop application might become an issue, regardless of the framework in use. Just some things to keep in mind:
which SMTP relay server do you want to use?
in case of an enterprise environment, your IT operations teams might not allow you to use their SMTP server from each desktop (keep spam in mind).
Conclusion: In desktop scenarios an application server is not a bad idea either. You should have your desktop application to communicate with an application server only by using e.g. JSON, XML, SOAP over HTTP/HTTPS or RMI, etc. The application should be responsible for the complex tasks like database access, transaction management, fine grained security, email, etc.
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
My application should be syncronized with a ServerDB to collect some Data all users input.
How to do that in android? Through xml and evaluating these through self writen queries? Or is there a more elegant solution?
This is a good thread for you How to communicate with server's database from android phone?
Basically, you should not use a JDBC / SQL connection directly as it doesn't suit mobile needs. But you build a web service your database on the server and communicate through the service to update your database and get refreshed data from it.
Take a look at the SampleSyncAdapter sample app.
Android apps can sync their content provider with a web-based database using the SyncAdapter class, which handles many of the details of scheduling and running synchronization. Sync adapters will try to avoid conflicting with each other, they won't run when the network is unavailable, and the user can configure them from the Accounts settings.
Even if your app is the only one using the mobile database, you should use a content provider, to allow the system to manage interaction between the db and the web.
Have a look in :
http://www.codeproject.com/Articles/267023/Send-and-receive-json-between-android-and-php
I'm looking for a java database server that has support for database to be shared and opened from a PHP web application and a java application simultaneuosly.
I found Apache Derby and H2 Database but they don't have a clear support for PHP application.
Please suggest.
It must be a Java Database Server, since we are planning that we may have to distribute the applications to customers, so we need something portable and redistributable.
Most popular databases have drivers for PHP and for Java.
They also support concurrent connections. Choosing something like SQL Server, Oracle, MySql, Postgres will work just fine.
MySQL might work fine for you. I've used it myself in projects where I both need to access it from java and PHP.