Hai,
i'm a beginner to java...
just now i had tried to read and write files using java...
and then i had tried to connect a database using jdbc...
now i want to export the data's from a database into a text file
using java....
Can any one plzz give me an idea for doing this process...
thanks and regards..
senthil.
2 17442
Hai,
i'm a beginner to java...
just now i had tried to read and write files using java...
and then i had tried to connect a database using jdbc...
now i want to export the data's from a database into a text file
using java....
Can any one plzz give me an idea for doing this process...
thanks and regards..
senthil.
Write files using BufferedWriter and FileWriter
Output it to a file: - SELECT agent_index, program_name, description
-
INTO OUTFILE "/tmp/my_table_widgets.out"
-
FROM my_table_widgets
Then to get it back: - LOAD DATA LOCAL INFILE '/tmp/my_table_widgets.out'
-
INTO TABLE my_table_widgets
-
FIELDS TERMINATED BY '\t'
-
LINES TERMINATED BY '\n'
-
(agent_index, program_name, description);
Here is the java to do it: - try {
-
Class.forName(Driver);
-
con = DriverManager.getConnection(connect_url);
-
if(!con.isClosed()){
-
stmt = con.createStatement();
-
-
stmt.executeQuery("SELECT agent_index, program_name, description " +
-
"INTO OUTFILE '/tmp/my_table_widgets.out' " +
-
"FROM my_table_widgets ");
-
}
-
}
-
catch(Exception e) {
-
System.err.println("Exception: " + e.getMessage());
-
}
-
finally {
-
try {
-
if(con != null)
-
con.close();
-
} catch(SQLException e) {}
-
}
-
}
-
}
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Damien |
last post by:
Hi to all,
I need to design an import/export system. Data comes from a filemaker
pro DB in a big CSV file. Some alterations are made on the data as it is
imported into my mysql table. Data is something like :id,text1html,
text1raw,... .
Problems :
1. Texts can contain html tags, including entities (" etc), so
using only the ';' as separator does not work.
2. Some line are so long that is appears php breaks them down, so I lose
|
by: Mike MacSween |
last post by:
My client has an MS Access database application on her local machine. I have
full access to that in terms of changing the design.
I've got a simple PHP/MySql application on shared hosting, so no direct
access to the db server.
I'd like to give her the facility to export the information in her local
Access application to the shared PHP/MySql site. From one command button (or
similar) in the Access application.
|
by: Dave Crypto |
last post by:
Hi there,
SUMMARY:
1) When I use phpadmin to export a large database, the file created on
my local PC never containes all the tables and information. It seems
to max out at about 10mb.
2) Will running mysqldump from command line on a live in-use DB (with
one table containing 350,000 rows) pose any risks and have any large
effect of current use?
|
by: Kajol |
last post by:
Hi All,
can u plz tell me how to import data from mysql to another database.
& how to export data from anotherdata base to mysql
Thanx for ur Advice
Regards
Kajol
|
by: JJ |
last post by:
Hi,
usually, I'm not using MS servers, but I have a big problem with a
Access table.
I should create a web application for a Historical Dipartment.
They have created a populated a Access database using unicode
compression field (for ancient language).
I would like to export this table into MySQL o Postgres, but it's
| |
by: Cynthia |
last post by:
Hi all, I know this can be done, but I just can't seem to find a way to
do it (that I can use myself, or understand).
I use Mac and I've got some databases on my hosting company's MySql
server that I use. I would like to take a database that's on my website
and change it over to use the MySql database. It's currently using a
flat file with pipes (|) to delineate each field.
The "converters" I've found online are all for Windows, and...
|
by: phillip.s.powell |
last post by:
We're looking at a GUI interface for our MySQL DB and I am interested
in MySQL Administrator, however, one of our requirements is to be able
to import/export databases. Is this possible or do I need to know else
(e.g. Navicat)?
Thanks
Phil
|
by: smaczylo |
last post by:
Hello, I've recently been asked to work with Microsoft Access, and
while I feel quite comfortable with Excel, I'm at a complete loss with
databases. If someone could help me with this issue I'm having I'd be
most appreciative. The database is already constructed, I'm just
wanting to export the data to an excel file.
In short, I'm hoping to export two Tables (or queries...not sure which
to use - they both seem to have the same data) in...
|
by: eselk |
last post by:
I'm doing some speed tests. I created a brand-new table, with just
one "Long Integer" field. I'm testing adding 1000 records. If I use
the "Export" feature in Access, it takes only a few seconds to export
the 1000 records to a new table on the server. If I use my code
below, it takes 100 secods (10 records per second). Can someone help
me speed up my code?
--- code ---
Dim con As New ADODB.Connection
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |