Hi,
Which one ?

On Thu, Mar 6, 2014 at 12:54 PM, Bruno René Santos <[email protected]>wrote:

> How can i setup a remote connection? I tried remote:localhost/moviedb but
> I got an error
>
> Quinta-feira, 6 de Março de 2014 10:46:38 UTC, Andrey Lomakin escreveu:
>>
>> Hi,
>> You can not work with embedded database in server mode, if you use
>> stuidio you should use remote connection to running server instance.
>>
>>
>>  On Thu, Mar 6, 2014 at 1:44 AM, Bruno René Santos <[email protected]>wrote:
>>
>>>  Hi,
>>>
>>> I used the code below to populate a DB. The problem is that everything
>>> seems to work OK but when I go to orient Studio the database is empty, even
>>> after inserting all data... What am I missing?
>>>
>>> Regards
>>>
>>> public class Main {
>>>
>>> public static void main(String[] args) {
>>> try {
>>>  ODatabaseDocumentTx db = new ODatabaseDocumentTx("plocal:/
>>> dados/apps/orientdb-community-1.7-rc1/databases/moviedb");
>>> ODatabaseHelper.dropDatabase(db, "plocal");
>>>  OrientGraphNoTx graph = new OrientGraphNoTx("plocal:/
>>> dados/apps/orientdb-community-1.7-rc1/databases/moviedb");
>>> try {
>>>  OClass movieVertex = graph.createVertexType("Movie");
>>> OClass viewerVertex = graph.createVertexType("Viewer");
>>>  OClass watchEdge = graph.createEdgeType("Watches");
>>> movieVertex.createProperty("title", OType.STRING);
>>>  movieVertex.createIndex("titleIdx", OClass.INDEX_TYPE.UNIQUE, "title");
>>> viewerVertex.createProperty("identifier", OType.INTEGER);
>>>  viewerVertex.createIndex("identifierIdx", OClass.INDEX_TYPE.UNIQUE,
>>> "identifier");
>>> watchEdge.createProperty("year", OType.SHORT);
>>>  watchEdge.createProperty("viewed", OType.DATE);
>>> watchEdge.createProperty("rating", OType.SHORT);
>>>  watchEdge.createIndex("yearIdx", OClass.INDEX_TYPE.NOTUNIQUE, "year");
>>> watchEdge.createIndex("viewedIdx", OClass.INDEX_TYPE.NOTUNIQUE,
>>> "viewed");
>>>  watchEdge.createIndex("ratingIdx", OClass.INDEX_TYPE.NOTUNIQUE,
>>> "rating");
>>> ObjectMapper mapper = new ObjectMapper();
>>>  JsonFactory factory = mapper.getFactory();
>>> Map<JsonNode, Vertex> movies = new HashMap<>();
>>>  Map<JsonNode, Vertex> viewers = new HashMap<>();
>>>  SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
>>> try (BufferedReader reader = new BufferedReader(new
>>> FileReader("ratings.json"))) {
>>>  String line;
>>> while ((line = reader.readLine()) != null) {
>>> JsonNode ratingData = mapper.readTree(factory.createJsonParser(line));
>>>  if (movies.get(ratingData.get("title")) == null)
>>> movies.put(ratingData.get("title"), graph.addVertex("class:Movie", new
>>> SingletonMap("title", ratingData.get("title").asText())));
>>>  if (viewers.get(ratingData.get("user")) == null)
>>> viewers.put(ratingData.get("user"), graph.addVertex("class:Viewer", new
>>> SingletonMap("identifier", ratingData.get("user").asInt())));
>>>  Edge watches = graph.addEdge("class:Watches",
>>> movies.get(ratingData.get("title")), viewers.get(ratingData.get("user")),
>>> "watches");
>>>  watches.setProperty("year", ratingData.get("year"));
>>> watches.setProperty("viewed", dateFormat.parse(ratingData.
>>> get("viewed").asText()));
>>>  watches.setProperty("rating", ratingData.get("rating").asInt());
>>> }
>>> } catch (IOException | ParseException ex) {
>>>  Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
>>> }
>>> } finally {
>>>  graph.shutdown();
>>> }
>>> } catch (IOException ex) {
>>> Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
>>>  }
>>> }
>>> }
>>>
>>> --
>>>
>>> ---
>>> 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/groups/opt_out.
>>>
>>
>>
>>
>> --
>> 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/groups/opt_out.
>



-- 
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/groups/opt_out.

Reply via email to