La base de données ne trouve pas d'erreur lors de la connexion au réseau de Derby serveur

Je vais avoir des problèmes pour l'initialisation de mon javadb serveur de réseau et la définition de la connexion à celui-ci. C'est un JavaFX programme.

C'est ce que j'ai à ce jour:

try {
        Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance();
        javadbserver = new NetworkServerControl();
        javadbserver.start(null);
    } catch (ClassNotFoundException e) {
        Logger.getLogger(MainGuiController.class.getName()).log(Level.SEVERE, null, ex);
        System.out.println("Where is your JavaDB embedded Driver?");
        return;
    }

    String dbName = "mydb";
    String dbUser = "auser";
    String dbPass = "password";

    PreparedStatement prepstmt;

    try {
        this.conn = DriverManager.getConnection("jdbc:derby://localhost:1527/mydb;user=auser;password=password");
        System.out.println("Went through!");
    } catch (SQLException ex) {
        Logger.getLogger(MainGuiController.class.getName()).log(Level.SEVERE, null, ex);
    }

J'ai toujours attraper la deuxième exception à la règle.

Si je clic droit sur le javadb service dans netbeans et choisissez se connecter, tout fonctionne bien. [En fait, il serait bien de savoir quel code ou programme java s'exécute en arrière-plan lorsque je sélectionne que]

Dans mes projets en vertu de la liste des bibliothèques, je vois derby.jar, derbyclient.jar et derbynet.jar

Ce que je fais mal? S'il vous plaît aider!

Voici l'erreur que je reçois

java.sql.SQLNonTransientConnectionException: The connection was refused because the database mydb was not found.
at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source)
at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager.java:579)
at java.sql.DriverManager.getConnection(DriverManager.java:243)
at mydb.MainGuiController.initialize(MainGuiController.java:105)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2152)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2028)
at mydb.mydb.start(mydb.java:37)
at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319)
at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:215)
at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:179)
at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:176)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:73)
at java.lang.Thread.run(Thread.java:722)
Caused by: org.apache.derby.client.am.DisconnectException: The connection was refused because the database mydb was not found.
at org.apache.derby.client.net.NetConnectionReply.parseRDBNFNRM(Unknown Source)
at org.apache.derby.client.net.NetConnectionReply.parseAccessRdbError(Unknown Source)
at org.apache.derby.client.net.NetConnectionReply.parseACCRDBreply(Unknown Source)
at org.apache.derby.client.net.NetConnectionReply.readAccessDatabase(Unknown Source)
at org.apache.derby.client.net.NetConnection.readSecurityCheckAndAccessRdb(Unknown Source)
at org.apache.derby.client.net.NetConnection.flowSecurityCheckAndAccessRdb(Unknown Source)
at org.apache.derby.client.net.NetConnection.flowUSRIDPWDconnect(Unknown Source)
at org.apache.derby.client.net.NetConnection.flowConnect(Unknown Source)
at org.apache.derby.client.net.NetConnection.<init>(Unknown Source)
at org.apache.derby.client.net.NetConnection40.<init>(Unknown Source)
at org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40.newNetConnection(Unknown Source)
Vous êtes juste d'avaler de l'exception! Au moins l'impression d'une stacktrace si vous n'allez pas à la poignée ou le "canard". Une fois que vous obtenez le stacktrace et encore pas sûr de ce qui se passe, de l'inclure dans votre question.
yep. quelle sottise de moi.Question édité

OriginalL'auteur Nepze Tyson | 2013-06-29