jdbc桥接odbc 访问Access数据库 参数不足期待是1?
代码如下:importjava.sql.*;publicclasssearch_flight{publicstaticvoidmain(Stringargs[]){Con...
代码如下:
import java.sql.*;
public class search_flight
{
public static void main(String args[])
{
Connection con;
Statement sql;
ResultSet rs;
try
{
Class.forName("trip.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e){}
try
{
con = DriverManager.getConnection("jdbc:odbc:trip","","");
sql = con.createStatement();
rs = sql.executeQuery("SELECT flightNum,FromCity,ArivCity,flightprice FROM FLIGHTS
WHERE flight_numAvail>0");
while(rs.next())
{
String flightNum = rs.getString(1);
String FromCity = rs.getString(2);
String ArivCity = rs.getString(3);
int flightprice = rs.getInt(4);
}
con.close();
}
catch(SQLException e)
{
System.out.println(e);
}
}
}
java.sql.SQLException:[Microsoft][ODBC Microsoft Access Driver]参数不足,期待是1.
请问是哪里的问题? 展开
import java.sql.*;
public class search_flight
{
public static void main(String args[])
{
Connection con;
Statement sql;
ResultSet rs;
try
{
Class.forName("trip.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e){}
try
{
con = DriverManager.getConnection("jdbc:odbc:trip","","");
sql = con.createStatement();
rs = sql.executeQuery("SELECT flightNum,FromCity,ArivCity,flightprice FROM FLIGHTS
WHERE flight_numAvail>0");
while(rs.next())
{
String flightNum = rs.getString(1);
String FromCity = rs.getString(2);
String ArivCity = rs.getString(3);
int flightprice = rs.getInt(4);
}
con.close();
}
catch(SQLException e)
{
System.out.println(e);
}
}
}
java.sql.SQLException:[Microsoft][ODBC Microsoft Access Driver]参数不足,期待是1.
请问是哪里的问题? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询