File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Like Operator with MS Access Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Like Operator with MS Access" Watch "Like Operator with MS Access" New topic

Like Operator with MS Access

Kel Walker

Joined: Apr 04, 2002
Posts: 19
Is it just me or does the like operator not work with the sun.jdbc.odbc.JdbcOdbcDriver.
String sql = "SELECT * FROM test WHERE name like '*wal*' order by name;";
When this is executed in my java code no results are returned. When executed directly within Access the correct results are displayed.
Anyone else experienced the same problem. Does anyone have a like operation that works via jdbc?
Kel Walker

Joined: Apr 04, 2002
Posts: 19
Sorry folks,
I figured it out. Although * is the MS Access wildcard the jdbc driver expects % not *.
Michael Matola
Ranch Hand

Joined: Mar 25, 2001
Posts: 1793
I just deleted a post seconds ago in which I said "wildcards in SQL are % and _". Deleted it because I looked up wildcards in Access help and saw that Access does use * and ?. (Go figure.) Good that you solved the problem.
I agree. Here's the link:
subject: Like Operator with MS Access
It's not a secret anymore!