Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JavaDB: Schema 'root' does not exist

 
Vasilis Souvatzis
Ranch Hand
Posts: 81
1
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The title's exception is thrown when I try to persist some data to my DB. I had followed a very informative video to set up my JDBC Realm, connection pool etc... When I ping it, it's successful.

But when I try to persist the data, it crashes with these messages.


Why would it look for a "root" schema though? Aren't all settings set correctly when I created my persistence unit? My connection to the DB says "root on APP".

In an Java SE app I think you can set the schema you want to connect to, in Java EE I don't know how/if it's done.

Any suggestions?
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's too small to read. Please always post text, not screenshots. That has the added advantage that you can copy and search it.

Aren't all settings set correctly when I created my persistence unit?

That's impossible to say without knowing what all the relevant parameters are.
 
Vasilis Souvatzis
Ranch Hand
Posts: 81
1
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I'm sorry for that. i have the Netbeans log when Glassfish crashed, here it is: link

My persistence.xml is this:


If you would like to see some code of mine, I can provide snippets of the classes I have so far.
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But how is that datasource defined? Specifically, the name of the DB? It seems you're trying to access a DB named "ROOT", which doesn't exist.
 
Vasilis Souvatzis
Ranch Hand
Posts: 81
1
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The name of the DB is "jdbcrealm".

Now, in Glassfish I have set the following:

JDBC Resources:
JNDI Name - jdbc/securityDatasource
Poolname - jdbcRealmPool

JDBC Connection Pools:
Resource Type - javax.sql.ConnectionPoolDatasource
Datasource Classname - org.apache.derby.jdbc.ClientDatasource

Additional Properties:
DB name - jdbcrealm
User - root

I thought that when I created the persistent unit and entered the Datasource, that was it. But I guess I'm missing something.

By the way, thanks a lot for helping me on this
 
Vasilis Souvatzis
Ranch Hand
Posts: 81
1
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I may have figured it out... I checked one of my books and noticed that my persistence.xml looks nothing like the one the book has.

The book:


I think it's safe to assume that I need to enter properties for my database right? Maybe something like this:


edit: I noticed that my glassfish-resources.xml has all that information. So...
 
Vasilis Souvatzis
Ranch Hand
Posts: 81
1
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found it hahahaha it was such an easy fix! My glassfish-resources.xml settings, had User="root". The User property is the schema name and not the actual user that connects to the DB! When I changed it to my schema name (app) it worked perfectly!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic