File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes connection call Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "connection call" Watch "connection call" New topic

connection call

Abebe Belew

Joined: Jul 21, 2004
Posts: 19
package app;
import org.apache.struts.action.*;
import javax.servlet.http.*;
import java.lang.*;
import java.sql.Connection;
import java.sql.SQLException;
import javax.sql.DataSource;
import app.pcSQLException;
import app.db_connection;

public class RegisterAction extends Action{

private String selectstr ;
private String mrn = "";

public ActionForward execute (ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)

String mrn = ((RegisterForm) form).getMrn();

javax.sql.DataSource dataSource;
java.sql.Connection conn;

try {
dataSource = getDataSource(request);
conn = dataSource.getConnection();

try {
if(mrn.length() != 0){
selectstr = db_connection.queryExecute(mrn, conn);

} catch (pcSQLException e) {
System.out.println ("Error Executing Query: " + e.getMessage());

} catch (Exception e) {
System.out.println (e.getMessage());

HttpSession session = request.getSession(true);
session.setAttribute("registerSess", selectstr);

return mapping.findForward("success");


my bean:
package app;

import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.sql.*;

public class db_connection {

public static String queryExecute(String mrn, Connection conn)
throws pcSQLException {

try {
String querytext = null;
String strQuery = "select mrn from qdsn.procedurea where mrn = '" + mrn + "' ";
Statement stmt = conn.createStatement();
System.out.println("conn = " + conn);
ResultSet rset = stmt.executeQuery(strQuery);

while ( {
querytext = rset.getString(1);
System.out.println("this is result from bean" + querytext);
return querytext;
}//end while

} catch (Exception e) {
throw new pcSQLException();
}//end catch
return null;
}//end db_connection

Error Message while trying to compile:

queryExecute() in app.db_connection cannot be applied to (java.lang.String,java.sql.Connection)
[javac] selectstr = db_connection.queryExecute(mrn, conn);
[javac] ^
[javac] 1 error

Please help!!!
Thanx in advance
parthiban subramaniam
Ranch Hand

Joined: May 15, 2002
Posts: 116
cant see anything worng with the code mate
unless you have a old version of db_connection class which had the method queryExecute()
this should not happen,
clear out the classes and try to recompile thos whole lot from the scratch

hope that helps

Even crazy and silly looking problems are sometimes real.
I agree. Here's the link:
subject: connection call
It's not a secret anymore!