composite_2.setBounds(10, 0, 867, 450); Button button3 = new Button(composite_2, SWT.NONE);
                 //按钮监听
button3.addMouseListener(new MouseAdapter() {
@Override
public void mouseDown(MouseEvent e) {
String str = "select* from TABLE1 where 车次='"+ text_6.getText()+"'";



connection con1 = new connection(str);

final Vector<String[]> Result = con1.querry();//查询并显示到Table中去
for (int i = 0; i < Result.size(); i++) {
TableItem item = new TableItem(table_1, SWT.NONE);
item.setText((String[]) Result.get(i));
} }
});
//数据库连接
package com;import java.sql.*;
import java.util.Vector;public class connection {
String Sql;
    Connection con = null;
    ResultSet res;
    Statement statement;
    String url= "jdbc:oracle:thin:@localhost:1521:msn";
car car1=new car();
    
public connection(String sql) {
super();
Sql = sql;
}public void update(){
  try
  {
   Class.forName("oracle.jdbc.driver.OracleDriver");
  }
  catch(ClassNotFoundException ex) 
  { System.out.println("出错啦");}

  try {

con= DriverManager.getConnection(url,"me","123");
System.out.println("数据库连接成功!"+con);
statement = con.createStatement();
System.out.println(Sql);
statement.executeQuery(Sql);
System.out.println("NO");
statement.close();
con.close();
}catch(SQLException e){
System.out.println("FUCK");
}
}
//查找
public Vector<String[]> querry(){
Vector<String[]> vector=new Vector<String[]>();   try
  {
   Class.forName("oracle.jdbc.driver.OracleDriver");
  }
  catch(ClassNotFoundException ex) 
  { System.out.println("出错啦");}

  try {

con= DriverManager.getConnection(url,"me","123");
System.out.println("数据库连接成功!"+con);
statement = con.createStatement();
System.out.println(Sql);
res=statement.executeQuery(Sql);
        int  numCols =5;
        //res.last();
        //int tempnum=res.getRow();
         while(res.next())
{
String strTempArray[] = new String[numCols];
          for(int i = 1; i <= numCols; i++)
{
            strTempArray[i - 1] = res.getString(i);
}
vector.addElement(strTempArray);
} System.out.println("NO");
statement.close();
con.close();
}catch(SQLException e){
System.out.println("FUCK");
}
      return vector;
  
  }}

解决方案 »

  1.   

    就是输出了这句话System.out.println("FUCK");
      

  2.   

    最有可能就是TABLE1 这个表没有5个字段
      

  3.   

    调试的时候老是从res.next()直接跳转到System.out.println("FUCK");
      

  4.   

    java.sql.SQLException: ORA-00903: 表名无效
      

  5.   

    strTempArray[i - 1] = res.getString(i);感觉像是这里错的。而且,楼主怎么用vector
      

  6.   

    为什么不用List<Friend>,这样的,而用数组。
      

  7.   

    int numCols =5;是指数据库中的列数吗?
      

  8.   

    select* from TABLE1 where 车次='YFF678'
    java.sql.SQLException: ORA-01009: 必需的参数缺失
    上面的SQL语句我再SQLPLUS里运行都没问题咋弄代码里面就要报这个异常哦