Tuesday, February 09, 2010

NetBeans 6.8 JSR-296 Database Application Example

Here is an example application development video.

5 comments :

Vicky said...

I have attempted to create a database using this tutorial: http://netbeans.org/kb/docs/ide/java-db.html

When I try to create the Database Application as you show. Netbeans 6.9.1 shows my database as: jdbc:derby://localhost:1527/contact[nbuser on NBUSER], but it errors out "Connected database doesn't contain tables"

I can see the App.Friends table and its contents using the Netbeans "View Data"

Any idea what the issue may be?
Thanks.

Vicky said...

I have followed this tutorial to create a database: http://netbeans.org/kb/docs/ide/java-db.html

When I get to the step of creating Database Application it recognizes the java:derby://localhost:1527/contact [nbuser on NBUSER] but says "Connected database doesn't contain tables"

Using Netbeans 6.9.1 I can "View Tables..." and see the contents of the FRIENDS table.

I also worked through an Apache Derby tutorial to create a database, but with the same results.

The sample database which you demo does however work for me.

Any ideas would be appreciated.
Thanks.

Vicky said...

I have completed this tutorial to create a database: http://netbeans.org/kb/docs/ide/java-db.html

When I attempt to create my Database Application as you show. Netbeans (6.9.1) recognizes my database jdbc:derby://localhost:1527/contact [nbuser on NBUSER] but errors out reporting "Connected database doesn't contain tables"

I can see the FRIENDS table and "View table..." to see its contents.

I have also tried an Apache Derby tutorial to create another database, but this also failed on this step.

The sample database which you show does however work for me.

Any ideas would be appreciated.
Thanks.

Vicky said...

Sorry, for the multiple posts. One must be patient to see them.

I do believe I have found the answer. If I create the database with app as the user, the step that shows the tables operates correctly and the desktop application is created.

John Yeary said...

Wow... Three separate comments. Let me try to answer them.

In the first comment, you are connected to the Derby (JavaDB) instance as nbuser which likely does not have tables unless you create them as nbuser. If you log into the database using APP/APP, or app/app (The most likely combinations). You will be in the APP schema where the Friends table is located.

The second comment leads me to believe that the DBs are different. If you create the DB in NetBeans, it places it in the .netbeans-derby directory. When you start the database from NetBeans, it looks in this directory. If you create the database some other place, you need to tell the persistence.xml javax.persistence.jdbc.url where the database is located with a path like C:\derby\db, etc.

The last comment may be related to the second remark above.

I hope this helps.

John

Popular Posts