| Author |
unusual errror:driver does not support function
|
jyotsana dang
Ranch Hand
Joined: Sep 26, 2003
Posts: 135
|
|
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.
|
 |
Ali Gohar
Ranch Hand
Joined: Mar 18, 2004
Posts: 572
|
|
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.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56162
|
|
|
Moved to the JDBC forum.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
jyotsana dang
Ranch Hand
Joined: Sep 26, 2003
Posts: 135
|
|
|
i guess i got my solution ..tkx
|
 |
 |
|
|
subject: unusual errror:driver does not support function
|
|
|