Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Development-process fetching data from cosole

Have Programming Question? Ask it here!
 
 
 


prashant
fetching data from cosole
1 Answer(s)      4 years and a month ago
Posted in : Development process


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.


Advertisement
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 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 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 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
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
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
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
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
JSP Get Data Into Dropdown list From Database
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... fetching of data into the dropdown list in JSP using Eclipse IDE and the Tomcat 7
What is lazy fetching in hibernate
What is lazy fetching in hibernate  Hi, What is lazy fetching in hibernate Thanks
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
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
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 from multiple ResultSets?
Data from multiple ResultSets?  hello, How can I get data from multiple ResultSets?   Hi, 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. Please read at http
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
Insert Data From File
Insert Data From File       Insert Data From File is  used to insert data from file... to insert data from file. To understand this example, we create a table 'Stu_Table
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
Insert Data From File
Insert Data From File       Insert Data From File is  used to insert data from file. Understand with Example The Tutorial illustrate an example to insert data from
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
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
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
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
read data from Excel sheet
read data from Excel sheet  Hi, How to read data from an excel sheet using JSP. Thank you
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
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
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
Purge Data from Mysql tables
Purge Data from Mysql tables  Hi, i have to write a mysql procedure to purge data from tables. but written procedure clear entire tables data. Please give me the solution for purging data. CREATE DEFINER=`root`@`localhost
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
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... totalMac_ac1(){ $query1 = "SELECT AVG(MAC) FROM academia1"; $result1
store data from a variable in mysql?
store data from a variable in mysql?  sir last time asked you tell me how to retrieve data from a database mysql and store it in an int variable... of the calculation from an int variable into mysql in a new table of database. how
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
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>
Retrieving specific data from excel
Retrieving specific data from excel  Hello everyone, i have written a simple code to retrieve data from excel sheet and working fine, the excel file... first sheet from the workbook HSSFSheet sheet = workbook.getSheetAt(0
GWT -- retrive the data from Database
GWT -- retrive the data from Database  the user can create an event. In the create page, we have three buttons. Save as draft, preview and save... button, you have to create a dynamic jsp which should read the contents from
retrive data from oracle to jsp
retrive data from oracle to jsp  i am a beginer in jsp so please help... cost and manager name and storing it in the data base. in search proj fiel...(); psmt= conn.prepareStatement("select * from CR_EMPLOYEE_DETAILS
retreive integer data from database
retreive integer data from database  i made a table named result... and two buttons "ok" and "cancel" i want to take input from textfield...=lalit&database=mydb"); String url="select marks from student where rollno
view data from jTextArea to jtable
view data from jTextArea to jtable  good night Please help senior java all, I want to make a brief program of reading data in the text area and then on the show to the j table. I created a new scrip like below but it does
Getting Textbox data from database
Getting Textbox data from database  When i m trying to get data in textbox as readonly from database i m getting following error.and my code is shown... data from database and display it on the textboxes. <%@page language="java
Advertisements
 

 

 

DMCA.com