我正在通过docker-compose文件使用OrientDB。我已经使用ETL加载器工具导入了数据,并在Meetup数据库中创建了Event类。我可以通过OrientDB控制台查看此类的数据。我试图使用Scala API读取数据。但是,我收到一个错误,找不到我的Event类:
OQueryParsingException: Error on parsing query at position #6: Error on parsing query
Query: Event LIMIT 10
OCommandExecutionException: Class 'EVENT' was not found in database 'Meetup'
这是我用来连接数据库的代码:
val uri = "plocal:databases/Meetup"
val factory = new OrientGraphFactory(uri, "user", "password")
val graph = factory.getTx
graph.command(new OCommandSQL("select * from Event limit 10"))
.execute()
当我在控制台中运行相同的查询时,我将获得事件表的必需行:
docker exec -it orientdb_container /orientdb/bin/console.sh
orientdb> connect plocal:databases/Meetup user password
Connecting to database [plocal:databases/Meetup] with user 'admin'...OK
orientdb {db=Meetup}>SELECT * FROM Event LIMIT 10
如何解决此错误?这是代码还是配置错误?
Docker-compose文件如下:
orientdb:
image: orientdb:latest
ports:
- "2424:2424"
- "2480:2480"
environment:
ORIENTDB_ROOT_PASSWORD: 'password'
volumes:
- /orientdb/config:/orientdb/config
- /orientdb/databases:/orientdb/databases
- /orientdb/backup:/orientdb/backup
- ./import_json:/orientdb/bin/import_json
- ./dataset_csv:/orientdb/bin/dataset_csv