| Author | 
		  Message
		 | 
		
		  | sudeepm | 
		  
		    
			  
				 Posted: Tue Feb 19, 2008 8:49 pm    Post subject: Writing to file | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 31 Jan 2008 Posts: 57
  
  | 
		  
		    
			  
				Can some body tell me how can i write to file using java compute node.
 
 
we are not using file extender instead we need to use java compute node | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | elvis_gn | 
		  
		    
			  
				 Posted: Tue Feb 19, 2008 9:20 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Padawan
 
 Joined: 08 Oct 2004 Posts: 1905 Location: Dubai 
  | 
		  
		    
			  
				Hi sudeepm,
 
 
Use Java FileWriter APIs, though I don't understand why you are reinventing the wheel and not using the file extender nodes...
 
 
Regards. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | sudeepm | 
		  
		    
			  
				 Posted: Tue Feb 19, 2008 11:36 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 31 Jan 2008 Posts: 57
  
  | 
		  
		    
			  
				we are using extender as it has some issues related to performance
 
 
I am using this way..evn though it works. i just want to know is this the only way to do.
 
 
 
private void writeToFile (String text)throws IOException{
 
	    Writer output = null;
 
	  
 
	    File file = new File("C:/write.txt");
 
	    output = new BufferedWriter(new FileWriter(file,true));
 
	    output.write(text);
 
	    output.write('\n'); 
 
	   // writer.newLine();
 
	    output.close();
 
	    System.out.println("Your file has been written");        
 
	    } | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | AkankshA | 
		  
		    
			  
				 Posted: Wed Feb 20, 2008 12:43 am    Post subject: Re: Writing to file | 
				     | 
			   
			 
		   | 
		
		
		    Grand Master
 
 Joined: 12 Jan 2006 Posts: 1494 Location: Singapore 
  | 
		  
		    
			  
				
   
	| sudeepm wrote: | 
   
  
	Can some body tell me how can i write to file using java compute node.
 
 
we are not using file extender instead we need to use java compute node | 
   
 
 
 
how about using a trace node for writing to a file instead of JCN _________________ Cheers | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | sudeepm | 
		  
		    
			  
				 Posted: Wed Feb 20, 2008 1:30 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 31 Jan 2008 Posts: 57
  
  | 
		  
		    
			  
				I need to change the file name dynamically ..there should be a new file as the date changes.
 
 
we cannot do that in trace node   | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | EddieA | 
		  
		    
			  
				 Posted: Wed Feb 20, 2008 9:09 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi
 
 Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles 
  | 
		  
		    
			  
				
   
	| sudeepm wrote: | 
   
  
	we cannot do that in trace node   | 
   
 
 
But you can write a file from the Trace Node, and then use a utility, fired off each day, to "rotate and trim" the file.
 
 
Cheers, _________________ Eddie Atherton
 
IBM Certified Solution Developer - WebSphere Message Broker V6.1
 
IBM Certified Solution Developer - WebSphere Message Broker V7.0 | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | jefflowrey | 
		  
		    
			  
				 Posted: Wed Feb 20, 2008 9:15 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Poobah
 
 Joined: 16 Oct 2002 Posts: 19981
  
  | 
		  
		    
			  
				Use v6.1 and the FileOutput node.
 
 
Otherwise, there may indeed be many different ways to write to a file in Java.
 
 
There is no way to write to a file from ESQL, without talking to Java.
 
 
The "best" way to do this may depend entirely on very specific things that are local to your situation.
 
[/quote] _________________ I am *not* the model of the modern major general. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | jefflowrey | 
		  
		    
			  
				 Posted: Wed Feb 20, 2008 9:15 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Poobah
 
 Joined: 16 Oct 2002 Posts: 19981
  
  | 
		  
		    
			  
				Use v6.1 and the FileOutput node.
 
 
Otherwise, there may indeed be many different ways to write to a file in Java.
 
 
There is no way to write to a file from ESQL, without talking to Java.
 
 
The "best" way to do this may depend entirely on very specific things that are local to your situation. _________________ I am *not* the model of the modern major general. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |