I am trying to get the name of the database I am connected to in SQL Server. I tried doing:
Query query = session.createQuery("SELECT db_name()");
List<String> dbNames = query.list();
However, I got the following error:
[ERROR PARSER:35] *** ERROR: <AST>:0:0: unexpected end of subtree
Exception in thread "main" java.lang.IllegalStateException: No data type for node: org.hibernate.hql.ast.MethodNode
-[METHOD_CALL] MethodNode: '('
+-[METHOD_NAME] IdentNode: 'db_name' {originalText=db_name}
-[EXPR_LIST] SqlNode: 'exprList'
How can I get the name of the database I am connected to?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…