Accessing existing SQLite database using Eclipse - java

I have created an android app in java using eclipse which creates a SQLite database and lets the user add data to it.
I would like to know how to access an already existing SQLite database (say, in our web server) to view and add data to it ?
I Googled it and didn't get any clear picture. Do I need to install JDBC driver for doing this ?
Thanks.

SQLite is not a client/server database.
That said, the SQLite wiki mentions some alternatives.

If you want to access a remote database from your app, you will need an interface (like a web service) that will take requests from your app and actually do the database manipulation. If you just want to access a local database from your computer, there are several utilities for it to do it graphically or you can use sqlite3 to do it from the command line. If you want to access the database through your browser, I think you need a web service for that too.

Related

Sqlite data with desktop application

I am creating java desktop application. I have created exe of my jar file using exe4j. Now i am binding my sqlite database with my exe using easy binder software. But when i run my application the data is getting saved properly but when i rerun the application the data is not there which i have saved before. Please help
I have tried using the specific path i.e. stored the sqlite db file at specific location, it is working but it is not secure as any one can open the file.
I need to embed the database along with my application but the database is not saving the data when i rerun my application.
It sounds like your data is only getting temporarily stored because SQLite is using a transient in-memory database due to the fact that it can't find the specified database. Please specify what version of SQLite driver you are using, as well as an example of its use in your code.
Is you are worried about the security of someone accessing the database, then you may wish to consider another database besides SQLite.

google app engine : switch sql cloud database instance , keeping the source code same java eclipse

The application is hosted in google app engine, we are using google cloud sql as database.
we are in testing phase of our application,
so we have to database
live database
test database.
so can anyone please suggest a way to switch from live database to test database without changing the source code,
for now we have created 2 different source code with different urls to connect to different database instances and have created 2 instance of application but we want to keep the source code same.
there are many ways to do this. you could pass a url parameter to indicate which db to use. you could also have an admin page where you select which db all will use.

Create an internal Database for Java EE?

I'm creating a web application, possibly using Maven, Spring and Hibernate.
I need to create a database for the application which will obviously hold some data, however as I need to send the application to someone once it is finished so that they can run it on their machine, I am not sure how to create the DB.
I have developed Android appliations previously where I have used sqlite to create an internal database, and I was wondering if there is anything that I could use similar?
Or will I have to use something like phpmyadmin?
Thanks for any advice.

Application that provides local and remote access to data

I need to develop an application with following features and want to
understand if GWT can be used to develop this application or is it the
right technology to use ?
1) Backend is in Java and uses MySQL
2) Desktop based UI to create some datafiles and data will be stored
in MySQL DB. This app will generate the data.
3) A desktop based application using which users can get access to
that database on a CD. This app will provide access to data locally
stored on a CD.
4) A web interface using which users can get access to the database
remotely. This app will provide remote access to data.
For local access also, we have the flexibility to install and run the
web server.
Should I use GWT for the UI part or should I use some thing else ? I
would like to provide common UI, look & feel for local and remote
access to data.
Please advice.
Thanks,
Deep
As you can run the web server also locally, I don't see a problem to re-use the same GWT app for both use cases.
It would be harder if your users must communicate with both the remote and local server from the same browser window/tab, at the same time. That can only be done with JSONP, which is possible with GWT, but it's not as nice as GWTRPC.

How to store data into MySQL database?

I have created a java application which stores data into MySQL database.
For that I have done the following things:
I have installed MySQL database on my computer.
I have created a database on that MySQL server.
I have created a table in the database with the required schema.
Now I want to deliver this application to various clients but my clients are not technical persons and I don't want to give instructions to each of my client to do the above three steps.
How can I integrate some functionality into my app so that it can do atleast step 2 and step 3 automatically so that the client needs to install only MySQL database.
It would be much better if the code can install the MySQL database automatically from the setup file attached with the application.
How the applications available in the market manage information?
For 2 and 3 you just need two SQL statements to run during installation: CREATE DATABASE and CREATE TABLE.
As an alternative I would suggest you to use SQLite for which your clients wouldn't need to install any database servers.
Personally, I like how Confluence (for example) deals with that:
The Confluence installation includes an embedded HSQLDB database, supplied for evaluation purposes. This is what you get when using the automatic installer on Windows.
As documented, the embedded database is Not Suitable for Production Instances of Confluence so they suggest to use an external database for production and provide detailed Database Setup Guides (installation, schema and user creation) for MySQL, PostgreSQL, Oracle, DB2, SQL Server and generic instructions for others databases.
The application will take care of creating the tables on startup if the schema is empty.
For those who prefer to create the tables manually, they provide a database creation script.
When upgrading to a higher version of Confluence, the Confluence application takes care of the schema update.
you can store data in two ways
using xampp
1st is using xampp/lampp/wampp and go to insert and just insert
using php
php used to insert data with mysql query
For steps 2 and 3 better create an OS shell script (bat or bash) that will execute mysql cli tool to create database and schema from your file
mysql -u root -p superpwd < create_database.sql
the create_database.sql better to create with help of mysqldump cli tool from your own database
Later you can include this script into your MySQL bundled installation.
I would think that you could do a data dump via phpAdmin which should script out the tables of the database along with insert statements for the actual data. I'm not a Java developer, but I think you should be able to use the functionality of the Java libraries that give you database access to turn back around and load your scripted out database as a file, read that file and then execute it against a database that you create via code.
Hope this helps for you.
For reference, here is how to create a mySql database via a command line .

Categories