Giter Site home page Giter Site logo

jdbc_fdw's People

Contributors

atris avatar brunosimioni avatar dbh avatar deathwish avatar felipefedel avatar ftzdomino avatar kostiantyn-nemchenko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jdbc_fdw's Issues

Crash due to use of JNI pointer after GC of Java object

Oracle's JNI documentation suggests that JNI local references may be garbage collected under the following conditions:

  1. Control is yielded from native code into the JVM.
  2. The thread stack of the native thread which created the reference has changed.

At some point between OpenJDK 8 and OpenJDK 11, the JVM appears to have started garbage collecting local references created by an embedding process in this manner. This results in a 100% repeatable crash in jdbcEndForeignScan when attempting to use java_call. As this can be rectified by adding code to convert java_call to a global reference, I'm confident that such a change in reference handling is the issue.

I have a patch for the issue that I'm pretty confident in, but am going to test it in production for a week or two to make sure I didn't introduce any new bugs. Anyone encountering this issue as a breaking problem in the interim ought to be able to build a minimally patched version using the information in this ticket.

Build Fails on CentOS 7.2 with errors

Hello All,

I am trying to install JDBC_FDW extension on the following environment:
OS: CentOS 7.2
Postgres: 9.5.0

I am following instructions from this link
( https://github.com/atris/JDBC_FDW/wiki/Installation-instructions )

When I try to build it, I get the errors like:

make
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -fpic -D'PKG_LIB_DIR=/usr/local/pgsql/lib' -I. -I. -I../../src/include -D_GNU_SOURCE -c -o jdbc_fdw.o jdbc_fdw.c
jdbc_fdw.c: In function ‘jdbc_fdw_handler’:
jdbc_fdw.c:372:29: warning: assignment from incompatible pointer type [enabled by default]
fdwroutine->GetForeignPlan = jdbcGetForeignPlan;
^
jdbc_fdw.c: In function ‘jdbcGetForeignPaths’:
jdbc_fdw.c:1060:2: warning: passing argument 8 of ‘create_foreignscan_path’ from incompatible pointer type [enabled by default]
add_path(baserel, (Path_)create_foreignscan_path(root, baserel, baserel->rows, startup_cost, total_cost, NIL, NULL, NIL));
^
In file included from jdbc_fdw.c:43:0:
../../src/include/optimizer/pathnode.h:82:21: note: expected ‘struct Path *’ but argument is of type ‘struct List *’
extern ForeignPath *create_foreignscan_path(PlannerInfo *root, RelOptInfo *rel,
^
jdbc_fdw.c:1060:2: error: too few arguments to function ‘create_foreignscan_path’
add_path(baserel, (Path_)create_foreignscan_path(root, baserel, baserel->rows, startup_cost, total_cost, NIL, NULL, NIL));
^
In file included from jdbc_fdw.c:43:0:
../../src/include/optimizer/pathnode.h:82:21: note: declared here
extern ForeignPath create_foreignscan_path(PlannerInfo *root, RelOptInfo *rel,
^
jdbc_fdw.c: In function ‘jdbcGetForeignPlan’:
jdbc_fdw.c:1079:2: error: too few arguments to function ‘make_foreignscan’
return (make_foreignscan(tlist, scan_clauses, scan_relid, NIL, NIL));
^
In file included from jdbc_fdw.c:45:0:
../../src/include/optimizer/planmain.h:46:21: note: declared here
extern ForeignScan *make_foreignscan(List *qptlist, List *qpqual,
^
jdbc_fdw.c:1080:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
make: *
* [jdbc_fdw.o] Error 1

Please help me to resolve this issue.
Thank You!

Add support for PostgreSQL 9.5's IMPORT FOREIGN SCHEMA

FDW in PostgreSQL 9.5 supports automatically importing the schema from the foreign data source. It would be awesome to add logic to JDBC_FDW in order to have this happen with well-known database engines like Oracle/MSSQL/MySQL/etc...

Push-down, write tables and PostgreSQL 9.3

Atri,

PostgreSQL 9.3 FDW API provides great new features, like push-down matches, writeable table and performance issues (in an overall pov).

Is there any activity plan to migrate JDBC_FDW to PostgreSQL 9.3? Here we are facing some performance issues (1s+/query), besides all database resources lost, being stucked at 9.2 version.

Can we help you in some way?

Thanks!

Error JDBCUtilsClass is NULL

linux 64 (centOS) , postgres 9.2.1. Followed instructions in README - all went fine with no error messages up to the point of selecting data from the newly created foreign table. Server log and psql both show: "ERROR: JDBCUtilsClass is NULL". Any idea what is wrong?

JDBC_FDW Build fails with Postgresql 10

@atris
I am getting the following errors when building using command with Postgresql 10 => PATH=/usr/local/pgsql-10.0/bin/:$PATH USE_PGXS=1 make

jdbc_fdw.c: In function ‘jdbc_fdw_handler’:
jdbc_fdw.c:372:29: warning: assignment from incompatible pointer type [enabled by default]
fdwroutine->GetForeignPlan = jdbcGetForeignPlan;
^
jdbc_fdw.c: In function ‘jdbcGetForeignPaths’:
jdbc_fdw.c:1060:2: error: incompatible type for argument 3 of ‘create_foreignscan_path’
add_path(baserel, (Path*)create_foreignscan_path(root, baserel, baserel->rows, startup_cost, total_cost, NIL, NULL, NIL));
^
In file included from jdbc_fdw.c:43:0:
/usr/local/pgsql-10.0/include/server/optimizer/pathnode.h:107:21: note: expected ‘struct PathTarget *’ but argument is of type ‘double’
extern ForeignPath *create_foreignscan_path(PlannerInfo *root, RelOptInfo rel,
^
jdbc_fdw.c:1060:2: error: incompatible type for argument 6 of ‘create_foreignscan_path’
add_path(baserel, (Path
)create_foreignscan_path(root, baserel, baserel->rows, startup_cost, total_cost, NIL, NULL, NIL));
^
In file included from jdbc_fdw.c:43:0:
/usr/local/pgsql-10.0/include/server/optimizer/pathnode.h:107:21: note: expected ‘Cost’ but argument is of type ‘struct List *’
extern ForeignPath *create_foreignscan_path(PlannerInfo *root, RelOptInfo rel,
^
jdbc_fdw.c:1060:2: warning: passing argument 8 of ‘create_foreignscan_path’ from incompatible pointer type [enabled by default]
add_path(baserel, (Path
)create_foreignscan_path(root, baserel, baserel->rows, startup_cost, total_cost, NIL, NULL, NIL));
^
In file included from jdbc_fdw.c:43:0:
/usr/local/pgsql-10.0/include/server/optimizer/pathnode.h:107:21: note: expected ‘Relids’ but argument is of type ‘struct List *’
extern ForeignPath *create_foreignscan_path(PlannerInfo *root, RelOptInfo rel,
^
jdbc_fdw.c:1060:2: error: too few arguments to function ‘create_foreignscan_path’
add_path(baserel, (Path
)create_foreignscan_path(root, baserel, baserel->rows, startup_cost, total_cost, NIL, NULL, NIL));
^
In file included from jdbc_fdw.c:43:0:
/usr/local/pgsql-10.0/include/server/optimizer/pathnode.h:107:21: note: declared here
extern ForeignPath *create_foreignscan_path(PlannerInfo *root, RelOptInfo *rel,
^
jdbc_fdw.c: In function ‘jdbcGetForeignPlan’:
jdbc_fdw.c:1079:2: error: too few arguments to function ‘make_foreignscan’
return (make_foreignscan(tlist, scan_clauses, scan_relid, NIL, NIL));
^
In file included from jdbc_fdw.c:45:0:
/usr/local/pgsql-10.0/include/server/optimizer/planmain.h:51:21: note: declared here
extern ForeignScan *make_foreignscan(List *qptlist, List *qpqual,
^
jdbc_fdw.c:1080:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
make: *** [jdbc_fdw.o] Error 1

Error mapping datetime from SQLServer.

There is an error mapping datetime type from SQLServer to PostgreSQL via JDBC_FDW.

Environment:
jtds-1.2.4.jar
postgresql-9.1.5 (compiled from source).
jdbc_fdw compiled from source.

SQLServer table columns (at SQLServer):
IDINDICE int
VALORDE numeric
ANOMESINICIO int
DATALANCAMENTO datetime
VALORATE numeric
VALORRETORNO numeric
ANOMESFINAL int
IDUSUARIO int

Row from table at SQLServer (same order that is declared above)
1001 0 200401 2004-01-01 00:00:00.0 999,999,999 240 200505 5

Foreign Table (at PostgreSQL)
CREATE FOREIGN TABLE oris_fdw_sm (
valorretorno numeric,
anomesinicio numeric,
anomesfinal numeric,
idindice int
) SERVER oris_fdw_server
OPTIONS (
table 'oris.oris.eveinddet'
);

SQL Statement (at PostgreSQL)
select * from oris_fdw_sm;

Error (at PostgreSQL)
ERROR: invalid input syntax for integer: "2004-01-01 00:00:00.0"

********** Error **********

ERROR: invalid input syntax for integer: "2004-01-01 00:00:00.0"
SQL state: 22P02

Notice that I haven't mapped DATALANCAMENTO column, although the error raised when getting this content.

Error running in Windows.

Atri, we are using the following method to build Postgresql under Windows.

http://www.postgresql.org/docs/9.0/static/install-windows.html

Environment:
Windows 2012 Server 64
Visual Studio Express 2012
JRE 7u23 64
JDK 7u23 64
PostgreSQL 9.2.4

The PostgreSQL compiles with JDBC_FDW as a contrib module with sucess. We install it and PostgreSQL runs. (after initdb, and pg_ctl start).

With PostgreSQL up and running, the following command fails:

create extension jdbc_fdw;
Could not load library "C:/Postgres/lib/jdbc_fdw.dll": unknow error 126

That's the only output we got. Is there any tip to get this working?

ps: We copied the jvm.dll into C:/Windows/System32, trying to solve the problem, but it didn't make any diference.

Support PostgreSQL 9.5

In order to comile with PostgreSQL 9.5, in file JDBC_FDW/jdbc_fdw.c, on line 1079, change the ending from:
scan_relid, NIL, NIL));
to:
scan_relid, NIL, NIL, NIL));

I still use this (jdbc_fdw) over jdbc2_fdw when I need to access queries (SQL statements & stored procedures) as jdbc2_fdw seems to only supports tables. However, the Java file names overlap between projects. I do not check to see if the Java files are any different. Technically, the other project should rename their files, however, I am not sure if they anticipated people using both jdbc_fdw and jdbc2_fdw side by side. This patch adds support for PostgreSQL 9.5 by making the change above, and changes the code to use the new Java file names:
https://gist.github.com/mc-soi/cce26e0e6186d416a9cc
You might have to rename the files before applying this patch.

JDBC_FDW performance issues

Hello!

We are using jdbc_fdw to connect do DB2, and we noticed that all queries are very slow compared with the db2 client installed at the same machine.
We are firing a query like "select count(*) from table" and with jdbc_fdw it's taking 2 seconds more than db2 client.

Is there any parameter of jdbc_fdw to speed up the queries?

Thanks!

Support for PostgreSQL 9.5's IMPORT FOREIGN SCHEMA

I currently use JDBC_FDW with PostgreSQL 9.3 and db2, and works perfect, but with the Postgresql 9.5's new feature "IMPORT FOREIGN SCHEMA", after compile jdbc_fdw for work with that version (9.5), it doesn't support the new feature (ERROR: foreign-data wrapper "jdbc_fdw" does not support IMPORT FOREIGN SCHEMA). It would be great add this functionality for use.

Units in Readme for querytimeout, maxheapsize.

Thank you very much for jdbc_fdw.

Can you please add units to paragraphs like

querytimeout : The time after which a query will be terminated automatically.
This can be used for terminating hung queries.

in README file and/or wiki/Installation-instructions?

PGXN installation problem

Hello!
I have the following issue:

~ sudo USE_PGXS=1 pgxn install JDBC_FDW
INFO: best version: jdbc_fdw 1.0.0
INFO: saving /tmp/tmp8qwZCq/jdbc_fdw-1.0.0.zip
INFO: unpacking: /tmp/tmp8qwZCq/jdbc_fdw-1.0.0.zip
INFO: building extension
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -I/usr/include/mit-krb5 -fPIC -pie -fno-omit-frame-pointer -fPIC -D'PKG_LIB_DIR=/usr/local/pgsql/lib' -I. -I./ -I/usr/include/postgresql/server -I/usr/include/postgresql/internal -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/tcl8.6 -I/usr/include/x86_64-linux-gnu    -c -o jdbc_fdw.o jdbc_fdw.c
jdbc_fdw.c: In function ‘jdbc_fdw_handler’:
jdbc_fdw.c:1060:66: error: incompatible type for argument 3 of ‘create_foreignscan_path’
  add_path(baserel, (Path*)create_foreignscan_path(root, baserel, baserel->rows, startup_cost, total_cost, NIL, NULL, NIL));
                                                                  ^
In file included from jdbc_fdw.c:43:0:
/usr/include/postgresql/server/optimizer/pathnode.h:107:21: note: expected ‘PathTarget * {aka struct PathTarget *}’ but argument is of type ‘double’
 extern ForeignPath *create_foreignscan_path(PlannerInfo *root, RelOptInfo *rel,
                     ^
In file included from /usr/include/postgresql/server/access/tupdesc.h:19:0,
                 from /usr/include/postgresql/server/funcapi.h:20,
                 from jdbc_fdw.c:23:
/usr/include/postgresql/server/nodes/pg_list.h:69:18: error: incompatible type for argument 6 of ‘create_foreignscan_path’
 #define NIL      ((List *) NULL)
                  ^
jdbc_fdw.c:1060:107: note: in expansion of macro ‘NIL’
  add_path(baserel, (Path*)create_foreignscan_path(root, baserel, baserel->rows, startup_cost, total_cost, NIL, NULL, NIL));
                                                                                                           ^
In file included from jdbc_fdw.c:43:0:
/usr/include/postgresql/server/optimizer/pathnode.h:107:21: note: expected ‘Cost {aka double}’ but argument is of type ‘List * {aka struct List *}’
 extern ForeignPath *create_foreignscan_path(PlannerInfo *root, RelOptInfo *rel,
                     ^
In file included from /usr/include/postgresql/server/access/tupdesc.h:19:0,
                 from /usr/include/postgresql/server/funcapi.h:20,
                 from jdbc_fdw.c:23:
/usr/include/postgresql/server/nodes/pg_list.h:69:18: warning: passing argument 8 of ‘create_foreignscan_path’ from incompatible pointer type [-Wincompatible-pointer-types]
 #define NIL      ((List *) NULL)
                  ^
jdbc_fdw.c:1060:118: note: in expansion of macro ‘NIL’
  add_path(baserel, (Path*)create_foreignscan_path(root, baserel, baserel->rows, startup_cost, total_cost, NIL, NULL, NIL));
                                                                                                                      ^
In file included from jdbc_fdw.c:43:0:
/usr/include/postgresql/server/optimizer/pathnode.h:107:21: note: expected ‘Relids {aka struct Bitmapset *}’ but argument is of type ‘List * {aka struct List *}’
 extern ForeignPath *create_foreignscan_path(PlannerInfo *root, RelOptInfo *rel,
                     ^
jdbc_fdw.c:1060:27: error: too few arguments to function ‘create_foreignscan_path’
  add_path(baserel, (Path*)create_foreignscan_path(root, baserel, baserel->rows, startup_cost, total_cost, NIL, NULL, NIL));
                           ^
In file included from jdbc_fdw.c:43:0:
/usr/include/postgresql/server/optimizer/pathnode.h:107:21: note: declared here
 extern ForeignPath *create_foreignscan_path(PlannerInfo *root, RelOptInfo *rel,
                     ^
jdbc_fdw.c: In function ‘jdbcGetForeignPlan’:
jdbc_fdw.c:1079:10: error: too few arguments to function ‘make_foreignscan’
  return (make_foreignscan(tlist, scan_clauses, scan_relid, NIL, NIL));
          ^
In file included from jdbc_fdw.c:45:0:
/usr/include/postgresql/server/optimizer/planmain.h:51:21: note: declared here
 extern ForeignScan *make_foreignscan(List *qptlist, List *qpqual,
                     ^
make: *** [jdbc_fdw.o] Error 1
ERROR: command returned 2: make PG_CONFIG=/usr/bin/pg_config all

but this works:

git clone https://github.com/atris/JDBC_FDW
cd ./JDBC_FDW
sudo make USE_PGXS=1
sudo make USE_PGXS=1 install

PostgreSQL version 10beta1.
Is PGXN version 1.0.0 valid?

JDBC_FDW does not work with BIGINT match under JOIN clauses

-- foreign database
CREATE TABLE foreign_table (id BIGSERIAL);

-- local database
CREATE TABLE local_table (id BIGSERIAL, remote_id BIGSERIAL);

CREATE FOREIGN TABLE local_foreign_table (
id BIGINT
) SERVER aserver
OPTIONS (
query '
SELECT
id
FROM
foreign_table
');

-- local query
SELECT
local.id,
local.remote_id,
foreign.id
FROM
local_table as local,
local_foreign_table as foreign
WHERE
local.remote_id = local_foreign_table.id

Problem: for several rows, JOIN operation only applies for the first one row in resultset. If we cast boths IDs (local.id and foreign.id) to Integer (instead of BigInt), all results are correct, the match occurs in all resultset.

Short reads result in successful queries

When an error is encountered while retrieving query results, it is swallowed and result row processing terminates. As a result, a partial set of rows is returned rather than the query failing as expected.

I have a patch, but am going to test it in production as I have not been able to force this error condition.

build Fails on OSX 10.10 (Yosemite)

make install USE_PGXS=1

clang -I/usr/local/Cellar/ossp-uuid/1.6.2_1/include/ossp -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -arch x86_64 -bundle -multiply_defined suppress -o jdbc_fdw.so jdbc_fdw.o -L/usr/local/Cellar/postgresql/9.3.5_1/lib -L/usr/local/Cellar/ossp-uuid/1.6.2_1/lib -Wl,-dead_strip_dylibs -arch x86_64 -I/System/Library/Frameworks/JavaVM.framework/Headers -L/System/Library/Frameworks/JavaVM.framework/Libraries -ljvm -framework JavaVM -bundle_loader /usr/local/Cellar/postgresql/9.3.5_1/bin/postgres
ld: library not found for -ljvm
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [jdbc_fdw.so] Error 1

Modifying foreign data

Hello!

Please, is it possible to modify foreign data (insert,update,delete) trough jdbc_fdw?
Example, i'm using jdbc_fdw to read a table from a DB2 database. Is it possible to insert, update or delete records?

Thanks!

Gabriel.

Add support for multiple jar files

Hi,

PDI is an open source ETL tool. It also supports virtual tables which can be accessed by the pdi dataservice JDBC ThinDriver. This JDBC driver contains multiple jars. In clients like DBeaver and DBVisualizer I can use this driver only when I select all files (see attached image)
dbeaver-edit-driver

Other examples of JDBC drivers which have more than one jar file are 'Teradata', 'Hadoop Apache Hive' and 'Hadoop Spark Hive'

Can you add support for multiple jar files?

Kind regards,
Beer Molleman

while reloading postgres java hangs

Hi,

I use your module since a long time and everything works fine. Tanks a lot !

But recently I have a new app which use JDBC FDW very frequently.
At each reload of postgres (SIGHUP) the postmaster process forward SIGHUP to every child. And the JAVA one considers this signal as a abnormal terminaison, and stops immediatly.
As a consequence the postmaster goes into recovery mode because of a crash of one of his child.

I see that -Xrs option passed to the JVM will change that behaviour, but I dont see anything in possible options.

How do you manage that case ?
thanks

Melanie

64 bit windows jdbc_fdw.dll issues

I have been trying to get jdbc_fdw to work on a 64 bit Windows system to no avail. First I had issues trying to install it using windows sdk getting errors like jdbc_fdw.obj : error LNK2019: unresolved external symbol JNI_CreateJavaVM" so I switched and was able to install it using 64 bit mingw. The server starts up fine bit now when I go to Create extension, I get the error below. I see the dll and have tried changing the path etc and nothing seems to work. Any advice would be much appreciated.

ERROR: could not load library "C:/PostgreSQL/9.3/lib/jdbc_fdw.dll": The specified module could not be found.

not support for PostgreSQL 9.6

in src\include\optimizer\pathnode.h

extern ForeignPath *create_foreignscan_path(PlannerInfo *root, RelOptInfo *rel,
PathTarget *target,
double rows, Cost startup_cost, Cost total_cost,
List *pathkeys,
Relids required_outer,
Path *fdw_outerpath,
List *fdw_private);

in jdbc_fdw.c
/* Create a ForeignPath node and add it as only possible path /
add_path(baserel, (Path
)create_foreignscan_path(root, baserel, NULL,baserel->rows, startup_cost, total_cost, NIL, NULL, NULL
#if PG_VERSION_NUM >= 90500
,
NIL
#endif
));
}

two funciton are not match.
PathTarget *target,.....

build fail on OSX.

Environment

OSX 10.6.8

java -version
java version "1.6.0_35"
Java(TM) SE Runtime Environment (build 1.6.0_35-b10-428-10M3811)
Java HotSpot(TM) 64-Bit Server VM (build 20.10-b01-428, mixed mode)

javac -version
javac 1.6.0_35

Steps to reproduce.

  1. Clone git source.
  2. Make clean.
  3. postgresql-9.2.1/contrib/JDBC_FDW]$ sudo ln -s /System/Library/Frameworks/JavaVM.framework/Libraries/libserver.dylib /usr/lib/libjvm.dylib
  4. make install
    javac -d /Applications/PostgreSQL-9.2.1/lib/postgresql JDBCUtils.java JDBCDriverLoader.java
    gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -bundle -multiply_defined suppress -o jdbc_fdw.so jdbc_fdw.o -L../../src/port -Wl,-dead_strip_dylibs -ljvm -bundle_loader ../../src/backend/postgres
    ld: warning: in /usr/lib/libjvm.dylib, file was built for i386 which is not the architecture being linked (x86_64)
    Undefined symbols:
    "_JNI_CreateJavaVM", referenced from:
    _jdbcGetForeignPlan in jdbc_fdw.o
    ld: symbol(s) not found
    collect2: ld returned 1 exit status
    make: *** [jdbc_fdw.so] Error 1
  5. Tried to replace libjvm to libserver.
  6. Make clean and Make install

javac -d /Applications/PostgreSQL-9.2.1/lib/postgresql JDBCUtils.java JDBCDriverLoader.java
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -D'PKG_LIB_DIR=/Applications/PostgreSQL-9.2.1/lib/postgresql' -I. -I. -I../../src/include -c -o jdbc_fdw.o jdbc_fdw.c
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -bundle -multiply_defined suppress -o jdbc_fdw.so jdbc_fdw.o -L../../src/port -Wl,-dead_strip_dylibs -ljvm -bundle_loader ../../src/backend/postgres
Undefined symbols:
"_JNI_CreateJavaVM", referenced from:
_jdbcGetForeignPlan in jdbc_fdw.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [jdbc_fdw.so] Error 1

ClassNotFoundException using two servers.

It appears not working properly when using two distinct servers with jdbc_fdw. The second classpath is just ignored after quering the first one.

Steps to reproduce.

  1. Create server serverA FOREIGN DATA WRAPPER ... OPTIONS (driverA)
  2. Create server serverB FOREIGN DATA WRAPPER ... OPTIONS (driverB)
  3. CREATE FOREIGN TABLE TableA ON SERVER A.
  4. CREATE FOREIGN TABLE TableB ON SERVER B.
  5. SELECT on TableA works.
  6. SELECT on TableB throws java.lang.ClassNotFoundException: <DRIVER_CLASS>

The inverse order throws the same exception too. Executing the step 6 first, and then step 5, but the serverA driver is not found.

StackTrace:

ERROR: java.lang.ClassNotFoundException: net.sourceforge.jtds.jdbc.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
at JDBCUtils.Initialize(JDBCUtils.java:78)

NullPointerException at JDBCUtils.Close(JDBCUtils.java:181)

I am testing jdbc_fdw against Teradata 14.10

CREATE EXTENSION IF NOT EXISTS jdbc_fdw;
DROP SERVER IF EXISTS TD_Dev CASCADE;
CREATE SERVER TD_Dev FOREIGN DATA WRAPPER jdbc_fdw OPTIONS (
drivername  'com.teradata.jdbc.TeraDriver',
url     'jdbc:teradata://host/database=foo',     -- ,tmode=ANSI,charset=LATIN1250_1A0
jarfile '/opt/Teradata/jdbc/terajdbc4.jar'
-- querytimeout '35',
-- maxheapsize  '600'
);
CREATE USER MAPPING FOR CURRENT_USER SERVER TD_Dev
OPTIONS (username 'foo', password 'bar');
CREATE FOREIGN TABLE Test_td1 (Id int, Code text) SERVER TD_Dev
OPTIONS (QUERY 'SELECT * FROM foo.test1');
SELECT * FROM Test_td1;

with result

…
CREATE FOREIGN TABLE
psql:test_TD_fdw.sql:26: ERROR:  java.lang.NullPointerException
        at JDBCUtils.Close(JDBCUtils.java:181)

PostgreSQL 9.4. How can I solve this, please?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.