libneo4j-client cannot close and reopen new session ?

66 views Asked by At

1/ what does a session means for neo4j compared to the connection and particularly for the libneo4j-client C/C++ driver ?

2/ I have modified the c code example in https://cleishm.github.io/libneo4j-client/ to close the session and restart a new one within the same connection but I got "Failed to Start Session:unexpected error"

Can someone help me to understand why ?

1

There are 1 answers

1
Chris Leishman On

1/ A connection represents the underlying TCP connection to the neo4j server, whereas a session represents a session with the neo4j server, in which state is maintained (such as authentication, open transactions, etc). The initial drafts of the Bolt Protocol left open the possibility to support multiple sessions over a single TCP connection, but that is not currently supported in any implementation. Unless the protocol specification is updated to support this explicitly, the next major version of libneo4j-client will likely remove the distinction between connection and session.

2/ Best to close the session and the connection concurrently. What you might prefer is to use neo4j_reset_session to reset all state in the session, which would be the equivalent of opening a new one.