小编max*_*777的帖子

java.sql.SQLException:索引:: 1处缺少IN或OUT参数

我制作了一些Java 1.6-Oracle11g-JDBC(使用OJDBC 6)代码(如下).我得到一个例外 - java.sql.SQLException: Missing IN or OUT parameter at index:: 1 为什么会发生这种情况,我该如何解决?

我的输出是 -

create CREATE TABLE employee(emp_name varchar(25),emp_address varchar(25))
insert INSERT INTO employee(jim,germany) values(?,?)
Exception: java.sql.SQLException: Missing IN or OUT parameter at index:: 1
Run Code Online (Sandbox Code Playgroud)

代码是 -

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;


public class Oracle {

public static void main(String[]args)
{

    try
    {

        Connection con = DriverManager.getConnection("jdbc:oracle:thin:@//localhost:1521/xe", "newman", "123456");
        Statement stmt = con.createStatement(); 

        String create = "CREATE TABLE employee(emp_name varchar(25),emp_address varchar(25))";
        System.out.println("create " …
Run Code Online (Sandbox Code Playgroud)

java jdbc oracle11g

24
推荐指数
2
解决办法
15万
查看次数

使用GNU STL的GCC 4.8会为std :: string构造函数生成错误的代码吗?

所以有点C++代码:

void func( const std::string& theString )
{
    std::string theString( theString );
    theString += " more string";
    std::cout << theString;
}
Run Code Online (Sandbox Code Playgroud)

GCC 4.8和编译好VS 2013.根据我的C++知识,代码是可以的,一个局部变量theString被带入范围,然后隐藏theString在函数参数中.在theString构造点,唯一theString的范围是传递给std::string构造函数的函数参数.std::string然后命名构造theString,它进入范围并theString在代码中稍后使用.唷!

但是,GCC似乎theString传递给std::string构造函数的行为是本地theString(尚未构造)导致编译的程序崩溃.使用VS 2013,代码编译并运行良好.

所以,

  1. 我的代码是否正确?或者我在做一些超出规范的事情,这意味着GCC的行为是未定义的.
  2. 这是GCC中的错误吗?

c++ gcc stl undefined-behavior

13
推荐指数
2
解决办法
1486
查看次数

ReactJS:如何根据props的值对对象数组进行排序?

我有一个React对象数组,我想根据其中一个道具的值对它们进行排序.

var arr=[];
arr[0] = <Fruit name="orange" count={10}/>
arr[1] = <Fruit name"apple" count={5}/>
Run Code Online (Sandbox Code Playgroud)

是否内置了React函数,我可以使用它按照水果的升序排序这个数组count

javascript arrays sorting reactjs

4
推荐指数
1
解决办法
2万
查看次数

如何使用jquery在jquery数据表中插入序列号?

< script type = "text/javascript" >
  $(function() {
    var oAllLinksTable = $("#mydatatable").dataTable({
      "bProcessing": false,
      "bServerSide": true,
      "sAjaxSource": "/myreports/data?Id=" + id,
      "sPaginationType": "full_numbers",
      "bDestroy": true
    });
  }); 
< /script>
Run Code Online (Sandbox Code Playgroud)

我的表格如下

 <table id="headertagstable" style="width: 100%;" class="grid-table04 margin-b-20">
  <thead>
    <tr>
      <th width="10%" align="left" valign="middle">
        SI No
      </th>
      <th width="40%" align="left" class="black-link-first" valign="middle">
        Name
      </th>
      <th width="25%" align="left" valign="middle">
        Date
      </th>
      <th width="25%" align="left" valign="middle">
        Place
      </th>
    </tr>
  </thead>
</table>
Run Code Online (Sandbox Code Playgroud)

除序列号外,一切正常.如何使用jquery添加序列号?

jquery

3
推荐指数
4
解决办法
2万
查看次数

如何在二叉树中查找最大值

我必须以这样的方式完成方法maxElem(节点节点),方法maxElem()返回二叉树中包含的最大值.

我怎样才能做到这一点?我不知道如何去做..

public class BinaryTree {

    protected class Node {
        protected Integer element;
        protected Node left;
        protected Node right;

        Node(int element) {
            this.element = element;
            left = right = null;
        }

        Node(int element, Node left, Node right) {
            this.element = element;
            this.left = left;
            this.right = right;
        }

    } //end Node class

    public class NodeReference {
        private Node node;

        private NodeReference(Node node) {
            this.node = node;
        }

        public int getElement() {
            return node.element;
        }

        public void …
Run Code Online (Sandbox Code Playgroud)

java algorithm binary-tree

3
推荐指数
1
解决办法
2万
查看次数

线程“main”中的异常 java.lang.ArrayIndexOutOfBoundsException:坐标越界

BufferedImage image = ImageIO.read(new File(img path));  

int width = image.getWidth();
int height = image.getHeight();
int[][] result = new int[height][width];

for (int row = 0; row < height; row++) {
  for (int col = 0; col < width; col++) {
     result[row][col] = image.getRGB(row, col);
  }
}
Run Code Online (Sandbox Code Playgroud)

这是我得到的例外:

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Coordinate out of bounds!
at sun.awt.image.ByteInterleavedRaster.getDataElements(ByteInterleavedRaster.java:301)
at java.awt.image.BufferedImage.getRGB(BufferedImage.java:871)
at PlantExtraction.main(PlantExtraction.java:46)
Run Code Online (Sandbox Code Playgroud)

我怎样才能消除这些异常?

java bufferedimage javax.imageio

3
推荐指数
1
解决办法
6630
查看次数

Android Studio 1.0编译错误 - 沿边缘不能有多个标记区域

我刚刚安装了Android Studio 1.0,我正在尝试编译我在Eclipse上开发的代码.

但是当我编译代码时,我的图像文件中会显示很多错误,如下所示:

Error:Can't have more than one marked region along edge. - Found at pixel #16 along bottom edge.
Run Code Online (Sandbox Code Playgroud)

为什么它出现在Android Studio而不是Eclipse中?Eclipse编译器和Android Studio之间有区别吗?

对不起我的英语不好!;)

谢谢

java android android-studio

3
推荐指数
1
解决办法
3829
查看次数