read text file and store the data in mysql 1 Answer(s) 3 years and 4 months ago
Posted in : JDBC
when we store the data in mysql table from text file its store the data from new line to new column. how to store the data in different column from a single line of text file.
public class InsertFileData{ public static void main(String[]args){ try{ Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/register", "root", "root"); Statement st=con.createStatement();
FileInputStream fstream = new FileInputStream("C:\\student.txt"); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strLine; ArrayList list=new ArrayList(); while ((strLine = br.readLine()) != null){ list.add(strLine); } Iterator itr; for (itr=list.iterator(); itr.hasNext(); ){ String str=itr.next().toString(); String [] splitSt =str.split(" "); String id="",name="",course="",deptt=""; for (int i = 0 ; i < splitSt.length ; i++) { id=splitSt[0]; name=splitSt[1]; course=splitSt[2]; deptt=splitSt[3]; }
int k=st.executeUpdate("insert into student(id,name,course,department) values('"+id+"','"+name+"','"+course+"','"+deptt+"')");
} } catch(Exception e){} } }
Thanks
Related Pages:
read text file and store the data in mysql - JDBC readtextfile and store the data in mysql when we store the data in mysql table from textfile its store the data from new line to new column. how to store the data in different column from a single line of textfile. 
how to store data in a text file - Java Beginners
how to storedata in a text file Hi friends,
I want to know, how we can save the data in a .txt file using swings....... for example, i want to store the arraylist data of swing program into a textfile.......and also i want
read from file and store using hash map read from file and store using hash map I was stuck with a java project where I have to read a file with two different concepts and store them differently in hashmap. My datafile would be something like
Adults:
Name, xyz
Read specific column data from text file in java Read specific column data from textfile in java My question is if my textfile contain 15 columns and i want read specific column data from that textfile then what code i should do
store and retrieve data store and retrieve data sir,i want to store the entering data... for this?
Please visit the following links:
Java Read word file
Java Write data into word file
For this, poi-scratchpad-3.7-20101029.jar is needed
Read Text file from Javascript - JSP-Servlet ReadTextfile from Javascript plz send the code How to Retrieve the data from .txt file thru Javascript? And how to find the perticular words in that file
store
store i want to storedata in (.dat) file format using swing and perform operation on that insertion,deletion and update
Read text File Readtext File Hi,How can I get line and keep in a String in Java
Java file read write operation
Java fileread write operation how to read and write the data from text file.Suppose i have textfile with 4 fields name ,roll no ,marks1,marks2 with more than 20 records......i need to store these value in object and pass
How to read file in java
How to readfile in java
Java provides IO package to perform reading and writing operations with a
file. In this section you will learn how to read a text... the given file name.
read()-The read() method of FileInputStream class reads
Read Write Read Write Hi;
How can I read certain line of say 10 text files and write to one textfile
Java Read Multiple Files and store the data... and stored the data into another textfile.
import java.io.*;
import
Insert text file data into Database
Insert textfiledata into Database
In this section, you will learn how to insert the textfiledata into the database. For this purpose, we have created... and department. Now to read
this file, we have used DataInputStream and transfer
store data from a variable in mysql? storedata 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 in order to apply some calculation on it, but now i want to store the result
Write Text File to Table
the records
of a simple textfile and write (insert) into a simple table in MySQL
database. All records are written in the simple textfile and again, if you need... Write TextFile to Table
 
