Struts Action Class-Oracle Connection - Programmers Heaven

Howdy, Stranger!

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

Categories

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.