简体   繁体   English

org.apache.derby.jdbc.ClientDriver ; 无法连接

[英]org.apache.derby.jdbc.ClientDriver ; unable to connect

Unable to connect.无法连接。 Cannot establish a connection to jdbc:derby://localhost:1527/sample using org.apache.derby.jdbc.ClientDriver (DERBY SQL error: ERRORCODE: 40000, SQLSTATE: XJ040, SQLERRMC: Failed to start database 'sample' with class loader sun.misc.Launcher$AppClassLoader@1d44bcfa, see the next exception for details.::SQLSTATE: XSLAN).无法使用 org.apache.derby.jdbc.ClientDriver 建立到 jdbc:derby://localhost:1527/sample 的连接(DERBY SQL 错误:ERRORCODE:40000,SQLSTATE:XJ040,SQLERRMC:无法使用类启动数据库“sample” loader sun.misc.Launcher$AppClassLoader@1d44bcfa,详情参见下一个异常。::SQLSTATE: XSLAN)。

When you do a connection you should put it into a try/catch.当您进行连接时,您应该将其放入 try/catch 中。 For example ( I use Java 8 and oracle SQLDeveloper ) :例如(我使用 Java 8 和 oracle SQLDeveloper):

 String dbURL="jdbc:oracle:thin:@localhost:1521:xe";
    String username = "system";
    String password = "root";


    try{

    Connection connection = DriverManager.getConnection(dbURL,username,password);
        System.out.println("Connected to Oracle database server");

        
        String sql = "INSERT INTO USERS (name,email,password)" + "VALUES('eu', 'eu@yahoo.com', 'eu')";

        Statement statement = connection.createStatement();
        int rows = statement.executeUpdate(sql);

        if(rows >0){
            System.out.println("A row has been inserted");
        }



        connection.close();
    }catch (SQLException e){
        System.out.println("ERROR");
    }

And always check for right password and username.并始终检查正确的密码和用户名。 Hope this helps.希望这可以帮助。 :D :D

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 org.apache.derby.jdbc.ClientDriver 在哪里? - where is org.apache.derby.jdbc.ClientDriver? java-找不到类[org.apache.derby.jdbc.ClientDriver] - java - Class [org.apache.derby.jdbc.ClientDriver] not found 未找到类[org.apache.derby.jdbc.ClientDriver]。 尝试连接到db时 - Class [org.apache.derby.jdbc.ClientDriver] not found. When trying to connect to db 无法使用org.apache.derby.jdbc.ClientDriver建立与MySQL的连接 - Cannot establish connection to MySQL using org.apache.derby.jdbc.ClientDriver 日志中的Heroku错误:java.lang.ClassNotFoundException:org.apache.derby.jdbc.ClientDriver - Heroku error in logs: java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDriver 创建数据库时出错:java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDriver - An error occurred while creating the database: java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDriver 线程“主”java.lang.ClassNotFoundException 中的异常:org.apache.derby.jdbc.ClientDriver - Exception in thread “main” java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDriver java.lang.ClassNotFoundException:org.apach.derby.jdbc.ClientDriver - java.lang.ClassNotFoundException: org.apach.derby.jdbc.ClientDriver java.lang.ClassNotFoundException:org.apache.derby.jdbc.EmbeddedDriver - java.lang.ClassNotFoundException: org.apache.derby.jdbc.EmbeddedDriver Apache Derby示例数据库问题; '无法连接' - Apache Derby sample database issue; 'Unable to connect'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM