This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 248822 - Database sample is not usable (installation of NetBeans 8.0.1)
Summary: Database sample is not usable (installation of NetBeans 8.0.1)
Status: RESOLVED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: Derby (show other bugs)
Version: 8.0.1
Hardware: PC Windows 7
: P2 normal (vote)
Assignee: matthias42
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-22 08:11 UTC by ricg
Modified: 2015-09-20 01:32 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ricg 2014-11-22 08:11:21 UTC
Just after the installation of NetBeans 8.0.1 (Java EE version) I received this message while trying to connect to sample database (in the tab "Services"):
Unable to connect. Cannot establish a connection to jdbc:derby:/localhost:1527/sample using org.apache.derby.jdbc.ClientDriver.

I think the reason is that the file service.properties is missing in the directory sample of .netbeans.derby.

It is very annoying because a lot of demos on the web are using that database and, as a teacher, I use it too for my students. Moreover I think it should be easy to correct this error.

If I use an old sample directory instead of the new one installed with NetBeans 8.0.1, it works but the structure of that old version is not the same as the new one.

I have the error with Windows 7 and Windows Vista.
Comment 1 matthias42 2014-11-22 15:58:13 UTC
This is _not_ reproducible. I did this:

- Create Virtual Box
- Install Windows 8.1 Enterprise Evaluation 64 Bit
- Install JDK 8u25 64 Bit
- Install Netbeans 8.0.1 Java EE Version (.exe) from netbeans.org

I started netbeans, opened services, expanded Databases, and selected connect on the jdbc:derby://localhost:1527/sample node (the only one after a clean install). As expected the javadb server is started and I get a connection.

When I deleted the sample db, the connection as removed. 

After that - I deleted the netbeans cache from the user local profile and the netbeans config from the roaming profile and started again. (Netbeans was shut down while doing this).

After starting netbeans, the sample database was again created. Now I quit netbeans, deleted the sample database outside netbeans, started netbeans and tried to connect. _Now_ I get the same error.

I don't consider this a bug - but a valid error. Maybe a good option would be to add a "Recreate sample database" option to the Java DB Properties dialog...

I saw similar on a 32bit Windows 2003 Server installation with a jdk7.

I'll close this as WORKSFORME - please reopen, if you can provide instructions to reproduce this.
Comment 2 ricg 2014-11-22 17:00:37 UTC
Thanks for your answer but I don't understand how to get rid of my problem. I am not sure to understand exactly the meaning of worksforme; I hope my new comment will be enough to reopen the issue. I think the problem comes from the point 3. below.

Here what I did to get the new version of the structure of the sample database (with Windows 7):
  1. I had to remove NetBeans 8.0.1 because I had installed it before but, as I had not removed the sample database before, the sample database was not reinstalled and I had the old structure of the sample database. I removed the current NetBeans 8.0.1 with control panel / Uninstall a program.
  2. I removed the sample directory from .netbeans.derby.
  3. I installed NetBeans 8.0.1 (Java EE version). After the installation, there is the sample directory anew, but this directory has only 2 sub directories (seg0 and log), and nothing else (no service.properties). *I think the problem is here: why the new sample directory without the service.properties file?*
  4. I launch NetBeans and it is not possible to use the sample database from NetBeans.

Why there is no service.properties in the sample directory? What is my error? What would I have done instead?

A lot of my students have the same problem. Other people had the same issue (http://forums.netbeans.org/post-160690.html).

Can you tell me what is the meaning of "I deleted the netbeans cache from the user local profile"? Do you delete the .netbeans directory? I did not delete the netbeans config from the roaming profile but I told NetBeans not to use any configuration from a previous installation.

Yes it would be a good option to ask during the installation of NetBeans (or at any moment) if the sample database has to be recreated in order to get any new structure of the database.
Comment 3 matthias42 2014-11-22 17:43:53 UTC
Some information first: 
1) I'm not a netbeans developer, but from my perspektive the only on working on bugs
2) WORKSFORME means exactly that. I can't reproduce the problem. With > 300 Bugs open I prefer to close unreproducible bugs (try to find a bug, that is worth working on without this...)

