Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Help me in clearing the Errors!

 
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");

}



}




}
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • 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.
 
Beauty is in the eye of the tiny ad.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic