1

I am trying to check if a schema that I have created exists. I am trying to use this line to check. I get an error saying " Lexical error at line 1, column 23. Encountered: "\" (92), after : "". "

Here is the line of code that I use:

statement.execute("SELECT " + schema + " FROM "+ dbName + ".SCHEMATA WHERE SCHEMA_NAME = " + "'" + schema + "'");

I am making a connection just fine and the Database defiantly exists. The dbName is :

"C:/.testing/DerbyDB/AssetDB"

What am I doing wrong here?

  • This answer claims Derby does not support information_schema. http://stackoverflow.com/questions/3801773/how-to-check-if-a-database-exists-in-hsqldb-derby – John Watts Jun 15 '12 at 23:01
  • I think this question and answer should solve your problem. http://stackoverflow.com/questions/584497/apache-derby-check-database-already-created – John Watts Jun 15 '12 at 23:08
  • After a few hours, I figured that out. I found a way around checking for it. –  Jun 16 '12 at 03:54

1 Answers1

3

Old question but is the first result so I might as well respond it.

SELECT * FROM SYS.SYSSCHEMAS

And Derby does support schemas, at least on v10.8 which is the one I'm working with.

Eldelshell
  • 6,683
  • 7
  • 44
  • 63