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...
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
posted
0
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
posted
0
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.