First, I will present what it is doing my web-application :
The subject of this web-application is different distributed databases and distributed data sistems with a specific type of information. Until now I programed using PHP, JavaScript and JQuery-ui. For databases I used MySQL and PostgreSQL and I thinking to use and Oracle. On short way on my web application the user firstly have to register. If he is accepted by Admin then he have the possiblities :
Connect to HIS database (MySQL, Oracle, Access, PostgreSQL)
Run queries between two, different or not, databases
To connect to his database the user enter information like : host, user, password and name of database. At next step he can see the tables from database. If he select one line he will be able to Update, Create and Delete the content from the selected table.
On this section the user can look for similarities between the two databases (with key words or structures of tables) : one that belongs to him and another one that belongs to the Admin.
I use WampServer, version 2.1 with Apache/2.2.17 and PHP/5.3.5 and I want to do a bridge who will be responsable with the connection to the databases and in which I will comunicate with different databases. The informations from interface will be sent as MySQL queries and in the bridge I will adapt that queries for each type of database.
Can someone to help me ?
Soon as possible.
Thank you !
Simon
The informations from interface will
be sent as MySQL queries and in the
bridge I will adapt that queries for
each type of database.
This is a very bad idea for two serious reasons:
To implement it, you'd have to write your own SQL parser.
Each major database implements its own dialect of SQL, which means you'll have to know how to translate between their specific syntax and command sets.
Related
I have an application that uses an Oracle database. It reads data out of the database using statements like:
SELECT * from schema.table WHERE ...
I would like to create a SQLite database with data I can use for regression-testing the application. It's simple enough to change the jdbc settings to get the application to connect to a different database, but the SQL statements need to be exactly the same.
I know when I run SQLite from the command line, I can attach a database using
attach database as
If I do that, then the same select statements that work in oracle to access a table in a different Oracle schema will work to access the data in a different SQLite database. But, since I'm connecting via JDBC, I don't have the option to run the "attach database" command.
Is there a way to configure SQLite such that it will accept requests like the above?
I tried
create table "schema.table" ...
That worked, but then I need to include the quotes in the select statement, which Oracle won't allow.
I am new to Android and my requirement is this. I am in need to develop an application that will list all the events (past and upcoming). These event details , I will fetch from tables and that table will have only past events. For the upcoming events, I will be inserting into the table which will create a notification for the same.
My doubts:
What is the table I should use (SQLite(inbuilt) or MySql from any hosting services) ?
If SQLite, Is there a way from GUI, I can insert data so that it will reach all users having this application?
To be simple, how I can achieve this entire functionality?
Thanks in advance!!!
What is the table I should use (SQLite(inbuilt) or MySql from any hosting services) ?
If you want all user devices to access the same database, you will have to setup a MySQL server. As soon as the database is updated in your host, the changes will be reflected in the users apps - as soon as they reload the view or a new request is made. You can query your database every N seconds to keep things updated.
MySQL will be my choice or MariaDB, MySQL's community fork.
You can start with this tutorial:
http://dev.mysql.com/doc/refman/5.7/en/tutorial.html
We want to use the MS Access Database file to be tracked while CRUD (Create,Read,Update,Delete) operations occurs on it.
How to track the CRUD Operations using JAVA while I do have full URL String for database connection ?
How to know which type of queries are being fired on database ?
For example:
User A fires queries of insert,update or delete operations on DB then user B will be notified that user A changed the database.
In short how to get updates from the MS Access database using java ?
I just know how to work with CRUD operations on MS Access but HERE I can not use logging or maintain history.
I am using Database file ACCDB or MDB anyone of these.
Usually you would achieve such goal by not permitting your users to connect directly to the database. Instead, you would provide them with a CRUD service. Here are some basic tutorial on RESTful CRUD services in Java.
http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/RESTfulWebServices/RESTfulWebservices.htm
http://www.vogella.com/tutorials/REST/article.html
http://persistentdesigns.com/wp/rest-crud-jersey-spring-and-jpa/
Note that these tutorials are not specific to MS Access database. You just need to change the bit that describes the database connectivity. Here's some help on how you would connect to MS Access database from Java
http://www.compiletimeerror.com/2013/03/ms-access-database-connectivity-in-java.html#.VABXO_42W3Q
I'm in the process of designing an Android application right now.
I understand SQLite works on the phone device within the file structure. However I'm not sure if it's practical for our use.
If I'm wanting to store data that's available to all users (i.e. if someone updates their profile, it can be seen by all other users), can that be done using SQLite somehow? Or must we use a client-server model such as MySQL?
Is it practical to store user-specific information using SQLite and public information using MySQL?
Thank you
What you want to do is a Client-Server Architecture, store the data in your central server and get a copy of the working data on the phone. MySQL and SQLite don't share everything but it's close. Read the documentation on SQLite and you will see.
SQLite can't serve files like MySQL if that's your question via the network. You'll have to write that on your own. I suggest making a webservice.
If you want info to be available to all users you need a client-server model such as MySQL.
If you use SQL Lite, the only possible way to update that info without requesting it from a server is to make an Update on the application (not doable).
Don't forget that you'll require internet ON for these types of applications.
you mean all users going to use a single phone, probably not, the reason for recommending sqlite database for android is that its the lightweight, non memory eater and thus best suitable to mobile phones. Sqlite database can be used in phone while at server side we can use any. The only thing is use a method like sending xml request to server from phone, where server will send respond as xml or json, while the phone parse the xml and use the data in it. this is how online apps works in mobile phones..... ya ofcourse use mysql at server side and do the communication using as request - response yes the client-server.
Is it practical to store user-specific information using SQL Lite and public information using MySQL?
Yes, This is exactly what I'm doing with my app. It's a very common practice. I am storing information in a MySql db stored on a server that all users can read from. They can pull specific information to the device. From there I have a class in the app that stores information that they've selected within a SQLite db. You'll easily be able to add information to the MySql db on the server that all users can view.
yeah i think the model you are proposing should have no problem. Even i'm using a model something similar to what you are saying. I store some information on local sqlite db and majority of information in mysql db. For sending data from android device to mysql db you will have to write a mysql scipt on a page and android device will hit that page with the help of http request. You can send your data in that http request
My question is very related to this one: Multiple dynamic data sources for a servlet context. However I haven’t found a proper solution just yet and would like to ask it again.
I have a little JSF application that talks to a MS SQL Server via JDBC. Tomcat is used as the web container. The application retrieves and stores its data from a single database. A login screen is provided. If the credentials match the ones stored in the database then access is granted and I can play around with the application.
Now I would like to add more databases and provide a login screen which not only requests the username and password but the database name as well. Different databases are used because I would like to have some for testing and development. The backup plans are also not the same for every database.
Currently I use JNDI Resources to look up the databases in my code. However this forces me to edit context.xml and web.xml and to restart tomcat. I don’t want to do that. The restart forces me to run around an tell everyone: “Hey I am rebooting do you mind losing all your connections?”
Is the some more dynamic way to do that?
For your purposes, you should really have three separate application server instances (either on three separate machines, or on the same machine listening to different ports, or different host headers etc). The development server instance should always look up the development database, the staging server looks up the staging database etc, and JNDI should be set up to reflect this. That's what JNDI is for.
That said, if you must set things up with just a single application server, you will probably need to look into writing a custom authentication realm that does this. You could either do the actual work of determining which data source to use yourself, or look into something like Hibernate Shards.
Create an array of datasources and let the user select which index in this array you want to use.
I dont know the answer but if you call OSQL -L from JNI you can get a list of available SQL database instances in the area. Then you can connect and get the list of databases within.
So:
user enters username and password
app runs OSQL -L to get the list of instances and provides a select list
user selects instance, jdbc uses credentials in step 1 to get a list of databases from the instance
jdbc uses selected database to connect.
You could get the databases in SQL server using a select statement and eventually discard some of them which are not relevant to your applications.
ResultSet rs = stmt.executeQuery("show databases");