*
The moose likes JDBC and the fly likes Problem with Like statement Using JDBC:ODBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Problem with Like statement Using JDBC:ODBC" Watch "Problem with Like statement Using JDBC:ODBC" New topic
Author

Problem with Like statement Using JDBC:ODBC

Mathias Nilsson
Ranch Hand

Joined: Oct 13, 2003
Posts: 107
Hi ranchers!
I have a problem. I'm using JDBC DBC to connect to a MS ACCESS 2000 database. When I run the query in MS ACCESS I get correct results. When I
run it in the javacode I get an empty resultset. I Don�t have any problem with select , update , delete statements that doesn't use "LIKE".
Here is an example.
SELECT * FROM Customers WHERE Name LIKE '*Sun*'. This works fine when I
run it as a Query in MS ACCESS 2000. When I run it in the javacode I get no result.
Normally when using LIKE the * character should be replaced with the %character
SELECT * FROM Customers WHERE Name LIKE '%Sun%'
But not with MS ACCESS? Can anyone help me with like statements using MS
ACCESS 2000?
// Mathias


SCJP2 , MCP( 70-229 ) , Preparing For SCWDC
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1121

Hi Mathias,
Works for me on Windows XP with Microsoft Access 2002 and J2SE 1.4.2_02
You've probably made a mistake somewhere in your code -- but I'm afraid I couldn't see any of your code in your post. Perhaps if you'd care to post your code, I may be able to help further.
Good Luck,
Avi.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with Like statement Using JDBC:ODBC
 
Similar Threads
Newbie encounters table locking
Not able to run the query in MS access
Quering the ResultSet
Problem with UNION query
Problem with date