The Apache Derby ODBC driver lets you connect Microsoft SQL Server to Apache Derby and:
The Apache Derby ODBC driver is available to download from the Easysoft web site:
For installation instructions, refer to the Apache Derby ODBC driver documentation.
Before you can use the Apache Derby ODBC driver to connect SQL Server to Apache Derby, you need to configure an ODBC data source. An ODBC data source stores the connection details for the target database (in this case, Apache Derby) and the ODBC driver that's required to connect to it (in this case, the Apache Derby ODBC driver).
You can configure a user ODBC data source, which is only available to the user who creates it, or a system ODBC data source, which is available to all users on the machine. You configure ODBC data sources in ODBC Data Source Administrator, which is included with Windows.
There are two versions of ODBC Data Source Administrator on this platform. The version of ODBC Data Source Administrator that you need to run depends on whether you have a 32-bit or a 64-bit version of SQL Server. To find out which version of SQL Server you have, connect to your SQL Server instance, and then run this SQL statement:
select SERVERPROPERTY('edition')
If you have the 64-bit version of SQL Server and want to use a linked server with the Apache Derby ODBC driver, you need to run 64-bit version of ODBC Data Source Administrator. To do this, in the Windows Run dialog box, enter:
%windir%\system32\odbcad32.exe
If you have the 32-bit version of SQL Server or want to use SSIS with the Apache Derby ODBC driver, you need to run 32-bit version of ODBC Data Source Administrator. To do this, in the Windows Run dialog box, enter:
%windir%\syswow64\odbcad32.exe
Use ODBC Data Source Administrator to create your Apache Derby ODBC driver data source:
–Or–
Easysoft ODBC-Derby Driver
, and then choose Finish.Setting | Value |
---|---|
DSN | Apache Derby |
Database | The Apache Derby database you want to connect to. |
User Name | If you need to specify a user name to access your Apache Derby database, enter it here. Otherwise, leave this field blank. |
Password | The password for the Apache Derby user name, if applicable. |
You can now connect SQL Server to Apache Derby.
You need to log on with an account that is a member of the SQL Server sysadmin
fixed server role to create a linked server.
Derby
.Microsoft OLE DB Provider for ODBC Drivers
.SQL Server verifies the linked server by testing the connection.
Path
environment variable. The Apache Derby ODBC driver Setup program adds entries for the driver to the System Path
. Restarting the instance makes these changes available to SQL Server, allowing it to load the Apache Derby ODBC driver.OPENQUERY
function. For example:
SELECT * FROM OPENQUERY(DERBY, 'SELECT * FROM FIRSTTABLE')
SQL Server sends pass-through queries as uninterpreted query strings to the Apache Derby ODBC driver. This means that SQL Server does not apply any kind of logic to the query or try to estimate what that query will do.
These instructions assume that:
ToursDB
. The example inserts records into the COUNTRIES
table:
CREATE TABLE COUNTRIES ( COUNTRY VARCHAR(26) NOT NULL, COUNTRY_ISO_CODE CHAR(2) NOT NULL , REGION VARCHAR(26) ); ALTER TABLE COUNTRIES ADD CONSTRAINT COUNTRIES_PK Primary Key ( COUNTRY_ISO_CODE); ALTER TABLE COUNTRIES ADD CONSTRAINT COUNTRIES_UNQ_NM Unique ( COUNTRY); ALTER TABLE COUNTRIES ADD CONSTRAINT COUNTRIES_UC CHECK (country_ISO_code = upper(country_ISO_code) );
.csv
file named countries.csv
with the following contents:
COUNTRY,COUNTRY_ISO_CODE,REGION Afghanistan,AF,Asia Albania,AL,Europe Algeria,DZ,North Africa American Samoa,AS,Pacific Islands Angola,AO,Africa Argentina,AR,South America Armenia,AM,Europe Australia,AU,Australia and New Zealand Austria,AT,Europe Azerbaijan,AZ,Central Asia
Flat File Source is under the Other Sources list.
.csv
file.ODBC Destination is in the Other Destinations list.
.csv
file into Apache Derby.