apoc.load.jdbc

Procedure Apoc Extended

apoc.load.jdbc('key or url','table or statement', params, config) YIELD row - load from relational database, from a full table or a sql statement

Signature

apoc.load.jdbc(jdbc :: STRING?, tableOrSql :: STRING?, params = [] :: LIST? OF ANY?, config = {} :: MAP?) :: (row :: MAP?)

Input parameters

Name Type Default

jdbc

STRING?

null

tableOrSql

STRING?

null

params

LIST? OF ANY?

[]

config

MAP?

{}

Output parameters

Name Type

row

MAP?

Usage Examples

The following examples assume that the MySQL driver has been loaded using apoc.load.driver.

The following count rows in the products table of the Northwind dataset:

WITH "jdbc:mysql://localhost:3306/northwind?user=root" as url
CALL apoc.load.jdbc(url,"products") YIELD row
RETURN count(*);
Table 1. Results
count(*)

77

The following returns the first row in the products table of the Northwind dataset:

WITH "jdbc:mysql://localhost:3306/northwind?user=root" as url
CALL apoc.load.jdbc(url,"products")
YIELD row
RETURN row
LIMIT 1;
Table 2. Results
row

{UnitPrice → 18.0000, UnitsOnOrder → 0, CategoryID → 1, UnitsInStock → 39}