I tried to get the data from my database name as jaane with user name Hello and Password hello. Error:
java.lang.SecurityException: Prohibited package name:
You need to specify the Database Name, and there are two slashes before localhost. I assume hello is your username and Hello the password...
Connection connection = DriverManager.getConnection( "jdbc:derby://localhost:1527/DatabaseName","hello","Hello" );
...that is after you change your package name to something other than java!
If your project is inited by Gradle, I recommend you to change the project by specifying the package name, then we can avoid the problem.
gradle init --type java-application --test-framework junit --package packname
java.lang.SecurityException: Prohibited package name: java
You cannot use java as the name of your package. Replace it to something else.
Change your package name. java
as a package name is prohibited.
Edit: Move your Main.java
file in a (source) directory that doesn't start with java
or javax
and use the directory structure names to change your package name in the code.
Never Keep your class in a root package as "java" or never create a package starting as java. ... you can use any other identifier as your package name.
Look at why `java.lang.SecurityException: Prohibited package name: java` is required?
User code is never allowed to put classes into one of the standard Java packages. That way, user code cannot access any package-private classes/methods/fields in the Java implementation. Some of those package-private objects allow access to JVM internals. (I'm thinking of SharedSecrets in particular.)