How can i open a DOC or TXT file and insert the data into table?
How can i open a DOC or TXT file and insert the data into table?
I have a doc file . the doc include some columns and some rows.(for example 'ID,Name,Date,...').
I'd like open DOC file and I'd like insert them into the table with same columns.
Thanks.
Use the SQL*Loader utility or the UTL_FILE package.
Similar Messages
-
(Urgent help needed) how to read txt file and store the data into 2D-array?
Hi, I have a GUI which allow to choose file from the file chooser, and when "Read file" button is pressed, I want to show the array data into the textarea.
The sample data is like this followed:
-0.0007 -0.0061 0.0006
-0.0002 0.0203 0.0066
0 0.2317 0.008
0.0017 0.5957 0.0008
0.0024 1.071 0.0029
0.0439 1.4873 -0.0003
I want my program to scan through and store these data into 2D array.
However for some reason, my source code issues errors, and I don't know what's wrong with it, seems to have a problem in StringTokenizer though. Can anybody help me?
Thanks in advance.
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.StringTokenizer;
public class FileReduction1 extends JFrame implements ActionListener{
// GUI features
private BufferedReader fileInput;
private JTextArea textArea;
private JButton openButton, readButton,processButton,saveButton;
private JTextField textfield;
private JPanel pnlfile;
private JPanel buttonpnl;
private JPanel buttonbar;
// Other fields
private File fileName;
private String[][] data;
private int numLines;
public FileReduction1(String s) {
super(s);
// Content pane
Container cp = getContentPane();
cp.setLayout(new BorderLayout());
// Open button Panel
pnlfile=new JPanel(new BorderLayout());
textfield=new JTextField();
openButton = new JButton("Open File");
openButton.addActionListener(this);
pnlfile.add(openButton,BorderLayout.WEST);
pnlfile.add(textfield,BorderLayout.CENTER);
readButton = new JButton("Read File");
readButton.addActionListener(this);
readButton.setEnabled(false);
pnlfile.add(readButton,BorderLayout.EAST);
cp.add(pnlfile, BorderLayout.NORTH);
// Text area
textArea = new JTextArea(10, 100);
cp.add(new JScrollPane(textArea),BorderLayout.CENTER);
processButton = new JButton("Process");
//processButton.addActionListener(this);
saveButton=new JButton("Save into");
//saveButton.addActionListener(this);
buttonbar=new JPanel(new FlowLayout(FlowLayout.RIGHT));
buttonpnl=new JPanel(new GridLayout(1,0));
buttonpnl.add(processButton);
buttonpnl.add(saveButton);
buttonbar.add(buttonpnl);
cp.add(buttonbar,BorderLayout.SOUTH);
/* ACTION PERFORMED */
public void actionPerformed(ActionEvent event) {
if (event.getActionCommand().equals("Open File")) getFileName();
if (event.getActionCommand().equals("Read File")) readFile();
/* OPEN THE FILE */
private void getFileName() {
// Display file dialog so user can select file to open
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
int result = fileChooser.showOpenDialog(this);
// If cancel button selected return
if (result == JFileChooser.CANCEL_OPTION) return;
if (result == JFileChooser.APPROVE_OPTION)
fileName = fileChooser.getSelectedFile();
textfield.setText(fileName.getName());
if (checkFileName()) {
openButton.setEnabled(false);
readButton.setEnabled(true);
// Obtain selected file
/* READ FILE */
private void readFile() {
// Disable read button
readButton.setEnabled(false);
// Dimension data structure
getNumberOfLines();
data = new String[numLines][];
// Read file
readTheFile();
// Output to text area
textArea.setText(data[0][0] + "\n");
for(int index=0;index < data.length;index++)
for(int j=1;j<data[index].length;j++)
textArea.append(data[index][j] + "\n");
// Rnable open button
openButton.setEnabled(true);
/* GET NUMBER OF LINES */
/* Get number of lines in file and prepare data structure. */
private void getNumberOfLines() {
int counter = 0;
// Open the file
openFile();
// Loop through file incrementing counter
try {
String line = fileInput.readLine();
while (line != null) {
counter++;
System.out.println("(" + counter + ") " + line);
line = fileInput.readLine();
numLines = counter;
closeFile();
catch(IOException ioException) {
JOptionPane.showMessageDialog(this,"Error reading File",
"Error 5: ",JOptionPane.ERROR_MESSAGE);
closeFile();
System.exit(1);
/* READ FILE */
private void readTheFile() {
// Open the file
int row=0;
int col=0;
openFile();
System.out.println("Read the file");
// Loop through file incrementing counter
try {
String line = fileInput.readLine();
while (line != null)
StringTokenizer st=new StringTokenizer(line);
while(st.hasMoreTokens())
data[row][col]=st.nextToken();
System.out.println(data[row][col]);
col++;
row++;
closeFile();
catch(IOException ioException) {
JOptionPane.showMessageDialog(this,"Error reading File",
"Error 5: ",JOptionPane.ERROR_MESSAGE);
closeFile();
System.exit(1);
/* CHECK FILE NAME */
/* Return flase if selected file is a directory, access is denied or is
not a file name. */
private boolean checkFileName() {
if (fileName.exists()) {
if (fileName.canRead()) {
if (fileName.isFile()) return(true);
else JOptionPane.showMessageDialog(null,
"ERROR 3: File is a directory");
else JOptionPane.showMessageDialog(null,
"ERROR 2: Access denied");
else JOptionPane.showMessageDialog(null,
"ERROR 1: No such file!");
// Return
return(false);
/* FILE HANDLING UTILITIES */
/* OPEN FILE */
private void openFile() {
try {
// Open file
FileReader file = new FileReader(fileName);
fileInput = new BufferedReader(file);
catch(IOException ioException) {
JOptionPane.showMessageDialog(this,"Error Opening File",
"Error 4: ",JOptionPane.ERROR_MESSAGE);
System.out.println("File opened");
/* CLOSE FILE */
private void closeFile() {
if (fileInput != null) {
try {
fileInput.close();
catch (IOException ioException) {
JOptionPane.showMessageDialog(this,"Error Opening File",
"Error 4: ",JOptionPane.ERROR_MESSAGE);
System.out.println("File closed");
/* MAIN METHOD */
/* MAIN METHOD */
public static void main(String[] args) throws IOException {
// Create instance of class FileChooser
FileReduction1 newFile = new FileReduction1("File Reduction Program");
// Make window vissible
newFile.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
newFile.setSize(500,400);
newFile.setVisible(true);
Java.lang.NullpointException
at FileReductoin1.readTheFile <FileReduction1.java :172>
at FileReductoin1.readFile <FileReduction1.java :110>
at FileReductoin1.actionPerformed <FileReduction1.java :71>
.1) Next time use the CODE tags. this is way too much unreadable crap.
2) The problem is your String[][] data.... the only place I see you do anything approching initializing it is
data = new String[numLines][];I think you want to do this..
data = new String[numLines][3];anyway that's why it's blowing up on the line
data[row][col]=st.nextToken(); -
Want to Read the a txt file and put the data into the table colums.
I have a text file in which data is piped separated and I want to put the data in the table column.
Eg.
Text File Column
First_name|Last_name|address|phone_number
Database table:
first_name ,last_name,address,phone_number
It's very urgent.
Thanks For your help in advance.
HimanshuUse sqlldr or external file.
See http://download.oracle.com/docs/cd/E11882_01/server.112/e10701/part_ldr.htm#i436326 for SQL Loader.
See http://download.oracle.com/docs/cd/E11882_01/server.112/e10595/tables013.htm#ADMIN11705 for External table. -
How can i re-enable/restore a disabled iPad and keep the data without using a laptop or iCloud
Hello,
Is there a way to re-enable a disabled iPad and maintain the data taking into consideration that no iCloud backup was made and the computer it was last synced with was not available? any idea?No, sorry. Without a backup in iCloud or iTunes, you will have to set it up as if new and anything on it will be lost now.
You can always re-download purchased apps and content (other than audiobooks) once it is restored, from the respective iTunes or App stores. -
How can i retrieve documents(e.g .doc,.pdf, .txt etc) using forms from the database.
i inserted the documents using sql*loader, below is the control and data files.
-- control file
LOAD DATA
infile 'load.txt'
INTO TABLE husman
APPEND
FIELDS TERMINATED BY ','
(id integer external,
fname FILLER CHAR(50),
docu LOBFILE(fname) TERMINATED BY EOF)
--data file
1,../husman/dell.doc,
2,../husman/me.pdf,
3,../husman/export.txt,
in the form i have a text field to display the id and an OLE container to display the document as an icon. but when i execute query, i only get the id number and not the document.
any help will be appreciated.
Thanks
Hussein SaigerStep by step
1. Erase all contents and settings
2. You'll be asked twice to confirm
3. You'll see Apple logo and progress bar
4. You'll see a big iPad logo on screen
5. Configuration start
6. Set language
7. Set country
8. Enable Location Service
9. Select network, enter password and join network
10. You'll be given 3 options (a) Setup as New iPad (b) Restore from iCloud Backup (c) Restore from iTune Backup
11. Selected Restore from iCloud Backup
12. You'll be required to enter Apple ID and Password
13. Agree to Terms and Conditions
14. Select Backup file
15. You'll see progress bar
16. Red slider will appear; slide to unlock; step #1 to #16 is fast
17. Pre-installed apps will be restored first
18. Message: Purchased apps and media will now be automatically downloaded
19. You'll see a pageful of apps with Waiting/Loading/Installing
20. Message: Some apps cannot be downloaded, please sync with computer -
How to skip certain lines for a txt file and insert into array
so here is my question:
i had a file to read, and it requires to input into the array starting from a certain line
example:
4
john 25 M
mary 22 F
lee 20 M
faye 10 F
faye john
mary john
mary faye
i want to insert the friend list, starting 5th line into a 2d array, which is the int from first line +1.
can someone help me with it?
i believe there is a skip method and stuff..
but just dont know how to use it
may someone tell me how to do tat?the thing is i think that takes too long and it is not efficient..
however...i just solved it with a better method
Scanner in = new Scanner (reader);
int size = Integer.parseInt(in.next());
BufferedReader insert = new BufferedReader(new FileReader(new File(input)));
String line = null;
int count = 0;
int startAtLineNo =size+1; // 0-based
while ((line = insert.readLine()) != null) {
if (count >= startAtLineNo) {
/* do stuff */
System.out.println(line);
// else ignore
count++;
thanks anyways -
How can i read the text files and buffer the data in Vector?
hi. I have been running into this problem for days, but with no luck and losing right direction.
The problem is : I am trying to read a text file and buffer the data into a
Queue for each user.
the sample text file is as below:( 1st column is timestamp, 2nd is user_id, 3rd is packet_id, 4th is packet_seqno, 5th is packet_size)
0 1 1 1 512
1 2 1 2 512
2 3 1 3 512
3 4 1 4 512
4 5 1 5 512
5 6 1 6 512
6 7 1 7 512
7 8 1 8 512
8 9 1 9 512
9 10 1 10 512
10 1 2 11 512
11 2 2 12 512
12 3 2 13 512
13 4 2 14 512
14 5 2 15 512
15 6 2 16 512
16 7 2 17 512
17 8 2 18 512
18 9 2 19 512
19 10 2 20 512
20 1 3 21 512
21 2 3 22 512
22 3 3 23 512
23 4 3 24 512
24 5 3 25 512
25 6 3 26 512
26 7 3 27 512
27 8 3 28 512
28 9 3 29 512
29 10 3 30 512
30 1 4 31 512
31 2 4 32 512
32 3 4 33 512
33 4 4 34 512
34 5 4 35 512
35 6 4 36 512
36 7 4 37 512
37 8 4 38 512
38 9 4 39 512
39 10 4 40 512
40 1 5 41 512
41 2 5 42 512
42 3 5 43 512
43 4 5 44 512
44 5 5 45 512
45 6 5 46 512
46 7 5 47 512
47 8 5 48 512
48 9 5 49 512
49 10 5 50 512
50 1 6 51 512
51 2 6 52 512
52 3 6 53 512
53 4 6 54 512
54 5 6 55 512
55 6 6 56 512
56 7 6 57 512
57 8 6 58 512
58 9 6 59 512
59 10 6 60 512
60 1 7 61 512
61 2 7 62 512
62 3 7 63 512
63 4 7 64 512
64 5 7 65 512
65 6 7 66 512
66 7 7 67 512
67 8 7 68 512
68 9 7 69 512
69 10 7 70 512
70 1 8 71 512
71 2 8 72 512
What I wanna do is to read all the data above and buffer them in a queue for each user( there are only 10 users in total).
I already created a class called Class packet:
public class packet {
private int timestamp;
private int user_id;
private int packet_id;
private int packet_seqno;
private int packet_size;
/** Creates a new instance of packet */
public packet(int timestamp,int user_id, int packet_id,int packet_seqno, int packet_size)
this.timestamp = timestamp;
this.user_id=user_id;
this.packet_id=packet_id;
this.packet_seqno=packet_seqno;
this.packet_size=packet_size;
}then I wanna to create another Class called Class user which I can create a queue for each user (10 users in total) to store type packet information. the queue for each user will be in the order by timestamp.
any idea and sample code will be appreciated.Doesn't sound too hard to me. Your class User (the convention says to capitalize class names) will have an ArrayList or Vector in it to represent the queue, and a method to store a Packet object into the List. An array or ArrayList or Vector will hold the 10 user objects. You will find the right user object from packet.user_id and call the method.
Please try to write some code yourself. You won't learn anything from having someone else write it for you. Look at sample code using ArrayList and Vector, there's plenty out there. Post in the forum again if your code turns out not to behave. -
How can I open Microsoft doc attached to my iPad email
How can I open Microsoft doc attached to my iPad email
The document should open as an email attachment in the mail app. Did you tap on the icon in order to open the file?
However, if you want to save or edit the document, then you will need a Word compatible app on the iPad. pages, Documents To Go, quick Office Pro ... And others are available in the app store.
But you can open and read it right from the mail app as an attachment. -
How can I open two screens of Adobe digital editions at the same time?
How can I open two screens of Adobe digital editions at the same time?
I doubt that you can. Doesn't the Sound prefpane require you to select just one output device?
-
How can I open McAfee encrypted (EEFF) PDF files with Adobe Reader?
How can I open McAfee encrypted (EEFF) PDF files with Adobe Reader? Get error "There was an error opening this document. Access denied". Disabling Protected Mode in Reader doesn’t always work.
McAfee: https://kc.mcafee.com/corporate/index?page=content&id=KB74299&actp=search&viewlocale=en_US &searchid=1240943327683If Reader ISN'T in the list of prpgrams to open with, click "Browse"
In the "Browse window" go to C/Program files [or Program Files (x86)]/Adobe/Reader 11/Reader
Select "AcroRd32.exe" and click "Open"
Make sure "Always use the selected program to open this kind of file" is checked and click "OK". -
How can i open a raw nikon D300s file in photoshop 7.0.1?
The D300s was first supported in Camera Raw 5.5
http://helpx.adobe.com/creative-suite/kb/camera-raw-plug-supported-cameras.html
Raw 5.5 is only compatible with Photoshop CS4 and later
http://helpx.adobe.com/x-productkb/global/camera-raw-compatible-applications.html
Your options:
Join the Cloud, or
Buy CS6, or
Convert the Raw files from the D300s to DNGs using Adobe's free DNG converter
http://www.adobe.com/products/photoshop/extend.displayTab2.html
Then edit the DNGs in Photoshop 7.0.1 -
HT3775 How can I open a flv (flash video) file on my iMAC OS Snow Leopard??
My problem:
How can I open a flv (flash video) file on my iMAC OS Snow Leopard?Try VLC Media Player 2.0.3 or MPlayerX 1.0.14.
-
How to search a special string in txt file and return it's position in txt file?
How to search a special string in txt file and return it's position in txt file?
I just posted a solution for a similar question here: http://forums.ni.com/ni/board/message?board.id=170&view=by_date_ascending&message.id=362699#M362699
The top portion can search for the location of a string, while the bottom portion is to locate the position of a character. Both can search for a character.
The position of the character within the file is displayed in the indicator(s).
R -
i have a 2008 macbook and i lost the start up disk and forgot the password. how can i put it back to factory mode and change the password
Check out this article http://gigaom.com/apple/reset-os-x-password-without-an-os-x-cd/
-
How can I extract part of a PDF file and copy it to a new PDF file?
How can I extract part of a PDF file and copy it to another PDF file?
You will need Adobe Acrobat for this.
Maybe you are looking for
-
When I recently switched on my computer a BIOS gave me this message: A Hyper Transport sync flood occured on last boot. Press F1 to Resume It sounds a little .. terrifying and i really don't like the world flood. I have: K9N Platinum 601-7250-020...,
-
Createtablespace.sql is creating tablespaces in wrong sid
Hi, We are in the process of performing system copy of EHP4 for TDMS shell creation using standard system copy process as suggested by sap. During export while SAPInst asked for Import Migration Directory we provided the export dump of target system
-
Display datamodel values in matrixform
Hi, I am able to generate dynamic columns in table using datamodel. Please guide how to place values in that table using datamodel as shown below. 2009 2008 2007 X 10 20 30 X 30 40 40 Y 20 10 2 Z 1 2 1 Thanks in advance
-
Need more information about TSW
We had a opening for IS-Oil TSW can anyone explain what is TSW since some candidates have done through SD and Some with MM exposure or can TSW can be worked in both modules feel free to mail me Thanks Sara
-
I have 3990 songs showing on iTunes and 3965 showing on my ipod. Is there an easy way to figure out which songs aren't syncing?