简体   繁体   English

检查Java Derby中是否存在Schema

[英]Checking if Schema exists in Java Derby

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 : "". " 我收到一条错误,上面写着“第1行第23栏的词汇错误。遇到:”\\“(92),之后:”“。”

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 : dbName是:

"C:/.testing/DerbyDB/AssetDB"

What am I doing wrong here? 我在这做错了什么?

Old question but is the first result so I might as well respond it. 老问题,但这是第一个结果,所以我不妨回应它。

SELECT * FROM SYS.SYSSCHEMAS SELECT * FROM SYS.SYSSCHEMAS

And Derby does support schemas, at least on v10.8 which is the one I'm working with. Derby确实支持模式,至少在我正在使用的v10.8上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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