The setCharacterStream() method of PreparedStatement is used to set character information into the parameterIndex.
Syntax:
Here is another way to read an external CSV into Javascript (using jQuery). It’s a little bit more long winded, but I feel by reading the data into arrays you can exactly follow the process and makes for easy troubleshooting. Might help someone else. The data file example: Time,data1,data2,data2 07:30:16,602,0.009,321 And here is. How to insert xml file data into Mysql Database Table. (max) and you will read the file as a standard text file: using System; using System.IO; class Test public static void Main. Get the Xml data,insert into database table and display in gridview.
1) public void setBinaryStream(int paramIndex,InputStream stream)throws SQLException |
2) public void setBinaryStream(int paramIndex,InputStream stream,long length)throws SQLException |
For storing file into the database, CLOB (Character Large Object) datatype is used in the table. For example:
Java Example to store file in database
Next TopicRetrieving File From Oracle Database
Greenhorn
![Insert Text File Data Into Database Using Java Insert Text File Data Into Database Using Java](/uploads/1/2/6/3/126386202/331155153.png)
Hi All,
I have a excel and .csv file. I have moved this files to server area from local desktop. but now I have to read this file and have to insert the data into a Oracle Database Table. can anyone help me to acheive this.
Thanks in advance.
I have a excel and .csv file. I have moved this files to server area from local desktop. but now I have to read this file and have to insert the data into a Oracle Database Table. can anyone help me to acheive this.
Thanks in advance.
lowercase baba
posted 5 years agoWhat exactly do you need help with? opening the file? parsing it? connecting to the DB? writing the SQL?
As written, your question is a little to vague to get any real help.
As written, your question is a little to vague to get any real help.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Ranch Hand
posted 5 years ago- 1
My suggestion is to focus on one part of the problem at a time.
If I were you I would write some basic requirements for the app and then write some pseudo code first to get a better understanding of exaclty what steps need to be taken.
From there, tackle one step at a time and if you run into issues, post very specific questions about the problem you are running into. Then just keep building on each step.
If I were you I would write some basic requirements for the app and then write some pseudo code first to get a better understanding of exaclty what steps need to be taken.
From there, tackle one step at a time and if you run into issues, post very specific questions about the problem you are running into. Then just keep building on each step.
Greenhorn
posted 5 years agoThis is my requirement:
1)Need to browse a file (csv,txt) and have upload it to the Application Server Area path.
2)Need to read the file from that path and need to insert all column data of the file into a Oracle Table's columns.
1)Need to browse a file (csv,txt) and have upload it to the Application Server Area path.
2)Need to read the file from that path and need to insert all column data of the file into a Oracle Table's columns.
Ranch Hand
posted 5 years agoDoing a quick Google search for 'java read contents of text file' produced a couple resutls with examples of how to read the contest of a text file using Java.
http://stackoverflow.com/questions/326390/how-to-create-a-java-string-from-the-contents-of-a-file
http://stackoverflow.com/questions/16027229/reading-from-a-text-file-and-storing-in-a-string
Start with getting your code to successfully read the contents of the txt or csv file. They print some of the results to the consol to verify it is working properly.
Once you have your code reading the file properly, take a look at JDBC for connecting to the Oracle database. Once you get this working independently, you can put both parts of the application together.
http://stackoverflow.com/questions/326390/how-to-create-a-java-string-from-the-contents-of-a-file
http://stackoverflow.com/questions/16027229/reading-from-a-text-file-and-storing-in-a-string
Start with getting your code to successfully read the contents of the txt or csv file. They print some of the results to the consol to verify it is working properly.
Once you have your code reading the file properly, take a look at JDBC for connecting to the Oracle database. Once you get this working independently, you can put both parts of the application together.
Greenhorn
posted 5 years agoThank you so much. Now I am using openCSV jar to read csv files and text files. is it good to use opencsv.jar ? or is there any other good way to read the csv files ?
Rancher
posted 5 years agoDefine 'good'. There is no shortage of alternatives: https://coderanch.com/how-to/java/AccessingFileFormats