简体   繁体   中英

After Installing NetBeans 8.0.2 with GlassFish 4.1 Cannot Connect to sample Database

I installed NetBeans 8.0.2 with glassfish-4.1. The sample folder is present under C:\\Users\\Username.netbeans-derby. When I bring up NetBeans and go to the Services tab the connection to sample is present: jdbc:derby://localhost:1527/sample [app on APP] but sample is not listed under Java DB so when I try to connect to sample I get the following error "Unable to connect. Cannot establish a connection to jdbc:derby://localhost1527/sample using org.apache.derby.jdbc.ClientDriver (The connection was refused becuase the database sample was not found)."

Right click on Java DB select Create Database .

  • use as Database Name 'sample'
  • use as User Name 'app'
  • leave the password empty

edit Seems there is a broken database or maybe one from an earlier Netbeans installation. Remove the sample connection in Netbeans and remove the directory %USERPROFILE%\\.netbeans-derby\\sample . Recreate the sample database as described above.

I had a broken database from an earlier version too, and then couldn't connect to the sample db. I simply had to delete the .netbeans-derby directory, then reinstalled Netbeans, and is was ok, then.

The same thing happened to me and re-installing NetBeans did not help. After poking around the databases for a bit, I finally got mine working using the following process.

  1. Create a new database with any properties (ie name, user, pw)
  2. Navigate to your user directory \\.netbeans-derby\\{name}\\
  3. Copy service.properties file and paste in \\.netbeans-derby\\sample\\
  4. Reconnect to sample database in NetBeans

A couple extra notes:

  • If you configured your NetBeans database to a different location, use that location in step 2.
  • You may need to delete and re-create the existing sample database connection in NetBeans for it to pickup the new service.properties file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM