Results 1 to 1 of 1
  1. #1
    jeata is offline Member
    Join Date
    Oct 2010
    Posts
    33
    Rep Power
    0

    Default Exception "not implemented for class oracle.jdbc.driver.T4CNumberAccessor"

    Hello I'm having some troubles dealing with 'java.sql.Date' I'm working with express edition database and I have three classes(different packages)

    1.Mapper
    2.Objects Class
    3.ConsoleTest

    I need to get an arraylist of objects, some of which contain dates, but when try to do it I get this exception
    "java.sql.SQLException: Invalid column type: getDate not implemented for class oracle.jdbc.driver.T4CNumberAccessor"

    Here are the classes
    1.Mapper(method to get the arraylist)

    Java Code:
    public ArrayList<Object> getAllTaskAuctions(Connection con) 
        {
    		ArrayList<Object> l1 = new ArrayList<Object>();
    		String SQLString1 =   "select * from taskauction natural join tasks";
           PreparedStatement statement=null;
            try
            {
                //=== get taskauctions natural join tasks
                statement = con.prepareStatement(SQLString1);
                ResultSet rs  = statement.executeQuery();
                while(rs.next())
                { 
                    l1.add(new TaskAuction(rs.getInt(1), rs.getInt(2), rs.getInt(3),
                    rs.getDate(4), rs.getDate(5), rs.getInt(6)));
                    l1.add(new Task(rs.getInt(1), rs.getInt(2), rs.getString(3),
                            rs.getString(4), rs.getString(5), rs.getString(6), rs.getInt(7)));
                }                     
            }
            catch (Exception exc)
            {   
                System.out.println("Fail in TaskAuctionMapper - getAllTaskAuctions");
                System.out.println(exc);
            }
            
            return l1;                         
        }
    2.Objects Classes
    TaskAuction
    Java Code:
    public class TaskAuction {
    	
    	int winnerid;
    	int taskid;
    	int bidid;
    	Date startdate;
    	Date finishdate;
    	int userid; 
    	
    	public TaskAuction(int wid, int tid, int bid, Date sd, Date fd, int toid)
    	{
    		winnerid = wid;
    		taskid = tid;
    		bidid = bid;
    		startdate = sd;
    		finishdate = fd;
    		userid = toid;
    	}
    	
    	//---AUTOGENERATED GETTERS AND SETTERS---//
    
    	public int getWinnerid() {
    		return winnerid;
    	}
    
    	public void setWinnerid(int winnerid) {
    		this.winnerid = winnerid;
    	}
    
    	public int getTaskid() {
    		return taskid;
    	}
    
    	public void setTaskid(int taskid) {
    		this.taskid = taskid;
    	}
    
    	public int getBidid() {
    		return bidid;
    	}
    
    	public void setBidid(int bidid) {
    		this.bidid = bidid;
    	}
    
    	public Date getStartdate() {
    		return startdate;
    	}
    
    	public void setStartdate(Date startdate) {
    		this.startdate = startdate;
    	}
    
    	public Date getFinishdate() {
    		return finishdate;
    	}
    
    	public void setFinishdate(Date finishdate) {
    		this.finishdate = finishdate;
    	}
    
    	public int getUserid() {
    		return userid;
    	}
    
    	public void setUserid(int userid) {
    		this.userid = userid;
    	}
    	
    	
    
    }
    Task
    Java Code:
    public class Task {
    	
    	int taskid;      
        int userid;      
        String title;       
        String description; 
        String progress; 
        String planprogress; 
        int price; 
        
         public Task(int tid, int uid, String tit, String desc, 
        		String prg, String plnprg, int pr)
        {
        	taskid=tid;
        	userid=uid;
        	title=tit;
        	description=desc;
        	progress=prg;
        	planprogress=plnprg;
        	price=pr;
        }
         
       //======AUTOGENERATED GETTERS AND SETTERS======//
    
    	public int getTaskid() {
    		return taskid;
    	}
    
    	public void setTaskid(int taskid) {
    		this.taskid = taskid;
    	}
    
    	public int getUserid() {
    		return userid;
    	}
    
    	public void setUserid(int userid) {
    		this.userid = userid;
    	}
    
    	public String getTitle() {
    		return title;
    	}
    
    	public void setTitle(String title) {
    		this.title = title;
    	}
    
    	public String getDescription() {
    		return description;
    	}
    
    	public void setDescription(String description) {
    		this.description = description;
    	}
    
    	public String getProgress() {
    		return progress;
    	}
    
    	public void setProgress(String progress) {
    		this.progress = progress;
    	}
    
    	public String getPlanprogress() {
    		return planprogress;
    	}
    
    	public void setPlanprogress(String planprogress) {
    		this.planprogress = planprogress;
    	}
    
    	public int getPrice() {
    		return price;
    	}
    
    	public void setPrice(int price) {
    		this.price = price;
    	}
         
         
         
    
    }
    3.ConsoleTest

    Java Code:
    Connection con;
    	public Connection getConnection(){
    		try{  
    	      Class.forName("oracle.jdbc.driver.OracleDriver");
    	      con = DriverManager.getConnection(
    	          "jdbc:oracle:thin:@localhost:1521:XE", "Project", "123" ); 
    	      
    	      //username/password@[//]host[:port][/service_name]
    	    }
    	    catch (Exception e) 
    	    {   System.out.println("fail in getConnection()");
    	        System.out.println(e); }
    		return con;    
    	  }
    
    	public static void main(String[] args) {
    		
    		
    		
    		ConsoleTest ct = new ConsoleTest();
    		TaskAuctionMapper tam1 = new TaskAuctionMapper();
            ArrayList<Object> alt1 = tam1.getAllTaskAuctions(ct.getConnection());
            Iterator<Object> itr1 = alt1.iterator();
            while (itr1.hasNext()) 
            {
              TaskAuction taskauct = (TaskAuction) itr1.next();
            //Problem, exception traced to TaskAuctionMapper
              System.out.println(
            		  "Task ID: "   +  taskauct.getTaskid()+ ",    "+
            		  "StartDate: "+   taskauct.getStartdate()+",    "+
            		  "User ID: " +    taskauct.getUserid());
            }
            
    
    	}
    Last edited by jeata; 08-19-2011 at 01:24 PM.

Similar Threads

  1. Replies: 14
    Last Post: 04-08-2011, 06:01 PM
  2. Replies: 3
    Last Post: 03-21-2011, 01:48 PM
  3. Replies: 0
    Last Post: 02-11-2011, 03:21 PM
  4. Replies: 1
    Last Post: 11-20-2009, 07:58 PM
  5. Replies: 1
    Last Post: 03-14-2008, 02:51 PM

Posting Permissions

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