I fixed my problem with this:

ODatabaseDocumentTx d = new ODatabaseDocumentTx(url);
if (d.exists()) {
  c = d.open(user,password);
}
The error went away.  Don't try to open a database if it does not exist.  

Thanks,
Glenn


On Saturday, 7 June 2014 10:55:18 UTC-6, Glenn Irwin wrote:
>
> I had to take some time to isolate the problem. It seems that any attempt 
> to open a plocal database will prevent you from creating the database even 
> though it does not exist.  Here is the code:
>
>  public static void main(String[] args) {
>  try { 
>    ODatabaseDocumentTx *db **= new ODatabaseDocumentTx("plocal:db"**)*; 
>    ODatabase odb = null; 
>    try { 
>      odb = *db**.open("admin", "admin");* 
>    } catch (Exception e) { 
>      System.out.println("Exception="+e.getMessage()); 
>      if (odb != null) { 
>        System.out.println("odb is not null"); 
>        odb.close(); 
>      } 
>    } 
>    if (db.exists()) { 
>      System.out.println("Database exists already"); 
>    } else { 
>      db = new *ODatabaseDocumentTx("plocal:db").create();* 
>      if (db.exists()) { 
>        System.out.println("Yaaaaaay! Database is created!"); 
>      } else { 
>        System.out.println("Fail"); 
>      } 
>    } 
>  } catch(Exception e) { 
>    e.printStackTrace(); 
>  } 
> }
> gives this result:
>
> Exception=Cannot open database
> com.orientechnologies.orient.core.exception.ODatabaseException: Cannot 
> create database
> .......
>
> Caused by: com.orientechnologies.orient.core.exception.OStorageException: 
> Cannot create new storage 'db' because it is not closed
> ........
>
> Jun 07, 2014 10:43:06 AM com.orientechnologies.common.log.OLogManager log
> INFO: - storage: db...
> Jun 07, 2014 10:43:06 AM com.orientechnologies.common.log.OLogManager log
> WARNING: Error on closing storage
> Jun 07, 2014 10:43:06 AM com.orientechnologies.common.log.OLogManager log
> INFO: OrientDB Engine shutdown complete
>
> Also: What do I need to do to the LogManager to make those messages go 
> away?
>
> Thanks,
> Glenn
>
>
> On Friday, 6 June 2014 22:49:12 UTC-6, Andrey Lomakin wrote:
>>
>> HI,
>> Exception is that storage is not closed.
>>
>> Do you create storage which was deleted before ?
>> We have tons of such test cases, may you provide test, which I will run 
>> and see that code does not work correctly ?
>>
>>
>>
>>
>> On Sat, Jun 7, 2014 at 4:01 AM, Glenn Irwin <[email protected]> wrote:
>>
>>> When running this code:
>>>
>>>  ODatabaseDocumentTx db = new ODatabaseDocumentTx("plocal:data"
>>> ).create();
>>> (I have tried with various names - directory doesn't exist)
>>>
>>> This worked in 1.7 OrientDB
>>> I get this stack trace:
>>>
>>> com.orientechnologies.orient.core.exception.ODatabaseException: Cannot 
>>> create database
>>>
>>> at 
>>> com.orientechnologies.orient.core.db.record.ODatabaseRecordAbstract.create(
>>> ODatabaseRecordAbstract.java:396)
>>>
>>> at com.orientechnologies.orient.core.db.ODatabaseWrapperAbstract.create(
>>> ODatabaseWrapperAbstract.java:55)
>>>
>>> at 
>>> com.orientechnologies.orient.core.db.ODatabaseRecordWrapperAbstract.create(
>>> ODatabaseRecordWrapperAbstract.java:64)
>>>
>>> at permeagility.util.Database.createLocal(Database.java:169)
>>>
>>> at permeagility.web.Server.initializeServer(Server.java:902)
>>>
>>> at permeagility.web.Server.main(Server.java:174)
>>>
>>> Caused by: 
>>> com.orientechnologies.orient.core.exception.ODatabaseException: Cannot 
>>> create database
>>>
>>> at com.orientechnologies.orient.core.db.raw.ODatabaseRaw.create(
>>> ODatabaseRaw.java:135)
>>>
>>> at com.orientechnologies.orient.core.db.ODatabaseWrapperAbstract.create(
>>> ODatabaseWrapperAbstract.java:55)
>>>
>>> at 
>>> com.orientechnologies.orient.core.db.record.ODatabaseRecordAbstract.create(
>>> ODatabaseRecordAbstract.java:350)
>>>
>>> ... 5 more
>>>
>>> Caused by: com.orientechnologies.orient.core.exception.OStorageException: 
>>> Cannot create new storage 'data' because it is not closed
>>>
>>> at 
>>> com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage.create(
>>> OLocalPaginatedStorage.java:297)
>>>
>>> at com.orientechnologies.orient.core.db.raw.ODatabaseRaw.create(
>>> ODatabaseRaw.java:131)
>>>
>>> ... 7 more
>>>
>>> Jun 06, 2014 6:53:33 PM com.orientechnologies.common.log.OLogManager log
>>>
>>> INFO: - storage: data...
>>>
>>> Jun 06, 2014 6:53:33 PM com.orientechnologies.common.log.OLogManager log
>>>
>>> WARNING: Error on closing storage
>>>
>>> Jun 06, 2014 6:53:33 PM com.orientechnologies.common.log.OLogManager log
>>>
>>> INFO: OrientDB Engine shutdown complete
>>>
>>>
>>> Am I missing a setup step first?   
>>>
>>> in 1.7 it would create a database just fine.
>>>
>>> -- 
>>>
>>> --- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "OrientDB" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> -- 
>> Best regards,
>> Andrey Lomakin.
>>
>> Orient Technologies
>> the Company behind OrientDB
>>
>>  

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to