aspose file tools*
The moose likes JDBC and the fly likes Driver does not support this function.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Driver does not support this function.." Watch "Driver does not support this function.." New topic
Author

Driver does not support this function..

Duane Riech
Ranch Hand

Joined: Feb 27, 2003
Posts: 52
First, I've already searched the forum for an answer and didn't find
anything that really seemed to answer it.
I'm using MS Access on Win 2000. I'm trying to access data that's already
in the table and when I run it, I get:
before resultset...
Exception occured...Driver does not support this function
java.sql.SQLException: Driver does not support this function
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String CbDb_url = "jdbc dbc river={Microsoft Access Driver" +
" (*.mdb)};DBQ=" +
"C:\\Project\\ODBC\\PartsBook\\PartsBook.mdb";
Connection con = DriverManager.getConnection(CbDb_url);
String sql = "SELECT * FROM PartsBook.PartsCategory";
PreparedStatement pstmt = con.prepareStatement(sql);
ResultSet rs = pstmt.executeQuery( sql );

It fails on the executeQuery().
Based on other questions in this forum, I tried a
Statement statement con.createStatement() then
statement.executeQuery(sql), but that doesn't work either...
Can anyone tell me what I'm doing wrong?
Thanks...
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Have you tried running the query directly against Access? I'm guessing you just need "SELECT * FROM PartsCategory", but that's a pretty uneducated guess. I try not to use Access anymore.
Duane Riech
Ranch Hand

Joined: Feb 27, 2003
Posts: 52
That was the first thing I tried.
I have another little java program that populates the table with a
INSERT statement and it works fine. I guess my question is "Does MS Access"
support SQL statements?
Also, how do you query against the MS Access db using SQL. I was not aware
that you could. I have used a query via the Wizard, but not SQL.
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
I have another little java program that populates the table with a
INSERT statement and it works fine. I guess my question is "Does MS Access"
support SQL statements?
Yes it does. The INSERT statement was SQL, wasn't it?
Also, how do you query against the MS Access db using SQL. I was not aware that you could. I have used a query via the Wizard, but not SQL.

The code you posted looks fine from a Java point of view. What I don't know is whether the "jdbcdbc:..." string you have is correct. I'll let someone who has actually done something with Access comment on that.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
 
Don't get me started about those stupid light bulbs.
 
subject: Driver does not support this function..