Home Answers Viewqa SQL code save word file in 10g database

 
 


vishu
code save word file in 10g database
1 Answer(s)      3 years and 8 months ago
Posted in : SQL

View Answers

September 10, 2009 at 2:10 PM


Hi Friend,

Try the following code:

import java.io.*;
import java.sql.*;

public class InsertFile {

public static Connection getConnection() throws Exception {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@localhost:3306:test","root", "root"); return conn;
}

public static void main(String[] args)throws Exception {
String id = "001";
String fileName = "C:\\New.doc";

FileInputStream fis = null;
PreparedStatement pstmt = null;
Connection conn = null;
try {
conn = getConnection();
conn.setAutoCommit(false);
File file = new File(fileName);
fis = new FileInputStream(file);
pstmt = conn.prepareStatement("insert into file( file, file_data) values ( ?, ?)");
//pstmt.setString(1, id);
pstmt.setString(1, fileName);
pstmt.setAsciiStream(2, fis, (int) file.length());
pstmt.executeUpdate();
conn.commit();
} catch (Exception e) {
System.err.println("Error: " + e.getMessage());
e.printStackTrace();
} finally {
pstmt.close();
fis.close();
conn.close();
}
}
}

Hope that it will be helpful for you.
Thanks









Related Pages:
code save word file in 10g database - SQL
code save word file in 10g database  I am not having any idea to save the whole word document in Oracle 10g. Please help me.   Hi Friend, Try the following code: import java.io.*; import java.sql.*; public
Text field save as word file
Text field save as word file  Dear experts At run how to save set of text field contains text into single Word file. To save in our desktop computer. Solve my problem
Unable to connect servet, jsp to oracle 10g database.. Unable to retrieve data..
Unable to connect servet, jsp to oracle 10g database.. Unable to retrieve data..  I have a class file AbstractDataAccessObject with the below code... for the connection to the database is specified in the Web-inf >> config
Java save file to database
Java save file to database In this section, you will learn how to insert file to database. Description of code: Firstly, we need to establish a connection...(); } } Through the above code, you can insert any file into the database
Java code to convert pdf file to word file
Java code to convert pdf file to word file  How to convert pdf file to word file using Java
how to save uploaded image in database using javascript
how to save uploaded image in database using javascript  Please can you tell me how to store uploaded image in database using java I'll use the upload code as extArray = new Array(".gif", ".jpg", ".png"); function LimitAttach
Problem reading word file
Problem reading word file  Deepak you provide me code for extarcting equation from a word file and also to write in a word file.But when I again want to read preveously created word file(created by your code) it gives an error
convert word document to pdf
convert word document to pdf  Hi, Could you please help me write a java code that converts the word docuemnt into PDF? I have to save the generated PDFs also. I got a code like the below, and i am unable to download the office
save excel file with save and open dilog box
save excel file with save and open dilog box  following is my jsp code it is working correct.. i want to save excel file throgh jsp bt not by hard...");) user should have freedom to save the file in any location so plz give me
i am getting the problem when i am downloading the pdf file from oracle 10g database - Struts
i am getting the problem when i am downloading the pdf file from oracle 10g database  if i created the pdf file from pdf machine,it is storing into datbase and download the pdf file from database. but when i created the pdf file
How to read data from txt file and save to database MySql - Java Beginners
How to read data from txt file and save to database MySql  Please... save to database from JButton.Please give me a tutorial and source code this. Thank's very much   Hi friend, code to read a file import
error in uploading image from jsp to oracle 10g database
error in uploading image from jsp to oracle 10g database  ... try to insert into the image into the database i got the above error please advice how to get rid of error   JSP upload image in Mysql database
JTextArea to Word Document
: On clicking the button 'Save', the text will get saved in the word file. You... that enable us to perform read, write operations with ms word file. Here we are going to write the data into word document file through a swing component. You can
Full path of image to save it in a folder
Full path of image to save it in a folder  Sir ,I am trying to upload a file but only sends file name as parameter. I want a code that would help me.... saving the file uploaded into the database, which would require the use
How to save form data to a csv file using jquery or ajax
How to save form data to a csv file using jquery or ajax  Please let... this. i am able to read the csv file using this code if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari data=new
How i upload file and save that record in database using JSP?
How i upload file and save that record in database using JSP?  Hi All, I m the beginner in JSP and I want to upload the file and store that file and some other form data in MySQL database. Ex. There is one employee detail form
stop word removal from text file
stop word removal from text file  i need java source code for stop word removal from a text file
SQL database parameters should save at where?
SQL database parameters should save at where?  Hi, Currently... the script will be running for very long time, I like to move the SQL database parameters to the file and read using JAVA I/O and allow user to edit the file
Which extension i use for save hibernate file.
Which extension i use for save hibernate file.   Please give me answer that which extension i use for save the hibernate file and how i run that file... the class object to the database table. Another is the hibernate configuration file
Export Database table to CSV File
Export Database table to CSV File In this tutorial, you will learn how to retrieve data from database and save it to CSV File. The Comma-separated values... as writing into a CSV file. Here is a database table is to be extracted: Example
Save file on Client Machine - Development process
Save file on Client Machine  Hi my application is running on main... from his machine try to save the file it gets saved in the serve machine i want to save the file created by my application on the client machine how can i do
Insert image from user using and save in database
Insert image from user using and save in database  when i am trying to upload a image from user and trying to save into oracle9i database... occurred processing JSP page /upload.jsp at line 27 24: String file
Save JRadioButton Text in to database - Java Beginners
Save JRadioButton Text in to database   Hello Sir I have Two JaradioButtons 1)Semwise Course 2)Yearwise Course I want To Save Text from... the following code: import java.sql.*; import javax.swing.*; import
save uiimage to photo library
or not The given code is the second step "How to save or write a clicked picture...save uiimage to photo library  How to saved the clicked picture on camera roll in iPhone. I always want to write the file into photo library.  
Insert Image into Mysql Database through Simple Java Code
simple java code that how save image into mysql database. Before running this java code you need to create data base and table to save image in same database... Insert Image into Mysql Database through Simple Java Code
save switch data into database - Java Beginners
save switch data into database  switch(menu) { case 1://add a student System.out.print("Enter student ID: "); int ID = scan.nextInt...;  Hi Friend, Try the following code: import java.sql.*; import
How to upload and save a file in a folder - Java Beginners
How to upload and save a file in a folder  Hi How to upload and save a file in a folder? for example Agreement.jsp File: So when... should be able to access the file. Can u please tell me the code..  
How to save JPanel as gif or jpeg file
How to save JPanel as gif or jpeg file  i draw polygons , rectangles, lines on jpanel using draw line method drawpolygon methods etc, now i want save the data of jpanel which is drawn by me(lines,polygons) as a gif or jpeg file
Scanning a word in a TEXT document......
Scanning a word in a TEXT document......  Hi Genius persons... I'm... that files(ms.word) and separate them in DATABASE. i want to scan the files by searching the JAVA and .net words present in the files..if JAVA word is present means
Scanning a word in a TEXT document......
Scanning a word in a TEXT document......  Hi Genius persons... I'm... that files(ms.word) and separate them in DATABASE. i want to scan the files by searching the JAVA and .net words present in the files..if JAVA word is present means
Display the data to MS word
the database(say im searching using an id) and should display it on the ms word , i want it to be in a good format. FOr example my word doc has to be Name... for this then explain how i use it..a sample code to get it from db generating
upload and retrieve a word document - JSP-Servlet
with uploading a word document to My sql database to a BLOB data type variable. And also unable to retrieve the word document from database. I am writing the code... : 1.create table in database "file_tbl" CREATE TABLE `file_tbl` ( `id
how to match the key word from a text file
how to match the key word from a text file  p>Hi all, I have the code to match the key word and from the text. I have input like this reader.txt... code is as follows **import java.io.*; import java.io.BufferedReader
i want to save image on server folder. and i want to save URL of this folder and name of image in database
i want to save image on server folder. and i want to save URL of this folder and name of image in database  hi i want to save image on server folder. and i want to save URL of this folder and name of image in database.on click
URL file Download and Save in the Local Directory
URL file Download and Save in the Local Directory       This Program file download  from  URL and save this Url File in the specified directory. This program specifies
upload and save the file
upload and save the file  upload and save a file from a computer to specific location of remote computer using jsp
storing date from html form to oracle 10g using servlet
this date month year from html form into oracle 10g database where i have...","ors"); // code for inserting date into oracle 10g in the format of oracle...storing date from html form to oracle 10g using servlet  i have
storing date from html form to oracle 10g using servlet
this date month year from html form into oracle 10g database where i have...","ors"); // code for inserting date into oracle 10g in the format of oracle...storing date from html form to oracle 10g using servlet  i have
Save profile and image to mysql database, and view the image in another jsp page
Save profile and image to mysql database, and view the image in another jsp page  Pls. need help in saving the profile info with the image in mysql database.. some basic code pls in jsp... thanks in advance
How to add save as dialoguebox to export into excel instead of directly saving..
from database and generated excel file at particular directory of my system... the facility to give name and save to particular location. plz sir give me the code...How to add save as dialoguebox to export into excel instead of directly saving
String file in to word file in java
String file in to word file in java  How to convert a String format notepad file into Ms word file in java
Compare two word file
Compare two word file  How to compare two word file using Java
Convert Text To Word
; In this example, You will learn how to convert text to word file. Here, we are going to discuss about the conversion of text to word file.  Core... file. This program converts the text to word file by using FileOutputStream("
String file in to word file in java
String file in to word file in java  how to convert a String format word file into Ms Word file using java? please can anyone of you help me
How to save excel sheet into mysql database using blob or clob
How to save excel sheet into mysql database using blob or clob  Hi... me the steps to do this, i am able to connect to the database, from there i don't...) ); Please help me with the code or steps to insert a large xlsx sheet. waiting
what is proper way to save pictures in SQl database and call it through JSP ?
what is proper way to save pictures in SQl database and call it through JSP ?  Hi guys, I usually store picture path in DB and call them through... this, and Please send me a proper programe code regarding this segment(If possible). Please
save output in multiple text files
save output in multiple text files  Hi..I'm getting problem to store the output of this php code into multiple text files. Can anyone sugeest. Here is my code: <?php for($i=1; $i<=100; $i++) { $html = file_get
How to save JCombobox Selected Item in to Access Database - Java Beginners
How to save JCombobox Selected Item in to Access Database  How to save JCombobox Selected Item in to Access Database  Hi Friend, Try the following code: import java.sql.*; import javax.swing.*; import
Java - search/find a word in a text file - Java Beginners
]; String result = st[3]; if (result.equals(word)) { File file = new...Java - search/find a word in a text file  Hello, I would like... to search them for a word. The word will be PASS or it can be FAIL. If PASS I
how to save html form data into .csv file using only jsp.
how to save html form data into .csv file using only jsp.  Dear all, I am developing a website only using jsp and html. i need to save the form data into a .csv file using jsp. can anyone give me any sample solution or tutorial

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.