?
Solved

error in apache

Posted on 2003-03-31
8
Medium Priority
?
169 Views
Last Modified: 2010-04-01
how can i resolve this error??



""""javax.servlet.ServletException: No ResultSet was produced"""""
0
Comment
Question by:gauravg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
8 Comments
 
LVL 4

Expert Comment

by:thanassis
ID: 8243840
can you post your code?
0
 

Author Comment

by:gauravg
ID: 8244068
<%@ page language="java" import="java.sql.*" %>
<%
     String location = request.getParameter("select1");
     String name = request.getParameter("text1");
     String password = request.getParameter("password1");
     String topic = request.getParameter("text2");
     String msg = request.getParameter("textarea1");

     
     out.println(location);
     out.println(name);
     out.println(password);
     out.println(topic);
     out.println(msg);

Connection connection = null;
String driverString = "sun.jdbc.odbc.JdbcOdbcDriver";
String urlString ="jdbc:odbc:";
String dbString = ";DatabaseName=db1";
String dbUser="";
String dbPassword="";


  try
  {
       Class.forName(driverString);
       connection = DriverManager.getConnection(urlString+dbString, dbUser, dbPassword);
System.out.println("url is " + urlString + dbString);
  }
  catch (Exception exception)
  {
       System.out.println("Connection failed: " + exception.toString());
  }

System.out.println("Connection is " + connection);

String insert_str ="INSERT INTO mail VALUES(?,?,?,?,?)";

int mailno=5;
PreparedStatement insert_pstr = connection.prepareStatement(insert_str);
System.out.println("Statement is prepared");
insert_pstr.setInt(1,mailno);
insert_pstr.setString(2,location);
insert_pstr.setString(3,name);
insert_pstr.setString(4,topic);
insert_pstr.setString(5,"kkkkkkkk");
System.out.println("Executing statement");
insert_pstr.execute();
System.out.println("Statement eXecuted");
String str ="INSERT INTO pas VALUES(?,?)";

PreparedStatement pstr = connection.prepareStatement(str);
pstr.setString(1,name);
pstr.setString(2,password);
pstr.execute();
connection.close();
%>


     
0
 

Author Comment

by:gauravg
ID: 8244075
it's adding data in database but after going to jsp page it gives error
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 4

Expert Comment

by:thanassis
ID: 8244181
I'm not sure but you can thy this:
change,

PreparedStatement insert_pstr = connection.prepareStatement(insert_str);

with,

CallableStatement insert_pstr  = connection.prepareCall(insert_str);
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 8245788
try this:

<%@ page language="java" import="java.sql.*" %>
<%
    String location = request.getParameter("select1");
    String name = request.getParameter("text1");
    String password = request.getParameter("password1");
    String topic = request.getParameter("text2");
    String msg = request.getParameter("textarea1");

   
    out.println(location);
    out.println(name);
    out.println(password);
    out.println(topic);
    out.println(msg);

Connection connection = null;
String driverString = "sun.jdbc.odbc.JdbcOdbcDriver";
String urlString ="jdbc:odbc:";
String dbString = ";DatabaseName=db1";
String dbUser="";
String dbPassword="";


 try
 {
      Class.forName(driverString);
      connection = DriverManager.getConnection(urlString+dbString, dbUser, dbPassword);
System.out.println("url is " + urlString + dbString);
 }
 catch (Exception exception)
 {
      System.out.println("Connection failed: " + exception.toString());
 }

System.out.println("Connection is " + connection);

String insert_str ="INSERT INTO mail VALUES(?,?,?,?,?)";

int mailno=5;
PreparedStatement insert_pstr = connection.prepareStatement(insert_str);
System.out.println("Statement is prepared");
insert_pstr.setInt(1,mailno);
insert_pstr.setString(2,location);
insert_pstr.setString(3,name);
insert_pstr.setString(4,topic);
insert_pstr.setString(5,"kkkkkkkk");
System.out.println("Executing statement");
insert_pstr.execute();
System.out.println("Statement eXecuted");
String str ="INSERT INTO pas VALUES(?,?)";

PreparedStatement pstr = connection.prepareStatement(str);
pstr.setString(1,name);
pstr.setString(2,password);
pstr.executeUpdate();
connection.close();
%>

Use executeUpdate() instead of excute()

That should fix the problem.

CJ
0
 
LVL 19

Accepted Solution

by:
cheekycj earned 200 total points
ID: 8245795
oops just noticed you had excute twice.. try this:


<%@ page language="java" import="java.sql.*" %>
<%
   String location = request.getParameter("select1");
   String name = request.getParameter("text1");
   String password = request.getParameter("password1");
   String topic = request.getParameter("text2");
   String msg = request.getParameter("textarea1");

   
   out.println(location);
   out.println(name);
   out.println(password);
   out.println(topic);
   out.println(msg);

Connection connection = null;
String driverString = "sun.jdbc.odbc.JdbcOdbcDriver";
String urlString ="jdbc:odbc:";
String dbString = ";DatabaseName=db1";
String dbUser="";
String dbPassword="";


try
{
     Class.forName(driverString);
     connection = DriverManager.getConnection(urlString+dbString, dbUser, dbPassword);
System.out.println("url is " + urlString + dbString);
}
catch (Exception exception)
{
     System.out.println("Connection failed: " + exception.toString());
}

System.out.println("Connection is " + connection);

String insert_str ="INSERT INTO mail VALUES(?,?,?,?,?)";

int mailno=5;
PreparedStatement insert_pstr = connection.prepareStatement(insert_str);
System.out.println("Statement is prepared");
insert_pstr.setInt(1,mailno);
insert_pstr.setString(2,location);
insert_pstr.setString(3,name);
insert_pstr.setString(4,topic);
insert_pstr.setString(5,"kkkkkkkk");
System.out.println("Executing statement");
insert_pstr.executeUpdate();
insert_pstr.close();
System.out.println("Statement eXecuted");
String str ="INSERT INTO pas VALUES(?,?)";

PreparedStatement pstr = connection.prepareStatement(str);
pstr.setString(1,name);
pstr.setString(2,password);
pstr.executeUpdate();
pstr.close();
connection.close();
%>

HTH,
CJ
0
 
LVL 35

Expert Comment

by:girionis
ID: 10078554
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Points to cheekycj

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

girionis
EE Cleanup Volunteer
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
In today's business world, data is more important than ever for informing marketing campaigns. Accessing and using data, however, may not come naturally to some creative marketing professionals. Here are four tips for adapting to wield data for insi…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month14 days, 6 hours left to enroll

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question