multiple connection using share folder

#1

hello sir  i have a desktop application which is using objectdb database and when i am share my application in share folder and access the application from other system in that time my objectdb database shows database is used in other process .

so i want to know how i can access my single objectdb database from multiple system 

#2

In embedded mode the database file is locked for a single process.

Use client-server mode or embedded-server mode to enable concurrent database access from multiple processes.

 

ObjectDB Support
#3

ok i got it but can you plz send me one example or share some post where we use it in desktop application

#4

sir u did not tell me about the solution what should i do for making client server mode in desktop application

#5

You can use embedded server mode as suggested above (see link on post #2).

You can also run the server by calling com.objectdb.Server.main(...) from your application, as the server itself is a Java application.

ObjectDB Support
#6

sir i have tried bu again i am getting database use in other processs

    com.objectdb.Server.main(args);

i have put this line in main class and again i made a new exe and make it shareable but when second system access the 

exe again  i got the same error 

Usage: java com.objectdb.Server [options] start | stop | restart
options include:
  -conf <path>  :  specify a configuration file explicitly
  -port <port>  :  override configuration's server port
  -silent       :  avoid printing messages to the standard output
  -console       :  avoid showing the server tray icon

gaapmrp.CustomerOrderController.EditcreatecustomerorderController.companyinvoice
()
[ObjectDB 2.7.4] javax.persistence.PersistenceException
Attempt to open a database file 'C:\Gaap MRP\gaapmrp1.odb' that is currently in
use by another process (error 141)
        at com.objectdb.jpa.EMF.createEntityManager(EMF.java:152)
        at gaapmrp.applicationclasses.DBHelper1.getDatabaseName(DBHelper1.java:7
14)
        at gaapmrp.GAAPMRP.start(GAAPMRP.java:56)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$161
(LauncherImpl.java:863)
        at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$174(Platfor
mImpl.java:326)
        at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.
java:295)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformI
mpl.java:294)
        at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatch
er.java:95)
        at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.ja
va:177)
        at java.lang.Thread.run(Unknown Source)
Caused by: com.objectdb.o.UserException: Attempt to open a database file 'C:\Gaa
p MRP\gaapmrp1.odb' that is currently in use by another process
        at com.objectdb.o.MSG.a(MSG.java:64)
        at com.objectdb.o.LFL.J(LFL.java:930)
        at com.objectdb.o.LFL.x(LFL.java:887)
        at com.objectdb.o.LFL.x(LFL.java:797)
        at com.objectdb.o.DFL.<init>(DFL.java:241)
        at com.objectdb.o.DMG.<init>(DMG.java:27)
        at com.objectdb.o.MST.<init>(MST.java:127)
        at com.objectdb.o.MST.ao(MST.java:109)
        at com.objectdb.o.MSF.Yy(MSF.java:190)
        at com.objectdb.o.OMF.r(OMF.java:783)
        at com.objectdb.jpa.EMF.r(EMF.java:130)
        at com.objectdb.o.OMF.w(OMF.java:694)
        at com.objectdb.jpa.EMF.createEntityManager(EMF.java:149)
        ... 11 more

i am totally confused where i am wrong please give me proper way 

 

 

#7

again i try to make changes in config file 

<server >
    <connection port="6136"  max="3" />
    <data path="$objectdb/db" />
   <embedded-server enabled="true" />
</server>

so after done this work

again when i open exe in multiple system it shows failed to connect to server

 

 

 

#8

To understand the situation better, are you using embedded server and it works on one computer but not from another computer?

To access the database from another computer you need to specify the correct host (ip address or domain name) and port. It is possible in embedded-server mode but it would be easier with client-server mode.

Run the ObjectDB Server on one computer. See this manual page.

Find the ip address or host name of that computer.

Access the database using a full url connection including host and port (see this manual page). Do not use localhost from other computers but an ip address or host name of the computer on which the ObjectDB server is running.

ObjectDB Support

Reply