Export oracle database data through java code - java

I'm using Oracle Database 11g Express Edition to set up my database. The way I currently backup my database data is through SQL Developer. (Right click on tablename > export)
Which will give me a .sql file.
But, how do I do this through java code? I've looked into expdp, but I don't know how to execute it through my code, if that's even the right way to do it.
Can someone help me out here?

Data Pump can be automated through the standard package DBMS_DATAPUMP. You could build a small PL/SQL procedure and call that procedure from Java. Here is an example of exporting a schema with DBMS_DATAPUMP, but it does not look very intuitive.

Related

Accessing Connected Database DB in Eclipse with Java Code

I successfully connected to a DB in eclipse through the Database Development perspective and am able to run queries in the SQL File Editor. However, I would like to write java code to automatically run a query and then extract the data to a flat file. What is the easiest way to do this? Since I am already connected to the database, can I bypass the java code that involves connecting to the database.
No, the Java JVM also needs to be able to connect to the database. There are many examples of JDBC connections on the internet, including this one.
Once you have got the data you needed, you should make use of FileWriter in order to write the information to file.

Automatically export password protected Access Table to .csv file using Java

What it needs to do.
1. Browse filesystem for DB.
2. Open password protected DB. (Program will hold the password)
3. Select table.
4. Export the table into a .csv file.
What I have.
Nothing, I am currently planning and designing. I am somewhat new to programming and have made similar programs just not connected to Access.
Plan so far.
I plan on using UCanAccess to connect with the database and am not sure what would be needed to convert the database into the .csv file.
Any help would be greatly appreciated. Although I know java I am more of a designer and am not great with syntax. I prefer to stick with Java but if there is an easier way I'm open to anything.
The main reason why I developped UCanAccess is to allow SQL query executions.
The direct usage of the jackcess library export utility (class com.healthmarketscience.jackcess.ExportUtil) seems to fullfil your simple requirement. It will allow you to export tables in csv with no more than three rows of code.

How do I back up a MySQL database

I have created a Web Application using Java JSP and for a Database I used MySql server 5.5. I am running on windows and the application works just fine. My question is, where is the actual physical database stored, i can not find it anywhere on my computer, and the reason why i am asking is portability, if i copy and paste and run the project on different machine, there is a problem connecting to the database, i can recreate the schema of the database, but the actual data stored in the database i can not find it.
Please help
Use mysqldump to backup your database:
The mysqldump client is a backup program originally written by Igor
Romanenko. It can be used to dump a database or a collection of
databases for backup or transfer to another SQL server (not
necessarily a MySQL server). The dump typically contains SQL
statements to create the table, populate it, or both. However,
mysqldump can also be used to generate files in CSV, other delimited
text, or XML format.
An alternative option if you don't want to use the commandline is to use a program like HeidiSQL

How to install SQLite database on the WIndows XP system

I want to connect my java program to the SQLite db. What are necessary steps that I have to follow. I want to install sqlite database on my system to access the database.
From the SQLite Homepage:
SQLite is a in-process library that implements a self-contained,
serverless, zero-configuration, transactional SQL database engine.
[...]
SQLite is an embedded SQL database engine. Unlike most other SQL
databases, SQLite does not have a separate server process. SQLite
reads and writes directly to ordinary disk files. A complete SQL
database with multiple tables, indices, triggers, and views, is
contained in a single disk file.
So you don't actually install SQLite. To create and work with SQLite Databases, you can use the provided sqlite-shell, which is a command-line tool. If you are familiar with SQL, this should not be a problem.
Although, there are also some GUI-tools out there to work with SQLite...
If you want your Java-application to access and work with an SQLite Database, you'll need the necessary drivers. A nice topic on this can be found here.
Hello mayur rahatekar,
Here's a quick tutorial for creating a sqlitedb on your computer, its explained from the ground of:
SQLiteDB with some Androidflavour
Best Regards
safari
You can take the help of mozilla firefox browser.If you have then you can search on google how to integrate sqlite with mozilla.it's very easy.Click here to see the link.

Building an MSSQL database with ColdFusion or Java from an ".sql" file?

I have a .sql file that was created using the MS SQL Management Studio Script Wizard. It contains the entire database schema including views, stored procedures, tables, indexes, etc.
I’m looking for a way to automate the process of creating the database with ColdFusion or Java or even .NET.
I’ve tried using CFQUERY but it throws all kinds of errors with the .sql file.
I’ve tried using ANT with sqljdbc4.jar but it also fails on the first line with a “[sql] Failed to execute: BEGIN TRAN” com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near ''.
I highly doubt you can use the scripts generated by the wizard outside of an MS tool. The wizard makes copious use of GO which is not standard T-SQL. Also, commands like CREATE PROCEDURE need to be the first statement within the batch. To run the wizard scripts, you need to use an MS tool like sqlcmd.exe. With the correct permissions, you should be able to run sqlcmd.exe from <cfexecute>.
You should be able to execute all the SQL within a <cfquery assuming you have the appropriate permissions.
We generate all our databases like this with CREATES etc in a ColdFusion <cfquery
Do you have the appropriate permissions, what errors are you getting.
If you're using ORM, you may set this.ormsettings.sqlscript to point to your .sql file in Application.cfc and it'll be run on ORMReload() when this.ormsettings.dbcreate is set to dropcreate.
http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSED380324-6CBE-47cb-9E5E-26B66ACA9E81.html
Good luck

Categories

Resources