spring-projects / spring-boot

Spring Boot helps you to create Spring-powered, production-grade applications and services with absolute minimum fuss.
https://spring.io/projects/spring-boot
Apache License 2.0
75.41k stars 40.75k forks source link

JDBC command in CRaSH behaves strange #587

Closed ewolff closed 10 years ago

ewolff commented 10 years ago

I am using an embedded HSQL database. Here is what CRaSH does:

jdbc connect jdbc:hsqldb:mem:testdb Connected to data base : jdbc:hsqldb:mem:testdb

jdbc table CUSTOMER
org.crsh.text.ui.UIBuilder@493f2ee8 jdbc tables
org.crsh.text.ui.UIBuilder@522e5bb8 jdbc execute SELECT * FROM CUSTOMER Statement executed successfully

jdbc execute SELECT * FROM Lall
jdbc execute SELECT * FROM Lall: exception: user lacks privilege or object not found: LALL

I'd expect jdbc table and jdbc tables to give a sensible output - i.e. list the CUSTOMER table that obviously exists...

dsyer commented 10 years ago

I can look into that, but AFAIK the jdbc command is native to CRaSH. Maybe we're doing something to break it. IIRC though, it's uses JNDI to look up a DataSource, so I'm surprised it works at all in a standalone app. Is that what you have?

ewolff commented 10 years ago

I am using it in a Spring Boot application with an embedded Tomcat i.e. a standalone JAR. As it uses the JDBC URL to connect to database I don't think it uses a JNDI lookup for a DataSource. However, generally speaking CRaSH seems to rely on a Java EE environment - see my other bug report. So I guess a specific CRaSH version for Spring Boot will be needed... :(

cdupuis commented 10 years ago

I can take a look at that together with #588. I can work with the guys behind CRaSH to get solved I hope.

dsyer commented 10 years ago

Great, thanks. We could remove the jdbc and jpa support in the short term I guess. Or maybe add them only if there is a JNDI registry available (there must be on be in Tomcat?).

cdupuis commented 10 years ago

After some investigation it looks like our only chance is to disable the commands in our env.

ewolff commented 10 years ago

@cdupuis Can you elaborate? Looking at the code of the CRaSH command I don't see why it shouldn't work in Spring Boot - it is just plain JDBC Groovy code.