Win a copy of Programming with Types this week in the Angular and TypeScript forum
or The Design of Web APIs in the Web Services 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
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Joe Ess
  • salvin francis

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.
 
The human mind is a dangerous plaything. This tiny ad is pretty safe:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!