Results 1 to 4 of 4
  1. #1
    anouar2002 is offline Member
    Join Date
    Apr 2012
    Posts
    13
    Rep Power
    0

    Default Problem Java and Oracle

    Good evening guys,
    I'm working on a program that allows the comparison between the images.

    I have already started
    But I found some problems. Who can help me?
    Here is a piece of my code:

    Java Code:
    package indexation;
    
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.CallableStatement;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import oracle.jdbc.OracleResultSet;
    import oracle.ord.im.OrdImage; 
    import oracle.ord.im.OrdImageSignature;
    
    /**
     *
     * @author Administrateur
     */
    public class Chercher {
        int id_img; 
        OrdImageSignature signature1;
        
        float score;
        float min=100;
        int id=0;
        
       
     
            public  Chercher()
            {
            try {
                // Etape 1 : Création de la connexion avec la base
                 // Enregistrement du pilote Oracle
                  DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
                    Connection con =DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","system","anouar");
    con.setAutoCommit(false);
                   System.out.println("bla");        
       // Etape 2 : Récupération du descripteur
       // Création d'une instance de l'objet Statement
       
    Statement ss = con.createStatement();
         
    CallableStatement st = null;
                          
        ss = con.createStatement();
        ResultSet rs = ss.executeQuery("select count(*) as myVar from images");
        
        rs.next();
            String nn=rs.getString("myVar");
            id_img=Integer.parseInt(nn);
                    
                   String ii = String.valueOf(id_img);
                                            
            rs.close();               
           OrdImageSignature imgSig = null;
           ResultSet rset2 = ss.executeQuery("select *  from images where id="+ii);
    // S'il y a un résultat
    if(rset2.next()) {
    // Récupération du descripteur
    imgSig = (OrdImageSignature) rset2.getORAData(3, OrdImageSignature.getORADataFactory());                
    }       
    rset2.close();
        ResultSet rset3 = ss.executeQuery("select *  from images where id<"+ii);                   
     while(rset3.next()){
         
         signature1 = (OrdImageSignature) rset3.getORAData(3,
    OrdImageSignature.getORADataFactory());
    // s'il y a un 2ieme résultat
    
    // Récupération du descripteur de l'OrdImageSignature de l'image 2
    
    
    // Ecriture de la commande définissant les coef. des critères de // comparaisons
    String commande = "color=1 texture=0 shape=0 location=0";
         score = OrdImageSignature.evaluateScore(signature1, imgSig,commande);
         
         if (min>score){
             min=score;
             id=rset3.getInt(1);
            
         }
         
         
     }   
                           
      rset3.close();                      
                           
      
                            
                            
      
                            
                        
    //fermeture de la connexion
      con.close();
            } catch (SQLException ex) {
                Logger.getLogger(Chercher.class.getName()).log(Level.SEVERE, null, ex);
            }
            
      
    
                                         
            }
        
        
    
    }
    Erreurs :
    getORAData : cannot find symbol
    symbol: method getORAData(int,oracle.sql.ORADataFactory)
    location: variable rset3 of type java.sql.ResultSet
    Help PLEASE

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: Problem Java and Oracle

    ResultSet does not have a method getORAData.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    trevMD is offline Member
    Join Date
    Apr 2012
    Posts
    5
    Rep Power
    0

    Default Re: Problem Java and Oracle

    you need to cast the sql ResultSet to OracleResultSet (since getORAData is only defined in th eOracleResultSet, and not the ResultSet)

    imgSig = (OrdImageSignature) ((OracleResultSet) rset2).getORAData(3, OrdImageSignature.getORADataFactory());

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,784
    Blog Entries
    7
    Rep Power
    21

    Default Re: Problem Java and Oracle

    Why not stay with the functionality offered by the JDBC framework and all its interfaces? Digging in the implementation classes ties your code to one single vendor.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Problem in inserting values into Oracle DB
    By techsing14 in forum Java Servlet
    Replies: 4
    Last Post: 04-13-2011, 02:52 AM
  2. Oracle: Disconnection problem
    By LymonAdd in forum JDBC
    Replies: 1
    Last Post: 10-25-2010, 02:48 AM
  3. EJb lock problem with oracle 10g
    By yatin in forum Enterprise JavaBeans (EJB)
    Replies: 2
    Last Post: 10-06-2010, 03:24 PM
  4. problem with hibernate and oracle 8i
    By javadev in forum JDBC
    Replies: 4
    Last Post: 08-09-2007, 03:21 PM
  5. oracle problem
    By Peter in forum JDBC
    Replies: 1
    Last Post: 07-09-2007, 05:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •