execute都通不过,还没到取数据的时候呢。

解决方案 »

  1.   

    可能是由于jdbc不能识别该类型,换个sql的驱动程序看看
      

  2.   

    String sql = "select name,population from cities";  //population 是bigint类型的字段
    statement.execute(sql);       //这时发生上述的错误
      

  3.   

    我觉得是驱动程序的问题,程序找不到你的驱动程序。因为我上次用postgresql,也是出现这种问题(驱动程序还要支持java),不过,我用的是jbuilder5,在project properties,里加上驱动程序包就ok。
      

  4.   


    换个微软自己出的SQL server 2k jdbc 2.0驱动程序
      

  5.   

    JDBC 3。0版本提供对BIG 类型的支持,2。0版本的可能不行
      

  6.   

    JDBC 3。0现在有没有正式版的?
    另外,用JDBC 2。0就没有解决办法了吗?我用的是微软出的SQL server 2k jdbc
      

  7.   

    一很用以String读出来,后面再作处理,在JAVA再作处理很容易
    /*
    /*@ author:yjx
    /*@ date:2001-7-9
    *//*import package file*/
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import java.lang.*;public class Loginservlet extends HttpServlet
    {
    public void doPost(HttpServletRequest req,
                        HttpServletResponse resp)
        throws ServletException,java.io.IOException
        {
    PrintWriter out;
    String          strUserName,strPWD;
    String          strDBDriver,strURL;
    String          strSQL,strTemp;
    Connection      conn=null;
    Statement       stmt=null;
    ResultSet       rs=null;
    int             iExist=0;//0:not exits,1:exits
    HttpSession     session; session=req.getSession();
            out = resp.getWriter(); //get parameters
    strUserName=req.getParameter("username");
         strPWD=req.getParameter("password");        //set database connection parameter value
    strDBDriver="sun.jdbc.odbc.JdbcOdbcDriver";
    strURL="jdbc:odbc:wygl";        if(strUserName!=null || strUserName.compareTo("")!=0){
    //instance session variable:
    session.putValue("login_name","");
    session.putValue("user_name","");
    session.putValue("dept_id","");
    session.putValue("duty","");
    session.putValue("mright","");
    session.putValue("uitype","");
    session.putValue("logined","false");
    session.putValue("info","null");
        
    //connect database
    try{
    Class.forName(strDBDriver);
    }catch(java.lang.ClassNotFoundException e){
    System.err.println("error:"+e.getMessage());
    } try{
    conn=DriverManager.getConnection(strURL);
    stmt=conn.createStatement();
    }catch(SQLException e){
    System.out.println("error:"+e.getMessage());
    }
                strSQL="select * from sys_user where login_name='"+strUserName+"' and user_pwd='"+strPWD+"'"; try{
    rs=stmt.executeQuery(strSQL);
    if(rs.next()){
    session.putValue("login_name",strUserName); session.putValue("logined","true"); strTemp=rs.getString("user_name");
    session.putValue("user_name",strTemp); strTemp=rs.getString("dept_id");
    session.putValue("dept_id",strTemp);

    strTemp=rs.getString("duty");
    session.putValue("duty",strTemp); strTemp=rs.getString("mright");
    session.putValue("mright",strTemp); strTemp=rs.getString("uitype");
    session.putValue("uitype",strTemp); resp.sendRedirect("/wygl/jsp/sysindex.jsp");
    }else{
    resp.sendRedirect("/wygl/jsp/errorindex.jsp");
    }
    }catch(SQLException e){
    System.err.println("error:"+e.getMessage());
    }
    }
    }
    }
      

  8.   

    关于nicolas的回答,我在前面已经提到,我这个包含对bigint字段的表的查询在execute时就已经出错,所以转换到任何类型都是无法实现的
      

  9.   

    给 mellono 你好,你用的是jdk自己带的jdbc-odbc吗,我现在不知道怎么样来连接数据库你能够和我说说吗??
    我建立了db1数据原,在这个数据原下面,有个数据库test 他下面有个city表我现在想访问他
    对了用户名是sa 密码是password
    jdk1.3下面不是有一个jdbc-odbc驱动程序马,我用这个来访问sqlserver数据库
      

  10.   

    回复boyandgirl你好,我用的数据库驱动是微软的jdbc for SQL Server 2000。用jdbc-odbc也可以,只不过限制多多。用jdbc-odbc连接数据库的程序示例写在下面:
    String driverName = "sun.jdbc.odbc.JdbcOdbcDriver";
    String dbURL = "jdbc:odbc:test";
    Properties prop = new Properties();
    prop.put("user","sa");
    prop.put("password","password");
    try {
          driver = (Driver) Class.forName(driverName).newInstance();
          connection = driver.connect(dbURL,prop);
    } catch (SQLException sqle) {
          System.out.println(sqle);
    }