Synchronizing DB state between Intellij and 0xDBE 关注
Possible bug. If anyone knows this is exected behavior then please let me know.
Reproduce bug thusly:
oxDBE version : 138.2222.2
intellij version: IU 135.1289
OS: Win 7 x64
DB: h2 version 1.3.175
Step 1. Create new empty DB in either ij or 0xDBE. Call that product you created the DB in product "A".
Step 2. Before disconnecting, create table, default (empty table named table_name) will do
Step 3. Close connection to DB in A.
Step 4. Open connection to same DB in "other" product, call it "B"
Step 5. Create 2nd table, call it "table_name2"
Step 6. Close connection to DB in B.
Step 7. Open connection to DB in A again.
Step 8 Observe that table_name2 is not present. Refreshing doesn't help.
Before you close, you can see that it works the other way also. Create another table, table_name3. Close the connection. Open the DB in the other product. See that table_name3 is not present there either.
Now the two products each have a table neither sees.
At the moment I just can say that the interaction between products can't matter. Our IDEs do not store any information in any "cache" or so, they just execute statements via JDBC. So an IDE (this or that) does not see changes made by external JDBC session.
I suppose it's some specific of H2 or its JDBC driver. Will try to reproduce.
Thanks. I have a conceptual model of DBs - any DB- that there is one shared instance of a DB which all applications see. They get their information about what is in the DB, in this example tables, from the DB itself. So caches aren' t involved sofar as that is concerned. This is just the casual model I carry around in my head.
The behavior can be explained if caches ARE involved- one for app A and anther for app B. Yet, they both see the first table, wherever it is created. So that doesn't dovetail with my little cache theory. So it's a mystery.
No time to play with it but will try to think up some more tests before I file a bug report if it even is indeed a problem with any JB products which is not even clear I guess.
At the moment I can't reproduce the problem. If you still meet it, please answer:
1. Am I correct that this is embedded H2?
2. Do your data sources (defined in the IDE) have "Auto sync" = Yes setting?
3. Do they also have "Auto commit" = Yes settings in the same dialog?
OK I think I know what was causing it, sort of.
Not to drag you into my problems but the following is the ONLY thing I have changed at all wrt my machine and the problem , which was very persistent and reproducible even between reboots etc. yesterday.
Maybe in the future the information below might prove useful for anyone reporting a similar issue.
Very very birefly, I tried to run h2 directly in the command line and got a noClassDefFoundError for java.lang.Object, indicating java.exe was unable to locate rt.jar.
This happens because Oracle installs a java.exe in the windows directory (windows/32) with no rt.jar when you install the JDK. That java.exe is found first and executed by Windows, even before anything in the global classpath variable, cause that' the way W\indows works, they say. . I have no idea what MS or Oracle are thinking thinking by doing all this.
I wassurprised I couldn't run h2 then I also discovered that java gave me the same error. The solution is to just blow away java.exe from the directory windows/32. Fixed instantly.
Just after I did that I read your email and tried again to repro the problem in oxDBE. It was fixed.
That's 100% of what I know and did. I am sure the two events are somehow related, but don't ask me how. How did h2 work in oxDBE at all if it was going to the wrong java.exe behind the scenes? How did that give rise to the issue? Maybe it somehow makes sense to you. For me, classpath issues are easily the worst thing about java.