Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Struts Action Class-Oracle Connection

vunalvunal Posts: 8Member
Hi i want to connect oracle with struts action class. Can i do this without DataSource? My Code Like This, this code always throws exception after ClassforName line. So "Sonuc" parameter value is being 0.

package KULLANICI;
import org.apache.struts.action.*;
import javax.servlet.http.*;
import java.io.*;
import java.sql.*;
import oracle.jdbc.driver.*;
public class GirisAction extends Action{
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,HttpServletResponse response) throws Exception{ GirisForm gForm = (GirisForm) form; String KulAd = gForm.getKulAd();
String Sifre = gForm.getSifre();
Connection Conn; Statement stmt;
ResultSet rs;
int Sonuc=0; try
{
Class.forName("Oracle.jdbc.driver.OracleDriver");
Conn = DriverManager.getConnection("jdbc:oracle:thin:localhost:1528:ORCL","System","vol83kan");
stmt = Conn.createStatement(); rs = stmt.executeQuery("Select COUNT(*) as number from KULLANICI where KUL_AD = 'vunal' and SIFRE = 'vol83kan'"); rs.next(); Sonuc = rs.getInt("number");
rs.close();
}
catch(Exception ex)
{
System.out.println(ex.getMessage() + Sonuc);
}
if(Sonuc != 0)
{ return mapping.findForward("Success");
}
else
{ return mapping.findForward("Failed");
} }

Comments

  • vunalvunal Posts: 8Member
    Is there any body to reply????
  • zibadianzibadian Posts: 6,349Member
    : Is there any body to reply????
    :
    Give it a few days. A lot of people don't spend every minute here, checking for new messages.
  • vunalvunal Posts: 8Member
    : : Is there any body to reply????
    : :
    : Give it a few days. A lot of people don't spend every minute here, checking for new messages.
    :

    four days... did you see there is no answer!, If i said that, i know something!
    If you don't know answer shut up zibadian!


  • zibadianzibadian Posts: 6,349Member
    [b][red]This message was edited by zibadian at 2006-9-8 7:19:32[/red][/b][hr]
    : : : Is there any body to reply????
    : : :
    : : Give it a few days. A lot of people don't spend every minute here, checking for new messages.
    : :
    :
    : four days... did you see there is no answer!, If i said that, i know something!
    : If you don't know answer shut up zibadian!
    :
    :
    :
    Appearantly the oracle driver class file/package isn't located in the JVM's search path. Solution: place the correct file(s) in the search path or expand the search path to include the directory of the oracle driver.

    PS Waiting 4 days for an answer isn't that long. Several of my questions never got answered.


  • vunalvunal Posts: 8Member
    : [b][red]This message was edited by zibadian at 2006-9-8 7:19:32[/red][/b][hr]
    : : : : Is there any body to reply????
    : : : :
    : : : Give it a few days. A lot of people don't spend every minute here, checking for new messages.
    : : :
    : :
    : : four days... did you see there is no answer!, If i said that, i know something!
    : : If you don't know answer shut up zibadian!
    : :
    : :
    : :
    : Appearantly the oracle driver class file/package isn't located in the JVM's search path. Solution: place the correct file(s) in the search path or expand the search path to include the directory of the oracle driver.
    :
    : PS Waiting 4 days for an answer isn't that long. Several of my questions never got answered.
    :

    thanks...
Sign In or Register to comment.