fetching data from cosole

fetching data from cosole

Hi Deepak,
i hv parsed the pdf file into the console (using Pdfbox). output is proper.now i want that console data into the database?
how can i parse that console data and save it into the database? please your help is appreciated.

Prashant.

View Answers

June 19, 2010 at 5:50 PM

Hi Friend,

We have used itext api. Here is the code:

import java.io.*;
import java.sql.*;
import java.util.*;
import com.lowagie.text.*;
import com.lowagie.text.pdf.*;

public class ReadPDF {
public static void main(String[] args) throws IOException {
try {
Document document = new Document();
document.open();
PdfReader reader = new PdfReader("file.pdf");
PdfDictionary dictionary = reader.getPageN(1);
PRIndirectReference reference = (PRIndirectReference) dictionary
.get(PdfName.CONTENTS);
PRStream stream = (PRStream) PdfReader.getPdfObject(reference);
byte[] bytes = PdfReader.getStreamBytes(stream);
PRTokeniser tokenizer = new PRTokeniser(bytes);
StringBuffer buffer = new StringBuffer();
while (tokenizer.nextToken()) {
if (tokenizer.getTokenType() == PRTokeniser.TK_STRING) {
buffer.append(tokenizer.getStringValue());

}

}
String test = buffer.toString();
System.out.println(test);
String arr[]=test.split(" ");
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","root";);
Statement st=con.createStatement();
int i=st.executeUpdate("insert into data(name,address) values('"+arr[0]+"','"+arr[1]+"')");
} catch (Exception e) {
}
}
}

Thanks









