Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help me in clearing the Errors!

 
Swaminathan Balasubramani
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone help me in clearing the errors.


import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.sql.*;
import java.sql.*;

public class SearchSAPOnline extends HttpServlet
{


static Connection dbcon;

String Keywords[];


public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{

try
{

Class.forName("oracle.jdbc.driver.OracleDriver");
dbcon=DriverManager.getConnection("jdbc racle:thin:@bbsu-2:1521:keonline","system","knowledge");
System.out.println("Connection Established");

}
catch(ClassNotFoundException e)
{

System.out.println("Database Driver Not found");
System.out.println(e.toString());

}
catch(Exception e)
{

System.out.println(e.toString());

}
res.setContentType("text/html");
String mine = req.getParameter("mine");
try
{
PreparedStatement s=dbcon.prepareStatement("select f_id,f_name,file_ext,date_creation,date_lupdate,d_id,keywords,path from file_info");
ResultSet rs=s.executeQuery();

while(rs.next())
{

String FileID=rs.getString("f_id");
String FileName= rs.getString("f_name");
String FileExtension= rs.getString("file_ext");
String DateCreation= rs.getString("date_creation");
String DateLupdate=rs.getString("date_lupdate");
String DeptID=rs.getString("d_id");
String Keywords=rs.getString("keywords");
String Path=rs.getString("path");
}

String[] keywords = new String[10];
String key =" ";
int count = 0;
char comma=',';

int size= keywords.length();

try
{

for(int i=0; i<size; i++)
{

if(Keywords.charAt(i) == comma)
{

Keywords[count] = mine;
mine = " ";
count = count + 1;

}
else
{
mine = mine + Keywords.charAt(i);
}
}

for(int j=0; j<=2; j++)
{
System.out.println(Keywords[j]);
if (Keywords[j].equals(find)) System.out.println("Key word found : " + Keywords[j]);
}
}
catch(Exception e)
{
System.out.println("Error :" + e);

}



}

catch(Exception e)
{

System.out.println("Error in Excecuting the query");

}



try

{



dbconn.close();


}

catch(Exception e)
{

System.out.println("Error Closing the Database");

}



}




}
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What errors?

Also, If you are going to post more than a line or two of code, please use the UBB Code Tags. They preserve your indenting and make the code more readable.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic