Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

unusual errror:driver does not support function

 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Here is a part of my code that should search for records and display the same in my jsp page. But it throws an unusual error that driver does not support this function.
<%
Connection con=null;
java.sql.PreparedStatement stmt=null;
ResultSet rs=null;
String table="";
int year=0;
String str="";
String user_login="";
String project_title="";
try
{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc dbc:mech_iit");
table=request.getParameter("table");
System.out.println(table);
year=Integer.parseInt(request.getParameter("list_year"));
System.out.println(year);
user_login=request.getParameter("user_login");
System.out.println(user_login);
if(table.equals("publication"))
{
str="select paper_title,year from publications where user_login=? and ([year]=?)";
}
else
if(table.equals("sponsored_project"))
{
str="select project_title,year from sponsored_projects where user_login=? and ([year]=?)";
}
if(table.equals("consultancy"))
{
str="select project_title,year from consultancy_projects where user_login=? and ([year]=?)";
}
else
if(table.equals("supervised_project"))
{
str="select project_title,year from projects_supervised where user_login=? and ([year]=?)";
}
else
if(table.equals("manual"))
{
str="select title,year from manuals where user_login=? and ([year]=?)";
}
else
if(table.equals("technical_report"))
{
str="select tech_title,year from tech_reports where user_login=? and ([year]=?)";
}
stmt=con.prepareStatement(str);
stmt.setString(1,user_login);
stmt.setInt(2,year);
rs=stmt.executeQuery(str);

while(rs.next())
{
project_title=rs.getString(1);
String year1=rs.getString(2);
//tech_title=rs.getString("tech_title");
//paper_title=rs.getString("paper_title");
System.out.println(project_title);
System.out.println(year);
out.println("<html>");
out.println(" ");
out.println(" ");
out.println("<p align=center>");
out.println("<b>"+"RECORDS"+"</b>");
out.println("</p>");
out.println("<table border=1 div align=center width=80% cellpadding=2 cellspacing=2>");
out.println("<tr>");
out.println("<td>");
out.println("<div align=center>");
out.println("<b>"+"<font face=Arial>"+"Title"+"</font>"+"</b>"+"</div>");
out.println("</td>");
out.println("<td>");
out.println("<div align=center>"+"<b>"+"Year"+"</b>"+"</div>");
out.println("</td>");
out.println("</tr>");
out.println("<tr>");
out.println("<td>");
out.println(project_title);
out.println("</td>");
out.println("<td>");
out.println(year);
out.println("</td>");
out.println("</tr>");
out.println("<tr>");
out.println("<td>");
out.println(project_title);
out.println("</td>");
out.println("<td>");
out.println(year);
out.println("</td>");
out.println("</tr>");
out.println("</table>");



}

}


catch(Exception ie)
{
System.out.println("jasu");
System.out.println("Exception:"+ie);
}
%>
like if i try to search for consultancy_projects for year 2001 an exception occurs that java.sql.SQLException that the driver does not support this function.
 
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

rs=stmt.executeQuery(str);


As you have specified the query in con.prepareStatement(str) function. So use rs=stmt.executeQuery(); function. I think this is the problem.
Let me know if there is anyother.
 
Sheriff
Posts: 67592
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moved to the JDBC forum.
 
jyotsana dang
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i guess i got my solution ..tkx
 
It means our mission is in jeapordy! Quick, read this 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