(In reply to ricg from comment #2)
> Thanks for your answer but I don't understand how to get rid of my problem.

> Can you tell me what is the meaning of "I deleted the netbeans cache from
> the user local profile"? Do you delete the .netbeans directory? I did not
> delete the netbeans config from the roaming profile but I told NetBeans not
> to use any configuration from a previous installation.

You can only tell netbeans not to _import_ settings from a previous installation. If current settings are present, they are _always_ used (not sure if they are removed on deinstallation).

In most cases (if you don't want/can investigate further) the easiest way:

1. Remove derby database directory (the whole directory!) - Windows default looks to be:
c:\Users\<username>\.netbeans-derby
2. Remove the netbeans cache:
c:\Users\<username>\AppData\Local\NetBeans
3. Remove the netbeans config from roaming profile:
c:\Users\<username>\AppData\Roaming\NetBeans

This should cause a "factory" reset.
Comment 4 ricg 2014-11-22 17:55:38 UTC
Thanks for your help.

I will try tomorrow (I have to leave now) your 3 points to trigger a factory reset and I will tell you if my problems are solved after this reset.
Comment 5 ricg 2014-11-23 10:40:54 UTC
I have just tried your 3 steps to remove c:\Users\<username>\.netbeans-derby,
c:\Users\<username>\AppData\Local\NetBeans and c:\Users\<username>\AppData\Roaming\NetBeans.

It works: when I launch NetBeans I get the database sample with the new structure (with the table Micro-Market). Thanks.

However, all the configuration of NetBeans is lost. So it would be good to add a way to remove the sample database and get a new version of the database without removing all the configuration.

If a user wants to get a new version of sample with a new version of NetBeans it is natural that he or she removes the sample directory before installing NetBeans, but it does not work.

To reproduce the problem, follow the 4 steps below:
1. Uninstall NetBeans.
2. Remove the sample directory from .netbeans-derby.
3. Install NetBeans.
4. Try to connect to the sample database. It does not work. In the sample directory of .netbeans-derby there are only the directories log and seg0 without service.properties.

It is certainly a bug: either nothing is installed or all must be installed for the sample database.
Comment 6 helmwag 2015-04-30 13:31:20 UTC
I ran into the same problem. Uninstalled and reinstalled Netbeans 8.02 a month ago. Yesterday i needed the sample database for a book exercise. The db connection was still there under "services", but resulted in a "not found" error. The sample db was gone. Found a workaround:

- deleted the 'sample' db connection in Services and only the 'sample' folder in c:\Users\<username>\.netbeans-derby
- found a code at http://code.metager.de/source/xref/netbeans/derby/etc/sample.sql
- created a new DB in Netbeans the usual way, named 'sample'
- connected to the db , used the code, found above and ran it
Comment 7 doozer 2015-06-25 13:23:48 UTC
I'm experincing the exact same issue. Out of the box the sample database gives a not found error. As ricg reported the service.properties file is missing the rest appear to be correct. 

The work around described by helmwag works although I feel a bit vulranble having to download SQL from some other site!

This database is used by a lot of tutorials so I think it would make sense to have a "Burn and Recreate" option in the menu.
Comment 8 kwrobel 2015-09-15 20:32:29 UTC
That is a possible workaround. But, a fresh NetBeans user should not be forced to hunt down some SQL script in order to create a database that has been available and bundled with NetBeans for such a long time. Just not acceptable.

(In reply to helmwag from comment #6)
> I ran into the same problem. Uninstalled and reinstalled Netbeans 8.02 a
> month ago. Yesterday i needed the sample database for a book exercise. The
> db connection was still there under "services", but resulted in a "not
> found" error. The sample db was gone. Found a workaround:
> 
> - deleted the 'sample' db connection in Services and only the 'sample'
> folder in c:\Users\<username>\.netbeans-derby
> - found a code at
> http://code.metager.de/source/xref/netbeans/derby/etc/sample.sql
> - created a new DB in Netbeans the usual way, named 'sample'
> - connected to the db , used the code, found above and ran it
Comment 9 kwrobel 2015-09-15 20:39:26 UTC
I can 100% reproduce this using the latest. Here are the steps (I am using VirtualBox):

1. Install fresh Debian GNU Linux 8 with desktop of your choice. I chose the GNOME desktop
2. Go to terminal and become super user (su -)
3. apt-get install openjdk-7-jdk
4. Now download netbeans-8.0.2-javaee-linux.sh from NetBeans web site
5. In terminal, type: sh Downloads/netbeans-8.0.2-javaee-linux.sh and install NetBeans.
6. Open Netbeans 8.0.2
7. Click on Tools->Services
8. Expand "Databases" node and start JavaDB server
9. Right-click on the pre-configured database connection for sample and click on connect
10.NetBeans may nag you for a Master password, which you can either set or click cancel (doesn't matter to reproduce this error)
11.A connection refused message will appear with reason that sample was not found.

It's important to note that .netbeans-derby/sample does exist in the user's home directory. I can reproduce this using these steps 100%. And for me, uninstalling NetBeans 8.0.2, deleting the .netbeans-derby directory and then reinstalling NetBeans does _NOT_ solve the issue.

(In reply to doozer from comment #7)
> I'm experincing the exact same issue. Out of the box the sample database
> gives a not found error. As ricg reported the service.properties file is
> missing the rest appear to be correct. 
> 
> The work around described by helmwag works although I feel a bit vulranble
> having to download SQL from some other site!
> 
> This database is used by a lot of tutorials so I think it would make sense
> to have a "Burn and Recreate" option in the menu.
Comment 10 matthias42 2015-09-16 18:51:00 UTC
(In reply to kwrobel from comment #9)
> It's important to note that .netbeans-derby/sample does exist in the user's
> home directory. I can reproduce this using these steps 100%. And for me,
> uninstalling NetBeans 8.0.2, deleting the .netbeans-derby directory and then
> reinstalling NetBeans does _NOT_ solve the issue.

Do I understand you correctly, that you hava a sample directory inside .netbeans-derby, that is not a valid derby db?

What do you expect netbeans to do? It can't just replace that directory with a valid sample database - that would potentially destroy user data, do you expect a warning?

I see the option to add a "Create Java DB Sample Database" entry to the popup on the "Java DB" node. Would that meet your expectations for a solution? If not - what sequence do you suggest?
Comment 11 Jiri Kovalsky 2015-09-17 12:58:56 UTC
Matthias, since this is a P2 issue, it must be according to 8.1 Quality Criteria either fixed or officially waived [2]. In the latter case please add 8.1_WAIVER_REQUEST keyword. Thanks.

[1] http://wiki.netbeans.org/NetBeans_81_Quality_Criteria
[2] http://wiki.netbeans.org/WaiverProcess
Comment 12 Jiri Kovalsky 2015-09-17 12:59:54 UTC
Oops, sorry for mistakenly adding the keyword without any reason.
Comment 13 matthias42 2015-09-17 19:42:14 UTC
First: I did not want to give the impression that this should not be fixed, though I doubt that P2 is appropriate. 

Nonetheless a fix was pushed to core-main:

http://hg.netbeans.org/core-main/rev/5667a9a4e4f3

This changeset:

- gives an error message when the sample database can't be created because a non-empty sample directory is present that is not a derby db
- exposes the option to create a sample java db via a menu entry in the popup-menu of the Java DB node
- does not fail on an empty sample directory - in this case the sample db is created in that directory (if there are files in there this is an error, see #80122)

In the next few days a new nightly build will be created that contains this change - when this happens a message will be appended to this bug. Please check that nightly (or a later one) and verify the fix. If you find the issue fixed please change the bug status to VERIFIED.

Thank you.
Comment 14 Quality Engineering 2015-09-20 01:32:51 UTC
Integrated into 'main-silver', will be available in build *201509200002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/5667a9a4e4f3
User: Matthias Blaesing <matthias42@netbeans.org>
Log: #248822: Database sample is not usable