import sun.jdbc.odbc.*;
import java.sql.*;
class excelWorkBook
{
public static void main(String args[]) throws SQLException
{
JdbcOdbcDriver d = new JdbcOdbcDriver();
DriverManager.registerDriver(d);
Connection con = DriverManager.getConnection("jdbc:odbc:xdsn");
Statement st = con.createStatement();
String query = "SELECT * FROM [beers$]";
ResultSet rs = st.executeQuery(query);
while(rs.next())
{
System.out.println(rs.getInt(1)+" "+rs.getInt(2)+" "+rs.getInt(3)+" "+rs.getInt(4)+" "+rs.getInt(5));
}
st.close();
con.close();
}
}
java.sql.Exception:[Microsoft] [ODBC excel驱动程序]啤酒$不是有效名称。
我在运行程序时遇到异常