Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 172101 - java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few para...
Status: RESOLVED WONTFIX
Product: db
Classification: Unclassified
Component: Code
6.x
All All
: P2 (vote)
: 6.x
Assigned To: Jiri Rechtacek
issues@db
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-09-13 15:01 UTC by javanus
Modified: 2009-09-23 20:14 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


Attachments
access db (7.14 KB, application/x-compressed)
2009-09-14 20:00 UTC, javanus
Details

Note You need to log in before you can comment on or make changes to this bug.
Description javanus 2009-09-13 15:01:42 UTC
Hi,

I am using MS Access database. East european characters are also used for column names. I got the following error when 
I query this table: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
The error occurs only while using Netbeans 6.7. It works on Netbeans 6.5 and if I running the application from jar. 

How to repeat an error:
1.create table "test" in Ms access
2.the table should have the field "vpisna številka" as string
3.perform a query on this table (select * from test where [vpisna številka] = '1111'

Below is the error stack:
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
        at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6957)
        at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7114)
        at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3110)
        at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:338)
        at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(JdbcOdbcStatement.java:253)
        at grid.SQL2TableModel.executeQuery(SQL2TableModel.java:266)
Comment 1 Jiri Prox 2009-09-14 08:22:48 UTC
I'm not sure if we can do anything about it on netbeans side, the exception comes from the driver, 
reassigning to db module
Comment 2 Jiri Rechtacek 2009-09-14 13:00:47 UTC
I don't know what grid.SQL2TableModel is. It seems as a 3rd party module, not is DB tooling module suite. If I'm wrong,
add more information like messages.log, what driver are you using, more details where start in IDE to reproduce this
problem. Thanks
Comment 3 javanus 2009-09-14 20:00:45 UTC
Created attachment 87648 [details]
access db
Comment 4 javanus 2009-09-14 20:04:17 UTC
Hi,

grid.SQL2TableModel is my class used to read data from db to table model. The error occurs at statement.executeQuery. 
I have prepare a test case. Please create a new project in netbeans 6.5 and create a new java class with the code 
below. Access db is in the attachment. Please do not forget to modify the path to the database in the java code. 
Please run this code in netbeans 6.5 and 6.7. Does it work in 6.7?

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author pmihelic
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        try {
            Connection iDbConn;
            String url = "jdbc:odbc:Driver={Microsoft Access Driver 
(*.mdb)};DBQ=C:/Temp/netbeans67_bug/db.mdb;PWD=;''";

            iDbConn = DriverManager.getConnection(url);

            Statement statement = iDbConn.createStatement();
            ResultSet resultSet = statement.executeQuery("SELECT * FROM test_table WHERE [vpisna številka]='blabla'");
            while (resultSet.next()) {
                System.out.println("test=" + resultSet.getString(1));
            }
            resultSet.close();
            statement.close();
        } catch (SQLException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

}


Best regards,
Primoz
Comment 5 javanus 2009-09-20 21:31:45 UTC
Hi,

I found out that the value for Keywords is INCOMPLETE. Should I add any other neccessary information?

Regards,
Primoz
Comment 6 Jiri Rechtacek 2009-09-21 12:44:43 UTC
Hi Primoz, I understand the problem now but I'm afraid I can help here. The problem is non-unicode encoding in your
example. Consult Access documentation how to set other encoding for that DB. There is no NetBeans IDE's code which could
be changed/fixed to pass your example.
Comment 7 javanus 2009-09-23 20:14:44 UTC
Hi, 

I have only two questions more:
1.Could you open the example in NB 6.5. Does it work?
2.What has changed in NB 6.7 regarding NB 6.5?

Regards,
Primoz


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo