Open faysalmehmood opened 3 years ago
Very good point. When I decided to use that colon, I thought about DOS and hard drives, but thought Windows would have overcome that limitation already. We'll figure out how to solve this, probably using just another dot.
That will definitely help. Thanks!
I read that percent encoding can be used in Windows to represent a colon.
On Windows systems, files and directory names cannot be created with a colon (:). But if a file or directory name is created with a colon on a Linux or Mac operating system, then moved to a Windows system, percent encoding is used to include the colon in the name in the index.
Can you give that workaround a try @faysalmehmood ?
Use of percent encoding will rename file names as slave1%3Adb.properties
, slave2%3Adb.properties
, master%3Adb.properties
if located on a windows OS. But in case we have existing db file names having colon in their names e.g slave1:db.properties
and placed on some cloud or github, these cannot be checkedout on windows based systems. This should work seemlessly on both operating systems. As you mentioned earlier, the dot (.) approach would be fine and I am not thinking of any backward compatibility for existing systems at the moment.
While trying the workaround, here is my observation:
The method org.jpos.ee.DB#getMetadata
actually prepares the db file name as cfg/slave1%3Adb.properties:db.properties
, whereas the actual file path is cfg/slave1%3Adb.properties
. Due to this reason, this workaround does not work.
I think the code is exactly for colon in method mentioned above. And in my opinion it might require code-level change to add this support.
else if (configModifier != null) {
String[] ss = configModifier.split(":");
if (ss.length > 0)
dbPropertiesPrefix = ss[0] + ":";
if (ss.length > 1)
metadataPrefix = ss[1] + ":";
hibCfg = System.getProperty("HIBERNATE_CFG","/" + dbPropertiesPrefix + "hibernate.cfg.xml");
if (getClass().getClassLoader().getResource(hibCfg) == null)
hibCfg = null;
}
When you add multiple databases (slave), there is a convention of using colon ":" in database configuration file names. But while working on windows operating system, it seems impossible to create a file name having colon in its name. For example: In
cfg
directory,db.properties
is fine. But following file names are problematic as these cannot be created.slave1:db.properties
slave2:db.properties
If there is a workaround, please assist. And if it's really an issue, would appreciate to provide its support.