Results 1 to 1 of 1
- 08-19-2011, 01:19 PM #1
Member
- Join Date
- Oct 2010
- Posts
- 33
- Rep Power
- 0
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)
2.Objects ClassesJava 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; }
TaskAuction
TaskJava 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; } }
3.ConsoleTestJava 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; } }
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
-
Exception in thread "main" java.lang.NumberFormatException:input string: "060320
By renu in forum New To JavaReplies: 14Last Post: 04-08-2011, 06:01 PM -
"Exception in thread "Launcher:/Whiteboard" java.lang.RuntimeException: Failed to loa
By Shajith in forum EclipseReplies: 3Last Post: 03-21-2011, 01:48 PM -
Exception in thread "main" java.lang.NoClassDefFoundError: oracle/jdbc/pool/Orac leDa
By Kirthana in forum JDBCReplies: 0Last Post: 02-11-2011, 03:21 PM -
Runtime error "Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
By shantimudigonda in forum New To JavaReplies: 1Last Post: 11-20-2009, 07:58 PM -
failure at Class.forName("oracle.jdbc.driver.OracleDriver");
By RonNYC in forum EclipseReplies: 1Last Post: 03-14-2008, 02:51 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks