在Netbeans中连接Derby数据库时出错:无效的属性语法

时间:2017-12-09 20:41:49

标签: java netbeans derby

尝试在netbeans中连接到Derby数据库时遇到错误。 以下是发生错误的方法。

 public int myConnect() throws ClassNotFoundException, SQLException {

        try {
            Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance();
        } catch (ClassNotFoundException | java.lang.InstantiationException | java.lang.IllegalAccessException e) {
        }

        String url = "jdbc:derby://localhost:1527/sample;create=true;user=app;password=app; ";



        Connection con = DriverManager.getConnection(url);

        PreparedStatement ps = con.prepareStatement("insert into students(name,email) values(?,?)");

        ps.setString(1, name);
        ps.setString(2, email);

        int test = ps.executeUpdate();

        if (test == 1) {
            return test;
        } 

    }

这是错误 org.apache.derby.client.am.SqlException:无效的属性语法:; create = true; user = app; password = app;

用户名和密码也是正确的。 感谢任何帮助。谢谢。

0 个答案:

没有答案