back to forum.

Topic: JDBC Relative Path

Topic by
yves.courtois

2008-10-13
19:22

JDBC Relative Path

Hello

I am a new user of Datacleaner. i have just setup a connection with MSSQL Server and i would know if is possible to register à JDBC driver whith a relative path in a Windows environnement.

Thanks[[BR]]

Best regards Yves

Reply by
kasper

2008-10-13
20:47
Hi Yves,

Welcome to the DataCleaner forums :)

Yes this is possible, however it goes beyond the usual use-case (I'm not sure why you would specifically want a relative path?) which is why it has not been documented yet. But here's what you need to do:

1. You need the platform-independent version of DataCleaner (ie. one with a .cmd executable, not the .exe version)
2. You should edit the .cmd file and add the relative .jar file to the classpath - similar to this:
call java -Xmx1024m -XX:MaxPermSize=256m -jar datacleaner.jar;path\to\my.jar
  • If you prefer not to see the command line console when you run the application, you can use the "javaw" command instead of "java" in that same line.

3. You should add the driver class in the datacleaner-config.xml file (look for line 28-35), like this:
	<bean class="dk.eobjects.datacleaner.gui.model.DatabaseDriver">
<property name="name" value="My database driver" />
<property name="driverClass" value="my.database.Driver" />
</bean>

I hope this makes sense?

Reply by
kasper

2008-10-14
07:27
Sorry, the example above is a bit wrong. Here's how it should look:

call java -Xmx1024m -XX:MaxPermSize=256m -cp path\to\my.jar -jar datacleaner.jar

Reply by
yves.courtois

2008-10-15
14:36
Hello

I have test your solution like [[BR]]

SET DATACLEANER_CLASSPATH=%DATACLEANER_HOME%Drivers\sqljdbc.jar

call java -Xmx1024m -XX:MaxPermSize=256m -classpath C:\DataCleaner\Drivers\sqljdbc.jar -jar datacleaner.jar or call java -Xmx1024m -XX:MaxPermSize=256m -cp C:\DataCleaner\Drivers\sqljdbc.jar -jar datacleaner.jar

in the 2 case this solution doesnt  work for me .

look a this picture [[BR]]

http://fr.tinypic.com/usermedia.php?uo=xSbyXl%2BGE34qWfzHCNq93w%3D%3D

http://i37.tinypic.com/hrar5u.jpg

 the relative path is not so important , but when we use java software i think it's very important to keep the fact that we could move the application and keep the original settings.

Thanks

Reply by
kasper

2008-10-15
16:20
OK, i just tried it myself and saw that it's actually not working ;-) Apparently java cannot combine both the "cp" (classpath) parameter and the "jar" (executable jar) parameter, so here's how you should do it:

1. Add both jar files to the "cp"
2. Add "dk.eobjects.datacleaner.gui.DataCleanerGui" (the class inside datacleaner.jar to execute) as a suffix to the whole thing.

Like this...

call java -Xmx1024m -XX:MaxPermSize=256m -cp datacleaner.jar;mydriver.jar dk.eobjects.datacleaner.gui.DataCleanerGui

Oh and you should probably also remove the driver that I can see on your screenshot that you have registered inside the application (the absolute path one). Let me know how it works out...

You need to be logged in to participate

In order to post your own comments on this topic, you need to be logged in.

Username:

Log in by clicking the login link at the top of the screen

 

Go back to forum.