How to read a large text file line by line in java?
How to read a large textfile line by line in java? I have been assigned a work to read big textfile and extract the data and save into database... memory assigned is also a limit.
So, we have decided to read the textfile line
for store data in data base - JSP-Servlet
for storedata in data base i want to a job site, in this site user.....
and on 3rd form i use submit button...
data of form 1 and 2 can also be store... {
text-decoration: none;
font-family:arial;
font-size:12px;
color: #000000
How to read text file in Servlets
Create a Table in Mysql database through
SQL Query in JSP...;
This is detailed java code to connect a jsp page to
mysql database and create a table of given... named 'usermaster' in mysql and create table "user_master".
Create
Read Lines from text file read from the textfile and displays the output as desired. Unable to read the rest...Read Lines from text file Here's a brief desc of what my Java code does .. I'm using BufferedReader to read lines from a text files and split each
Write records into text file from database
Write records into textfile from database
You have already learnt how to insert records from textfile to database. But here we are going to retrieve records from database and store the data into the textfile. For this purpose, we have
How To Store HTML img Into The MySQL Using Java
How To Store HTML img Into The MySQL Using Java
In this section you will read... jquery, Ajax,
MySQL and we will create a JSP for writing the Java code... the image into the database
using MySQL in Java. In this example I have created a JSP
How to store data entered by User in JSP page in XML file
JSP storedata entered by user into XML file
1)form.jsp:
<html>...How to storedata entered by User in JSP page in XML file How to storedata entered by user in JSP page to be saved in XML file.On clicking submit
Read data from excel file and update database using jsp Readdata from excel file and update database using jsp readdata from excel file and update database using jsp
Hi, I am using a MySQL database for scientific research analysis. My team members sends research data in excel file
Read data again - Java Beginners Readdata again Hey,
i want to ask again about how to readdata...),
jab varchar(35),
cab varchar(15),
ket varchar(30)
My data in txt file is://i... data from txt file and send to DB.i'm using one button to call. Hi
Java insert file data to JTable
Java insert filedata to JTable
In this section, you will learn how to insert textfiledata into JTable.
Swing has provide useful and sophisticated set... with AbstractTableModel to inherit
its methods and properties. Now we have read the file
How to Read a File in Java
// read via File Reader
String data =""; // Read br and store a line...How to Read a File in Java?
In this section we are going to know, How to read a file in Java. We
have to follow three step to read a File.
First get
retrieve data from mysql database and store it in a variable ?
retrieve data from mysql database and store it in a variable ? sir , I am working on a project , in which I have to apply operation on input data... to store that data in int variable.
how to do this ?
Here is an example
Read data again - Java Beginners Readdata again OK my problem some like my first question.First i... varchar(15),
cab varchar(15),
ket varchar(30)
then i have a data from txt file... Pusat;
i want data from txt file save to database like my DB with one button.but
How to read excel data and store it in database - Java Beginners
How to read excel data and store it in database Hi,
I want a java code to readdata from excel and store it in Ms Access database.I tried the code... readdata into database.So please give me some sample code.
Thanks
Java read file
There are many ways to read a file in Java. DataInputStream class is used to readtextFile line by line. BufferedReader is also used to read a file in Java...
BufferedReader class readtext from a character-input stream rather than read one
uploading a text file into a database
uploading a textfile into a database how to upload a textfile... = conn.prepareStatement("insert into myfile( file_name, file_data) values... {
static Filefile;
public static void main(String[] args) throws Exception
xl read
:
Insert excel filedata into database
Read Excel File...xl read hi, i have read excel sheet data using poi api and printed on console, now i have to store the same data which is printed on the console
how to store/retrieve doc file - Java Beginners
how to store/retrieve doc file i want to wirte a code that stores/ retrieves .doc files to the mysql database using jsp pages... can anyone help me with the code? Use this stuff inside your jsp page for storefile
Write to a file
Write to a file
As we have read about the BufferedOutputStream
class that store the data in an internal buffer and lets you write
Read the File Read the File
 ... the data is read in form
of a byte through the read( ) method. The read... ReadFilter
This is a textfile
C:\nisha>
Download
Data read. - XML Dataread. How to store or readdata in XML from Struts.Plz give me example.
Thanx
Java Xml Data Store
be followed up and/or purchased.
You will need to store the data in a local binary... the implementation needs to change later on (perhaps they might decide to store the data...Java Xml Data Store I have to do this project and i'm finding it so
J2ME Read File
shows you how to read the data of the specified file. To
implement this type.... In this application we are creating a "help.txt" file
and read the data...
J2ME ReadFile
 
How to read text file in Servlets
How to readtextfile in Servlets
 ... file in servlets.
In this example we will use the input stream to read the text... it to the BufferedReader. A variable text is defined
of String type. Read the file line
create login page using data from text file
create login page using data from text file I want to create login page using datastore in textfile(data submit from regiter page to textfile) using jsp and servlet. Thanks
how to store data in XML file - JSP-Servlet
how to storedata in XML file hi
i have to store the data for example user id and password in a xml file the input userid and password will be coming from jsp middle ware servlet how to do that? Hi friend
how to read text file in jtable in netbeans7.0
how to readtextfile in jtable in netbeans7.0 textfile... want to displaythe above .txt file in jtable as following format having 3 columns
contigID length size
and then display sequence like "ATGCGSA..." in text
How I Upload File and Store that file name in Database using JSP
How I Upload File and Store that file name 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
Mysql Loader Control File Mysql Loader Control FileMysql Loader Control File is the mean to import a data to a plain text from
Mysql database.
Understand with Example
The Tutorial
Mysql Loader Control File Mysql Loader Control FileMysql Loader Control File is the mean to import a data to a plain text from
Mysql database.
Understand with Example
The Tutorial
Reading Text file and storing in map
Reading Textfile and storing in map Hi
I have multiple text files. I want to read thoses files and store those records in map.
Map will be of "LinkedHashMap<String, Map<String, String>>" type.
Please let me know