我在打开一个OrientDB数据库(orientdb Community-1.6.3)时遇到了问题。
我可以使用$db = new OrientDB(...)访问服务器。
我可以使用$dbConnected = $db->connect(...)与我的用户管理员连接。
但是打开我的数据库,或者检查它是否存在给了我一个错误:com.orientechnologies.orient.core.exception.OStorageException: Cannot open the storage 'mydb' because it does not exist in path: /Users/kent/dev/Database/releases/orientdb-community-1.6.3/databases//../databases/mydb
更多详细信息:
在OrientDB控制台中,工作正常:
orientdb> connect plocal:../databases/mydb admin admin
Connecting to database [plocal:../databases/mydb] with user 'admin'...OK
orientDB>PHP代码片段:
$dbInfo = array (
'datasource' => 'Database/OrientDB',
'persistent' => true,
'host' => 'localhost',
'port' => 2424,
'timeout' => 60,
'serverUsername' => 'admin',
'serverPassword' => 'admin',
'database' => 'plocal:../databases/mydb',
'databaseUsername' => 'admin',
'databasePassword' => 'admin'
);
// New OrientDB instance
try {
$db = new OrientDB ( $dbInfo ['host'], $dbInfo ['port'], $dbInfo ['timeout'] );
error_log ( "dbUtil.php:dbOpen: new Orient:db:" . print_r ( $db, true ) );
} catch ( Exception $e ) {
// Report error connecting to server
$exception = 404;
$message .= 'Database server ' . $dbInfo ['host'] . ':' . $dbInfo ['port'] . ' did not respond. ' . $e->getMessage ();
}
if ($db) {
// Made the connection to the server, connect as user $dbInfo ['serverUsername']
try {
$dbConnected = $db->connect ( $dbInfo ['serverUsername'], $dbInfo ['serverPassword'] );
error_log ( "dbUtil.php:dbOpen:dbConnected:" . $dbConnected );
} catch ( OrientDBException $e ) {
// Report error on $db->connect
$exception = 400;
$message .= 'Unable to connect to ' . $dbInfo ['datasource'] . ' as user ' . $dbInfo ['serverUsername'] . '. ' . $e->getMessage ();
}
// Open the database
if ($dbConnected) {
try {
$dbExists = $db->DBExists ( $dbInfo ['database'] );
error_log ( "dbUtil.php:dbOpen(" . $dbInfo ['database'] . "):dbExists:" . $dbExists );
if (! $dbExists) {
// Report database does not exist
$exception = 404;
$message .= "Database " . $dbInfo ['database'] . ' does not exist.';
}
} catch ( OrientDBException $e ) {
// Report err on $db->DBExists
$exception = 404;
$message .= "Error checking the existence of database " . $dbInfo ['database'] . ". " . $e->getMessage ();
}
if ($dbExists) {
try {
$dbClusters = $db->DBOpen ( $dbInfo ['database'], $dbInfo ['databaseUsername'], $dbInfo ['databasePassword'] );
error_log ( "dbUtil.php:dbOpen:DBOpen:dbClusters:" . print_r ( $dbClusters, true ) );
} catch ( OrientDBException $e ) {
// Report error opening database
$exception = 400;
$message .= "Error opening database " . $dbInfo ['datasource'] . ' as user ' . $dbInfo ['databaseUsername'] . '. ' . $e->getMessage ();
}
}
}
}
// Any problems?
if ($exception != 200) {
throw new RestException ( $exception, $message );
}错误日志:
[13-Jan-2014 04:33:22 UTC] dbUtil.php:dbOpen: new Orient:db:OrientDB Object
(
[host:OrientDB:private] => localhost
[port:OrientDB:private] => 2424
[socket] => OrientDBSocket Object
(
[socket:OrientDBSocket:private] => Resource id #2
[bufferLen:OrientDBSocket:private] => 16384
[debug] =>
)
[debug:OrientDB:private] =>
[clientVersion] => 15
[protocolVersion] =>
[connected:protected] =>
[DBOpen:protected] =>
[active:protected] => 1
[sessionIDServer:OrientDB:private] =>
[sessionIDDB:OrientDB:private] =>
[cachedRecords] => Array
(
)
)
[13-Jan-2014 04:33:22 UTC] dbUtil.php:dbOpen:dbConnected:1
[13-Jan-2014 04:33:22 UTC] dbUtil.php:dbOpen(plocal:../databases/mydb):dbExists:错误消息中的路径ls:
$ ls -la /Users/kent/dev/Database/releases/orientdb-community-1.6.3/databases//../databases/mydb
total 5984
drwxr-xr-x 58 kent staff 1972 Jan 12 20:47 .
drwxr-xr-x 4 kent staff 136 Jan 12 16:43 ..
-rw-r--r-- 1 kent staff 66560 Jan 12 20:47 ORole.name.sbt
-rw-r--r-- 1 kent staff 66560 Jan 12 20:47 OUser.name.sbt
..有什么想法吗?
谢谢
**更新的2014-01-19 **添加了最好的日志服务器。
2014-01-19 19:06:11:597 FINE [OMMapManagerNew] flushing pages in memory... [OMMapManagerNew]
2014-01-19 19:06:11:597 FINE [OMMapManagerNew] flushed 0/0 blocks [OMMapManagerNew]
2014-01-19 19:06:13:731 CONF Remote client connected from: OClientConnection [id=34, source=?, since=1390187173731] [OClientConnectionManager]
2014-01-19 19:06:13:733 CONF Remote client connected from: OClientConnection [id=35, source=/127.0.0.1:60842, since=1390187173732] [OClientConnectionManager]
2014-01-19 19:06:13:736 FINE Disconnecting connection OClientConnection [id=35, source=/127.0.0.1:60842, since=1390187173732]... [OClientConnectionManager]
2014-01-19 19:06:13:736 FINE Disconnected connection OClientConnection [id=35, source=/127.0.0.1:60842, since=1390187173732] found 1 channels [OClientConnectionManager]
2014-01-19 19:06:14:080 FINE [OClientConnectionManager] found and removed pending closed channel 34 (Socket[addr=/127.0.0.1,port=60842,localport=2424]) [OClientConnectionManager$1]
2014-01-19 19:06:41:597 FINE [OMMapManagerNew] flushing pages in memory... [OMMapManagerNew]
2014-01-19 19:06:41:597 FINE [OMMapManagerNew] flushed 0/0 blocks [OMMapManagerNew]连接到服务器后添加了error_log ( "dbUtil.php.dbOpen:list of databases:" . print_r($db->DBList(), true));:
[20-Jan-2014 03:06:13 UTC] dbUtil.php.dbOpen:list of databases:Array
(
[docitt] => plocal:/Users/kent/dev/Database/releases/orientdb-community-1.6.3/databases/docitt
[GratefulDeadConcerts] => plocal:/Users/kent/dev/Database/releases/orientdb-community-1.6.3/databases/GratefulDeadConcerts
)然后使用plocal:/Users/kent/dev/Database/releases/orientdb-community-1.6.3/databases/docitt作为数据库名。同样的错误:Database plocal:/Users/kent/dev/Database/releases/orientdb-community-1.6.3/databases/docitt does not exist.
发布于 2014-01-21 05:09:07
我试图打开的数据库plocal:../databases/mydb是plocal和graph数据库类型(Oridb-Community-1.6.3的当前默认设置)。OrientDB-PHP还不支持图表数据库类型,只有文档 :(
https://stackoverflow.com/questions/21084190
复制相似问题