标题:java 连接 access 的问题,
只看楼主
qwe885167759
Rank: 4
等 级:业余侠客
威 望:5
帖 子:148
专家分:259
注 册:2013-3-12
结帖率:72.22%
 问题点数:0 回复次数:1 
java 连接 access 的问题,
求指点,代码如下:
package sql;

import java.sql.*;

public class Examplet_1
{
    public static void main(String args[])
    {
        Connection con;
        Statement sql;
        ResultSet rs;
        try
        {
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        }catch(ClassNotFoundException e)
        {
            System.out.println(e);
        }
        try
        {
            con = DriverManager.getConnection("jdbc:odbc:star");
            sql = con.createStatement();
            rs = sql.executeQuery("SELECT * FROM employee WHERE salary>190");
            while(rs.next())
            {
                String number = rs.getString(2);
                String name = rs.getString(3);
                Date date = rs.getDate("birthday");
                double salary = rs.getDouble("salary");
                System.out.printf("% - 4s",number);
                System.out.printf("% - 6s",name);
                System.out.printf("% - 15s",date.toString());
                System.out.printf("%6s\n",salary);
            }
            con.close();
        }catch(SQLException e )
            {
                System.out.println(e);
            }
        
    }
 
}

问题是
java.sql.SQLException: [Microsoft][ODBC Microsoft Access 驱动程序] 参数不足,期待是 1。
求指点
搜索更多相关主题的帖子: package access public import java 
2014-05-31 09:59
qwe885167759
Rank: 4
等 级:业余侠客
威 望:5
帖 子:148
专家分:259
注 册:2013-3-12
得分:0 
已解决
字段写错了

我本楚狂人,凤歌笑孔丘
2014-05-31 10:13



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-432308-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.013955 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved