Yesterday I ran into a big problem. In my current project, I am using ojdbc6 an implementation of Oracle JDBC to connect, but I also need to process, for example, the oracle of 8 databases, which is completely impossible with this JAR. You would say that I should use ojdbc14, for example, which was right for some tests, but suggests that later I will need to process 2 types of databases from the same provider, but we know that for BOTH , and I these must be loaded at the same time . The same interface (and well, not only the same interface, the same class structure, just a different implementation inside!), The same URL connection prefix β JDBC connection will use the same driver, but I cannot load several of them. So what now?
My first idea was to load the JAR with different class loaders, maybe I could load the same package structure with the same classes that were separated from each other? Actually, I donβt think so, maybe it was a stupid idea. This can also be a common problem later not only with JDBC drivers, so even if you cannot answer my question, but know what is missing here, tell me
Even if I could separately load class implementations from the same class names, how can I tell DriverManager to create a connection to use the EXACT driver instead of finding it based on the connection url prefix? (where I mean jdbc: oracle: thin, for example).
Now I feel completely dumb, because I think this is not an unusual idea to work in the Java world, BUT I donβt completely know how to handle it.
Thanks for y'all in advance
source
share