• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Tell me about exec(),biojava...,how to connect database written in c executable file?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
problem that i am faceing is that..i have to run about 50mb to 1 gb database using java ..database in in c(executable flatfile)...
it run fine for same databse around 1-10mb..
for bigger databse it is hang...
code i written is////
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
/**
* Hello World. This servlet simply says hi.
*
* <P> This is useful for testing the servlet configuration process,
* since this servlet isn't installed.
*/
public class FastaEngine extends HttpServlet {
public void doPost (HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
PrintWriter out;

res.setContentType("text/html");
out = res.getWriter();

String source=req.getParameter("S1");
String v =req.getParameter("libpo");
String databasename =req.getParameter("program");
//String v =req.getParameterValues("libpo");
out.println("<b>Getting the value from text box</b>");
out.println("<H1>"+v+"</H1>");
out.println("<H1>"+databasename+"</H1>");
//building string From various Option
//String command="D:/jithesh/sameer/"+databasename+" - "+ v+" ecoli3.txt ecoli3.txt";
String command="D:/jithesh/sameer/fasta -Q -O output d:/javaproject/ecoli3.txt d:/javaproject/mito.nt";
//D:\\jithesh\\sameer\\Fasta -q -o output salmo.txt swissport
out.println(command);
Date dd1=new Date(System.currentTimeMillis()-24*60*60*1000);
out.println("Time Started:"+dd1);
GregorianCalendar gc1 = new GregorianCalendar();
Date d1 = gc1.getTime();
long l1 = d1.getTime();
/* TAKING QUERY STRING FROM THE TEXT BOX AND WRITING TO THE FILE
OF NAME DEMO.TXT
CODE BEGAIN
*/
char buffer[]=new char[source.length()];
source.getChars(0,source.length(),buffer,0);
//FileReader fr =new FileReader("d:/javaproject/ShowFile.java");
FileWriter wr =new FileWriter("c:/demo2.txt");
for(int i=0;i<buffer.length;i++){
wr.write(buffer[i]);
}
wr.close();
//CODE OF FILE WRITING END.

String s="ASDFSDFDASF";
out.println("<html>");
out.println("<body bgcolor="+"#DBEDFF"+">");
out.println("<p>");
out.println("<hr noshade color="+"#FF0000"+">");
out.println("<H1>Readding The .Exe FileContent......</H1>");
out.println("</body></html>");

//Executing The File And Reading the File
//get Runtime it return the proccess
Runtime rt=Runtime.getRuntime();
//executing the exe file.
//Process pro=rt.exec("D:/jithesh/sameer/Fasta -o ecoli3.txt ecoli3.txt");
Process pro=rt.exec(command);
//reading the file content in byte stream
out.println("Executed");

InputStreamReader isr=new InputStreamReader(pro.getInputStream());
//Storing in the bufferreader.
BufferedReader br= new BufferedReader(isr);
String line;
//Reading the output Content...
while((line=br.readLine())!=null)
// out.println("<br>"+line+"</br>");
out.println("<font color=red><font size="+"1"+">"+"<br>"+line+"</font></br></font>");
GregorianCalendar gc2 = new GregorianCalendar();
Date d2 = gc2.getTime();
long l2 = d2.getTime();
long difference = l2 - l1;
out.println("Elapsed milliseconds: " + difference);

out.println("<html>");
out.println("<body bgcolor="+"#CCCCFF"+">");
out.println("<p>");
out.println("<hr noshade color="+"#FF0000"+">");

out.println("<b>"+"Hello World sameer ....."+source+"</b>");
out.println("<p><a href="+"http://localhost:8080/servlet/FastaOutput"+">see Result of Fasta Engine.....</a></p>");
out.println("</body></html>");
// res.sendRedirect("http://localhost:8080/servlet/RedirectServlet");
Date dd2=new Date(System.currentTimeMillis()-24*60*60*1000);
out.println("<br>TimeComPleted"+dd2+"</br>");
out.println("<br>Elapsed milliseconds: " + difference+"<br>");
}
}
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
/**
* Hello World. This servlet simply says hi.
*
* <P> This is useful for testing the servlet configuration process,
* since this servlet isn't installed.
*/
public class FastaEngine extends HttpServlet {
public void doPost (HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
PrintWriter out;

res.setContentType("text/html");
out = res.getWriter();

String source=req.getParameter("S1");
String v =req.getParameter("libpo");
String databasename =req.getParameter("program");
//String v =req.getParameterValues("libpo");
out.println("<b>Getting the value from text box</b>");
out.println("<H1>"+v+"</H1>");
out.println("<H1>"+databasename+"</H1>");
//building string From various Option
//String command="D:/jithesh/sameer/"+databasename+" - "+ v+" ecoli3.txt ecoli3.txt";
String command="D:/jithesh/sameer/fasta -Q -O output d:/javaproject/ecoli3.txt d:/javaproject/mito.nt";
//D:\\jithesh\\sameer\\Fasta -q -o output salmo.txt swissport
out.println(command);
Date dd1=new Date(System.currentTimeMillis()-24*60*60*1000);
out.println("Time Started:"+dd1);
GregorianCalendar gc1 = new GregorianCalendar();
Date d1 = gc1.getTime();
long l1 = d1.getTime();
/* TAKING QUERY STRING FROM THE TEXT BOX AND WRITING TO THE FILE
OF NAME DEMO.TXT
CODE BEGAIN
*/
char buffer[]=new char[source.length()];
source.getChars(0,source.length(),buffer,0);
//FileReader fr =new FileReader("d:/javaproject/ShowFile.java");
FileWriter wr =new FileWriter("c:/demo2.txt");
for(int i=0;i<buffer.length;i++){
wr.write(buffer[i]);
}
wr.close();
//CODE OF FILE WRITING END.

String s="ASDFSDFDASF";
out.println("<html>");
out.println("<body bgcolor="+"#DBEDFF"+">");
out.println("<p>");
out.println("<hr noshade color="+"#FF0000"+">");
out.println("<H1>Readding The .Exe FileContent......</H1>");
out.println("</body></html>");

//Executing The File And Reading the File
//get Runtime it return the proccess
Runtime rt=Runtime.getRuntime();
//executing the exe file.
//Process pro=rt.exec("D:/jithesh/sameer/Fasta -o ecoli3.txt ecoli3.txt");
Process pro=rt.exec(command);
//reading the file content in byte stream
out.println("Executed");

InputStreamReader isr=new InputStreamReader(pro.getInputStream());
//Storing in the bufferreader.
BufferedReader br= new BufferedReader(isr);
String line;
//Reading the output Content...
while((line=br.readLine())!=null)
// out.println("<br>"+line+"</br>");
out.println("<font color=red><font size="+"1"+">"+"<br>"+line+"</font></br></font>");
GregorianCalendar gc2 = new GregorianCalendar();
Date d2 = gc2.getTime();
long l2 = d2.getTime();
long difference = l2 - l1;
out.println("Elapsed milliseconds: " + difference);

out.println("<html>");
out.println("<body bgcolor="+"#CCCCFF"+">");
out.println("<p>");
out.println("<hr noshade color="+"#FF0000"+">");

out.println("<b>"+"Hello World sameer ....."+source+"</b>");
out.println("<p><a href="+"http://localhost:8080/servlet/FastaOutput"+">see Result of Fasta Engine.....</a></p>");
out.println("</body></html>");
// res.sendRedirect("http://localhost:8080/servlet/RedirectServlet");
Date dd2=new Date(System.currentTimeMillis()-24*60*60*1000);
out.println("<br>TimeComPleted"+dd2+"</br>");
out.println("<br>Elapsed milliseconds: " + difference+"<br>");
}
}
 
I'm gonna teach you a lesson! Start by looking at this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic