• Post Reply Bookmark Topic Watch Topic
  • New Topic

spliting the file  RSS feed

 
naga raaju
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys

i have a test file like raju.txt

naga raju rama raju

using java.util.Scanner we can split like


naga
raju
rama
raju


the code is


public class FileRead1 {

public static void main(String arg[])
{
try
{
File f=new File("test.txt");
Scanner ss=new Scanner(f);

while(ss.hasNext())
{
String hh=ss.next();

System.out.println(""+hh);

//System.out.println(""+hh);
}
}catch(Exception e){}
}

}
}

what my doubt is how to store each split into database.

my table is like

colum1 colum2 colum3 colum4

naga raju rama raju

is there any possible to store like that

give the idea.

thanks
naga
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you familiar with the SQL INSERT statement? It can insert values into several columns at the same time.

I'll move this to the JDBC forum.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!