Forums.Sureshkumar.net : A Perfect Place to Share Knowledge         Blogs     Games    Magazines    

"Sharing knowledge does not lessen your store, often it gets you more. Sharing plays a key role in relationships and bonding, happens in small steps and is assisted through community membership."

Go Back   SURESHKUMAR.NET FORUMS > TECHNICAL DISCUSSIONS > JAVA Technologies
Register FAQ Members List Calendar Games Blogs Search Today's Posts Mark Forums Read

   

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
Old 17-11-06, 12:39 PM   #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 qaisar has disabled reputation
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
qaisar is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 17-11-06, 01:25 PM   #2 (permalink)
Super Moderator
 
sk_kireeti's Avatar
 
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 sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute
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
sk_kireeti is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

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


All times are GMT +6.5. The time now is 10:57 AM.





Search Engine Optimization by vBSEO 3.1.0