JDBC driver

Post Reply
daiana
Posts: 3
Joined: 07 Aug 2018, 09:25

Good morning,
I can't resolve this error: "JDBC driver is not found on classpath".

Can anyone explain me, step to step, how to install and correctly configure the driver? Which driver do you use?

Thank you

Best regards,

Daiana
User avatar
jonathan.carter
Posts: 1087
Joined: 04 Feb 2009, 15:44

Hi Daiana,

Out of the box, Protege will support a range of JDBC databases but it is sensitive to versions. MySQL 5.5 is supported but with an update to some Java parameters for Protege, it can support MySQL 5.6 / 5.7.

PostgreSQL and MS SQLServer also work with Protege.

To get later versions of MySQL working with Protege, add these 2 parameters to the Protege Java runtime:

Code: Select all

-DDatabase.type.varchar.maxsize.com.mysql.jdbc.Driver=255
-DDatabase.typename.short.value.type.com.mysql.jdbc.Driver=VARCHAR\(255\)
Protege looks for JDBC drivers in its root directory that are named ‘driver.jar’, ‘driver1.jar’ etc. The simplest way to get Protege to find your driver is to copy it into the Protege root install directory, e.g. to ‘driver.jar’. Then the startup routines should pick this up automatically.

Let me know if you are having trouble with a specific driver.

Jonathan
Essential Project Team
daiana
Posts: 3
Joined: 07 Aug 2018, 09:25

Hi Jonathan!

Thank you for your answer.

1) I've downloaded MySQL Server 5.6
2) I've put the JDBC 4 driver in the Protegè folder
3) I've added to the variable CLASSPATH the JDBC driver
4) I've added these two parameters to run_protege.bat:
-DDatabase.type.varchar.maxsize.com.mysql.jdbc.Driver=255
-DDatabase.typename.short.value.type.com.mysql.jdbc.Driver=VARCHAR\(255\)

Unfortunately, it doesn't work. I should add "SET" before the parameters? Or have I forgotten anything else?

Thank you

Daiana
User avatar
jonathan.carter
Posts: 1087
Joined: 04 Feb 2009, 15:44

Hi Daiana,

Thanks for the update.

Can I confirm with you that you have copied the JDBC 4 driver into a file called ‘driver.jar’ in your Protege root folder? It might be simpler to do this than try to convince Protege to look in another location.

The two parameters for the database are easiest set in the Protege Property editor. If you take that approach you should set them as follows:
  • Create a property called Database.type.varchar.maxsize.com.mysql.jdbc.Driver and set it to 255
  • Create a property called Database.typename.short.value.type.com.mysql.jdbc.Driver = VARCHAR(255)
Then Protege will pick these up when it starts. Note that the \(255\) is not required when setting this parameter via the Protege app.

Alternatively, you can set this in run_protege.bat by adding them to the $OPTIONS variable, e.g.

Code: Select all

set OPTIONS="%OPTIONS% -DDatabase.type.varchar.maxsize.com.mysql.jdbc.Driver=255 -DDatabase.typename.short.value.type.com.mysql.jdbc.Driver=VARCHAR\(255\)"
As you say, for Windows, you will need to use the ‘set’ command and use %VAR% instead of $VAR.

In the same way as the VARCHAR\(255\) becomes VARCHAR(255) when setting the parameter from within the Protege application, it could be that for the Windows start script, run_protege.bat, the second parameter should be changed to VARCHAR(255)

When you run the batch file, run_protege.bat, what output do you see on the terminal window? What errors are saved in the logs?

Jonathan
Essential Project Team
Post Reply