Related Tutorials/Questions & Answers:
fetching data from cosole - Development process
fetching data from cosole  Hi Deepak, i hv parsed... that console data into the database? how can i parse that console data and save... into data(name,address) values('"+arr[0]+"','"+arr[1]+"')"); } catch (Exception e
Data fetching from JSP or HTML - JSP-Servlet
Data fetching from JSP or HTML  Hi Deepak, Can u pls help me as i have a problem with jsp/html frameset. my question is how can i fetch the data from frameset which is in html format.pls help me. Thanks
Advertisements
Fetching the exact data from file using java
Fetching the exact data from file using java  **hi ... i am having one .lst file.. that file consists of instructions and opcodes.. now i want to fetch only the opcode from that file.. could u pls anyone guide me this using java
iphone storing and fetching data
iphone storing and fetching data  How to store and fetch data in an iphone application
Fetching image from database
Fetching image from database  I have uploaded image path and image name in database so, now how can i display that image using JSP or HTML page(is it possible to display using tag using concatination). image path i have stored
fetching data using servlets - SQL
for fetching data from a ORACLE10g database using SERVLETS.   Hi Friend...fetching data using servlets  I have successfully made connection.... But the codes that i have tried for fetching the data are not working even
Fetching data from excel file on other website and display in interactive graph form
Fetching data from excel file on other website and display in interactive graph form  Hello, I am making a website using HTML and CSS, I am done... pull data data from those and generate graphs out of it? I really need it urgently
autocompletion in textfield fetching from database in jsp
autocompletion in textfield fetching from database in jsp  hi i want to retrieve country name from mysql db to textfield.. maeans if anyone type first letter of the name it should show the corresponding names in the list
how to create a bar chart in jsp by fetching value from oracle databse?
how to create a bar chart in jsp by fetching value from oracle databse?  i want to show the population of various states in a bar chart in my jsp page by fetching the data from my oracle table. i am using my eclipse as my IDE
Fetching database field from servlet to jsp page ?
Fetching database field from servlet to jsp page ?  Hello Java... field. I wanted to pass some of the database field from servlet to jsp... (i... ArrayList<String>(); String sql = "select * from country
Java Cosole not Displaying Greek letters - WebSevices
Java Cosole not Displaying Greek letters  Hello Team, I developed a webservice which reads data from xml string and stores in the data base, i got a new requirement to read Greek and Arabic characters from the xml and store
JSP Get Data Into Dropdown list From Database
for fetching data from the database and set it into the dropdown list in JSP...JSP Get Data Into Dropdown list From Database In this section we will discuss.... This tutorial explains you that how to fetch data from database and set
how to refresh google map using ajax by fetching lat long from database
how to refresh google map using ajax by fetching lat long from database ... the route travelled by it will be displayed on the google map by fetching the lat long from db. Now, i need to refresh the map using ajax.Pls help me how to do
extract data from HTML
extract data from HTML  how to write the coding for to extract data from html tags like(h3,p) and then extracted data should be stored in data base? can anybody tell me how to write the coding
data science from iim
data science from iim  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: data science from... the topic "data science from iim". Also tell me which is the good
data analytics from iim
data analytics from iim  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: data analytics... the topic "data analytics from iim". Also tell me which is the good
Data from multiple ResultSets?
Data from multiple ResultSets?  hello, How can I get data from multiple ResultSets?   Hi,ADS_TO_REPLACE_1 You can iterate the ResultSet separately and get the required data. Thanks
selecting data from database
selecting data from database  how to select data from database using Dao in struts   Hi, You have to load the data from database using hibernate and send the data in a Java file object to jsp page.ADS_TO_REPLACE_1
Select data from diplicated data
Select data from diplicated data  hello i have table location... location FROM (".$is.") WHERE sub_cat=('".$id."')"; $result = mysql_query($SQL...++) { $SQL = "SELECT duration FROM core_network WHERE location=('".$location_c[$k
Insert Data From File
Insert Data From File       Insert Data From File is  used to insert data from file... an example to insert data from file. To understand this example, we create
retrive data from database
retrive data from database   hi.. i made a application form. it's have attribute s.no,name,roll no and i enter a few records. now i want to view all record not in database access sheet i want to view it at any another
retrive data from database?
retrive data from database?  hellow i have a database sheet name as db1. it's contain sixty(60) sn,name ,rollno(primary key),father's name etc... from db1 and enter value in text box according there name,rollno and save
to bring checked data from one page to another
fetching data from the database on second jsp page with checkbox corresponding each...to bring checked data from one page to another  thanks for your help... on save button then the two rows data should print on first jsp page without making
What is lazy fetching in hibernate
What is lazy fetching in hibernate  Hi, What is lazy fetching in hibernate Thanks
Insert Data From File
Insert Data From File       Insert Data From File is  used to insert data from file... an example to insert data from file. To understand this example, we create
parse data from a link in java
parse data from a link in java  Hi, Here I want code for Extracting data from a link and the data a must be stored in mysql and then I need to display the data in a jsp page
fetch data from database in javascript
fetch data from database in javascript   How to fetch data from database in JavaScript when it is a leap year
how to retrieve data from database ?????/
how to retrieve data from database ?????/  how to retrieve data from database
how to retrieve data from database ?????/
how to retrieve data from database ?????/  how to retrieve data from database
how to retrieve data from database ?????/
how to retrieve data from database ?????/  how to retrieve data from database
how to retrieve data from database ?????/
how to retrieve data from database ?????/  how to retrieve data from database
how to fetch data from servlet ????
how to fetch data from servlet ????  how to fetch data from servlet
Getting data from servlet into javascript
Getting data from servlet into javascript  How do i get json data from my servlet on to a variable in javascript n bind the data to display onto sigma grid.Has anyone Idea how to do
read data from Excel sheet
read data from Excel sheet  Hi, How to read data from an excel sheet using JSP. Thank you
how to retrieve data from database
how to retrieve data from database  unable to retrieve data from database using mySQL by using jsp sessions and beans for editing
learn data science from scratch
learn data science from scratch  Hi, I am beginner in Data Science... data science from scratch Try to provide me good examples or tutorials links so that I can learn the topic "learn data science from scratch". Also
data science jobs from home
data science jobs from home  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: data... can learn the topic "data science jobs from home". Also tell me which
data science course from iim
data science course from iim  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: data... can learn the topic "data science course from iim". Also tell me
data science course from iit
data science course from iit  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: data... can learn the topic "data science course from iit". Also tell me
Data fetch from multiple SQL tables - Hibernate
example of HQL fetching data from multiple tables would be a help. I have tried...Data fetch from multiple SQL tables   I am in the process of writing my first hibernate application. I have a sql query that fetches data from
Data extraction from an image file.
Data extraction from an image file.  I have made an image... data from the the image which also include deleted data.Can i used java to extract these data from the image file? Which are the libraries to be used
Retrieve The Data From MySql Datbase
Retrieve The Data From MySql Datbase   How to Retrieve The Data From MYSQL database TO Use Select the Emp_id Option.And Also Search Option
delete data from database - SQL
delete data from database  HOw to delete specific data from table> I want to delete one record from database. Thnx  Hi friend, -------------------------------------------- Visit for more information
How to delete data from MySQL?
How to delete data from MySQL?  Hi, How I can conditionally delete the data from MySQL Table? Thanks   Hi, You can use the where clause to conditionally delete the data from MySQL database table. Here is some query
Problem in accessing data from Database
Problem in accessing data from Database  hi..... i'm making a project... is text and all others are of currency data type. If i enter 0 or null value in currency column and then try to retrieve data using my servlet coding
Database fetching problem
Database fetching problem  I have multiple database table and want to get all records in one object how can i do this.Pls guide
retrieve data from database with hyperlink
retrieve data from database with hyperlink  sir....i have one table called 'name' having two values i have to retrieve those data with a hyperlink and show in browser and if we click hyperlink its shows his sub categories....how
FAILED TO INSERT DATA FROM FUNCTION();
FAILED TO INSERT DATA FROM FUNCTION();  HELLO, I HAVE A PROBLEM TO INSERT DATA FROM OUTPUT FROM FUNCTION()... I WANT TO STORE THE OUTPUT IN DATABASE...(){ $query1 = "SELECT AVG(MAC) FROM academia1"; $result1 = mysqlquery($query1
retrieve data from mysql database
retrieve data from mysql database  hi am not familiar in php.....even... selected value on combobox which is to be retrieve the relevant data from mysql... * from testtable where Fname like '%$term%'"); while ($row = mysql<em>
To retrive data from database - Struts
To retrive data from database  How to get values ,when i select a select box in jsp and has to get values in textbox automatically from database? eg... come to jsp page automatically from database

Ads