exist icon indicating copy to clipboard operation
exist copied to clipboard

Feature/sql to use jdbc xars

Open lcahlander opened this issue 3 years ago • 7 comments

Description:

Loads the JDBC driver using the Class.forName() call. It allows for the JDBC driver files that I have created as packages to be utilized from the SQL connect.

Reference:

Type of tests:

lcahlander avatar May 20 '22 15:05 lcahlander

I do not think that the test failures are related to my code change. The failures are on the windows-latest tests and that appears to be the same with other pull requests.

lcahlander avatar May 20 '22 18:05 lcahlander

@adamretter In order for the libraries in the XARs to be accessible, the Class.forName() is necessary. I am thinking of adding a driver available function in the SQL to determine if the library is available.

lcahlander avatar May 21 '22 19:05 lcahlander

@lcahlander I think it depends... If your drivers are JDBC 4 compliant then I don't think you actually need the Class.forName even in a Xar. I might be wrong though...

If they are older drivers you will need that. Do you have an example of an older driver you are using?

adamretter avatar May 21 '22 20:05 adamretter

Does it hurt anything to do the call?

lcahlander avatar May 21 '22 20:05 lcahlander

Does it hurt anything to do the call?

I don't know, but my preference would be not to add it if we don't need it. Can you tell me which driver you are using that shows the problem?

adamretter avatar May 23 '22 09:05 adamretter

I have installed my XAR for MySQL in the current eXist-db 6.0.1

image

I then try calling my MySQL database through the standard sql:get-connection()

image

When I connect to the MySQL database in my model harvester, I use the Class.forName() call to have the JDBC driver available to my code. I can change things so that there is a call to see if the driver is loaded into eXist-db.

lcahlander avatar May 31 '22 18:05 lcahlander