Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to start derby database from Netbeans 7.4

I downloaded Netbeans 7.4 and Java 7 Update 51. I get the below error when I try to start Java DB or derby connection from Netbeans. This is on a windows 8 PC. I downloaded the version for windows xp 32 bit at work. It works fine. I am not sure what is missing.

Thu Jan 16 00:48:23 EST 2014 : Security manager installed using the Basic server security policy. Thu Jan 16 00:48:24 EST 2014 : access denied ("java.net.SocketPermission" "localhost:1527" "listen,resolve") java.security.AccessControlException: access denied ("java.net.SocketPermission" "localhost:1527" "listen,resolve") at java.security.AccessControlContext.checkPermission(AccessControlContext.java:372) at java.security.AccessController.checkPermission(AccessController.java:559) at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) at java.lang.SecurityManager.checkListen(SecurityManager.java:1134) at java.net.ServerSocket.bind(ServerSocket.java:375) at java.net.ServerSocket.<init>(ServerSocket.java:237) at javax.net.DefaultServerSocketFactory.createServerSocket(ServerSocketFactory.java:231) at org.apache.derby.impl.drda.NetworkServerControlImpl.createServerSocket(Unknown Source) at org.apache.derby.impl.drda.NetworkServerControlImpl.access$000(Unknown Source) at org.apache.derby.impl.drda.NetworkServerControlImpl$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at org.apache.derby.impl.drda.NetworkServerControlImpl.blockingStart(Unknown Source) at org.apache.derby.impl.drda.NetworkServerControlImpl.executeWork(Unknown Source)  at org.apache.derby.drda.NetworkServerControl.main(Unknown Source) 

connection propertiesjava db properties

like image 423
Superman9999 Avatar asked Jan 16 '14 06:01

Superman9999


People also ask

How do I open a Derby database in NetBeans?

Once NetBeans is running, select the Services tab, expand the Databases entry, right-click on JavaDB, select Properties. For the Derby location, enter the directory where you installed the Derby library. For the databases location, you can choose any directory you want.

How do I start Apache Derby database?

Download the latest Derby version from the Apache website http://db.apache.org/derby/. Choose the bin distribution and extract this zip to a directory of your choice. Also make the Derby tools available in your path: Set the environment variable DERBY_HOME to the Derby installation directory.

Does NetBeans support the Derby database?

In this chapter, we will work with the Derby database inside the NetBeans IDE. NetBeans has a built-in support for the Derby database in its basic Java SE bundle.

Can netnetbeans work with Java DB?

NetBeans has a built-in support for the Derby database in its basic Java SE bundle. So far we have worked with the Apache Derby distribution. In this chapter, we will work with Java DB. It is the same database, only under a different name. Java DB is shipped with Java distribution from Java 6 version.

How do I start and stop a Java DB Server?

The Java DB Database menu options are displayed when you right-click the Java DB node in the Services window. This contextual menu items allow you to start and stop the database server, create a new database instance, as well as register database servers in the IDE (as demonstrated in the previous step).

Is Apache Derby and Java DB the same thing?

So far we have worked with the Apache Derby distribution. In this chapter, we will work with Java DB. It is the same database, only under a different name. Java DB is shipped with Java distribution from Java 6 version.


1 Answers

This is what I did:

  1. Find out exactly where the java home is by executing this instruction from NetBeans 7.4 :

    System.out.println(System.getProperty("java.home"));

    This is the output for my case:

    C:\Program Files\Java\jdk1.7.0_51\jre

    which is quite important for me, I was modifying another java.policy and took no effect and wasted me a couple of hours.

  2. For reason of java.policy is an unix style file and read-only, I opened and edited it with notepad++ and executed as administrator (under the same java home):

    C:\Program Files\Java\jdk1.7.0_51\jre\lib\security\java.policy

    Add only these lines into the file after the first grant:

    grant {     permission java.net.SocketPermission "localhost:1527", "listen"; };
  3. Save the file, which is a little tricky for reason of the permission. But if you run notepad++ or any other edit program as administrator, you can solve the problem.

    Then try to connect the database from NetBeans, it works for me.

Good luck.

like image 62
user2060065 Avatar answered Oct 12 '22 14:10

user2060065