Java

Moderators: zibadian
Number of threads: 7836
Number of posts: 18235

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Struts Action Class-Oracle Connection Posted by vunal on 4 Sept 2006 at 10:03 AM
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");
} }
Report
Re: Struts Action Class-Oracle Connection Posted by vunal on 4 Sept 2006 at 6:14 PM
Is there any body to reply????
Report
Re: Struts Action Class-Oracle Connection Posted by zibadian on 4 Sept 2006 at 11:00 PM
: 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.
Report
Re: Struts Action Class-Oracle Connection Posted by vunal on 8 Sept 2006 at 6:48 AM
: : 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!


Report
Re: Struts Action Class-Oracle Connection Posted by zibadian on 8 Sept 2006 at 7:18 AM
This message was edited by zibadian at 2006-9-8 7:19:32

: : : 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.


Report
Re: Struts Action Class-Oracle Connection Posted by vunal on 8 Sept 2006 at 5:36 PM
: This message was edited by zibadian at 2006-9-8 7:19:32

: : : : 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...



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.