data sources derby - connection refused

Do you have the Derby Server running?

It's quite possible that you are trying to connect to a database without the actual server running on Port 1527.

You could try establishing a connection using the command line / linux shell - depending on what operating system you are using.

Try this if you like:

  1. Open a command prompt
  2. Navigate to your Derby installation directory
  3. Navigate to the "bin" directory(Note:Navigate Further to networkServer folder if it exists)
  4. Type "startNetworkServer" and press Enter

You should get a message that says something like this:

2012-08-29 10:57:16.559 GMT : Security manager installed using the Basic server security policy. 2012-08-29 10:57:16.809 GMT : Apache Derby Network Server - 10.6.2.1 - (999685) started and ready to accept connections on port 1527

If you don't, then maybe you could check your firewall (comments invited here :)

If you do, then you could test your connection using the following method:

  1. Open another command prompt
  2. Navigate to your Derby installation directory
  3. Navigate to the "bin" directory
  4. Type "ij" and press Enter
  5. Type the following:

     connect 'jdbc:derby://localhost:1527/MyDB';
    

    ...and press Enter

If all goes well, you will get the "ij>" prompt back.

From here you could enter some SQL queries to test the connection further.

If not, then there might be some other problems.

If you are creating the database for the first time in derby, then you would have to use this in place of Step 5 above:

     connect 'jdbc:derby://localhost:1527/MyDB;create=true';

...and press Enter

Hopefully after doing these things, you will get a connection. In the last instance, you will at least get a new database called MyDB that is active on the Derby Server. If your original database (MyDB) is relatively small, then it might be quicker just to reconstruct it again for whatever purpose you need it for.

Further to this, if you do establish a connection, then you could try other tools that you use for database development, since you have at least eliminated the possibility that the connection is the problem.

Just be sure to check the port number that is reported from Step 4. This is usually 1527. If not, then change the port number in Step 5 (or its replacement command for a new database) for whatever port is stated in the message from Derby.

Hope this helps and good luck :)

Wayne Riesterer


Did you define an authentication alias? Seems to be the same problem as the one in link below;

http://www.webspheretools.com/sites/webspheretools.nsf/docs/Error%20when%20testing%20a%20JDBC%20connection%20to%20Derby

Also if you check SystemOut.log you may see an error message telling which property is not set;

{"08001","Required Derby DataSource property {0} not set.","40000"},