解决方案 »

  1.   

    java代码:
    Class.forName("com.mysql.jdbc.Driver");
    conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/comfan_class_memery", "root", "123456");
    String sql = "call classm_p_ur_idgeneration_pp(@xx);\n" +
    "select @id as id;";
    Statement st = conn.createStatement();
    ResultSet rs = st.executeQuery(sql);
    if(rs.first()){
    System.out.println(rs.getString(0));
    }
      

  2.   

    我修改了一下代码 String sql = "call classm_p_ur_idgeneration_pp(@xx);" +
    "select @id as id";
    依然有错  异常信息 是 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ';select @id as id' at line 1 
      

  3.   

    jdbc执行的是标准的sql ,你这是标准的sql吗
      

  4.   


    是MySQL的语法....
    要实现我过程里面的处理结果返回用什么方法好呢?
      

  5.   

    看起来像存储过程,不是应该调用conn.prepareCall来调用的吗
      

  6.   

    将SQL语句改为
    select CONCAT(ctprop.data,DATEDIFF(NOW() , '1970-01-01 08:00:00.000'),CEILING(RAND()*100000000000)) 
    from classm_t_propreties ctprop where `key`='user.idgeneration.ad';直接在JDBC中执行这句即可
      

  7.   


    这是啥意思啊?这个错.Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
    at com.mysql.jdbc.CallableStatement.setInOutParamsOnServer(CallableStatement.java:2270)
    at com.mysql.jdbc.CallableStatement.executeQuery(CallableStatement.java:952)
    at cn.comfan.integer.number.convert.test.NumberConvertorTest.main(NumberConvertorTest.java:47)
      

  8.   


    这是啥意思啊?这个错.Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
    at com.mysql.jdbc.CallableStatement.setInOutParamsOnServer(CallableStatement.java:2270)
    at com.mysql.jdbc.CallableStatement.executeQuery(CallableStatement.java:952)
    at cn.comfan.integer.number.convert.test.NumberConvertorTest.main(NumberConvertorTest.java:47)
    数组越界……
      

  9.   

    你这个是两条sql语句,第一个是调一个存储过程,第二个是查询,你直接在存储过程里返回不就好了,而且存储过程一般是conn.prepareCall调用的
      

  10.   

    我这个写在里面不是为了就这样的啊 , 是为了重复调用 这个 其实是在MyBatis里面的.求支招
      

  11.   

    JDBC要执行回传的参数的过程需要一个一个的执行。在SQL中能用'@id'  表示回传的参数但在JDBC中是不可以的。谢谢各位!