pgspider / jdbc_fdw

JDBC Foreign Data Wrapper for PostgreSQL
Other
67 stars 23 forks source link

Driver can't find java class #42

Closed mdawkins closed 3 weeks ago

mdawkins commented 2 months ago

SOLVED: This was due to the driver not being executable by PostgreSQL I placed the jar file in postgresql/16/lib and made sure is was executable.

Exception in thread "Thread-23" java.lang.ClassNotFoundException: cdata.jdbc.sharepoint.SharePointDriver at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:476) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:594) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:527) at JDBCConnection.createConnection(JDBCConnection.java:133) at JDBCConnection.getConnection(JDBCConnection.java:106) at JDBCUtils.createConnection(JDBCUtils.java:48) 2024-09-03 14:00:40.089 EDT [19911] ERROR: XX000: remote server returned an error 2024-09-03 14:00:40.089 EDT [19911] LOCATION: jq_get_exception, jq.c:1484 2024-09-03 14:00:40.089 EDT [19911] STATEMENT: SELECT "ID" FROM imports.dgi LIMIT 5;

Does anyone have any experience with CData's Sharepoint Driver? I have a ticket open with them too.

The setup: CREATE EXTENSION jdbc_fdw; CREATE SERVER sharepoint_dgi_fdw FOREIGN DATA WRAPPER jdbc_fdw OPTIONS ( drivername 'cdata.jdbc.sharepoint.SharePointDriver', url 'jdbc:sharepoint:AuthScheme=Okta;URL=https://sharepoint.com/sites/DGI;SharePointEdition="SharePoint Online";User=user.name@domain.com;Password=***Schema=REST";', querytimeout '15', jarfile '/home/mdawkins/SharePointJDBCDriver/lib/cdata.jdbc.sharepoint.jar');

CREATE USER MAPPING for apps SERVER sharepoint_dgi_fdw OPTIONS (username 'dbuser', password 'dbpasswd');

CREATE FOREIGN TABLE imports.dgi ( "ID" INT, "Version" VARCHAR ) SERVER sharepoint_dgi_fdw OPTIONS (table_name 'DGI Table');

I can see the jar file: ls /home/mdawkins/SharePointJDBCDriver/lib/cdata.jdbc.sharepoint.jar /home/mdawkins/SharePointJDBCDriver/lib/cdata.jdbc.sharepoint.jar

jar tvf cdata.jdbc.sharepoint.jar shows cdata/jdbc/sharepoint/SharePointDriver.class

JulmeTran commented 3 weeks ago

Thank you for sharing the solution and explanation. If the issue were resolved. Could you close it?