| Forums.Sureshkumar.net : A Perfect Place to Share Knowledge Blogs Games Magazines |
|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Rate Thread | Display Modes |
|
|
#1 (permalink) |
|
Member
Join Date: Feb 2006
Location: India
Posts: 89
Thanks: 0 Thanked 1 Times in 1 Posts Thanks: 0
Thanked 1 Time in 1 Post
Rep Power: 3
|
Problem in Java/Excel JDBC:ODBC in querying date range. Urgent help required
dera freind
here i am trying to read excel file using java code,i am able to establish connectivty,i want to get all rows between two particular date of particular column.. its compiling fine while running its showing data mismatch import java.sql.Connection; import java.sql.Statement; import java.sql.ResultSet; import java.sql.DriverManager; public class ExcelReader { public static void main( String [] args ) { Connection c = null; Statement stmnt = null; try { Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" ); c = DriverManager.getConnection( "jdbc:odbc:qa-list", "", "" ); } catch(Exception e) { System.err.println( e ); } System.out.println("Connection Established"); try { stmnt = c.createStatement(); String query = "select * from [ftpqrm$] where [rcv end day] between '12/1/2005' and '12/8/2005'"; ResultSet rs = stmnt.executeQuery( query ); System.out.println( "Found the following URLs for March 2000:" ); while( rs.next() ) { System.out.println( rs.getString( "Description" ) ); } } catch( Exception e ) { System.err.println( e ); } finally { try { stmnt.close(); c.close(); } catch( Exception e ) { System.err.println( e ); } } } } help required urgently i am getting following error java.sql.SQLException: [Microsoft][ODBC Excel Driver] Data type mismatch in criteria expression. Last edited by qaisar; 17-11-06 at 01:26 PM. Reason: want to add error |
|
|
|
|
|
#2 (permalink) |
|
Super Moderator
Join Date: Feb 2006
Location: Hyderabad
Posts: 2,355
Thanks: 117 Thanked 241 Times in 198 Posts Thanks: 117
Thanked 241 Times in 198 Posts
Blog Entries: 4
Rep Power: 51
|
Re: solution required
Qaisar,
If you are getting data type mismatch, try using to_date function for date comparisions. Now I belive it is string and in excel it is date field... I am not sure if it will resolve or not. Its just a wild guess on the situation. Thanks, Krishna |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| problem with textbox in ms.net2005(very urgent) | bandiprasad | VB / ASP.NET Technologies | 3 | 22-11-06 07:50 PM |