Skip to content

Commit

Permalink
Added Oracle source databases
Browse files Browse the repository at this point in the history
  • Loading branch information
easydatawarehousing committed Jul 28, 2014
1 parent af50114 commit 4ffcf62
Show file tree
Hide file tree
Showing 26 changed files with 8,058 additions and 4,059 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ add_subdirectory(EasyMTOra)
add_subdirectory(EasyPTOra)
add_subdirectory(EasySTOra)
add_subdirectory(EasyTTOra)
add_subdirectory(EasyNTOra)
1 change: 1 addition & 0 deletions Documentation/eto-features-futures.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
&bull;&nbsp;SQLite 3.x<br />
&bull;&nbsp;Microsoft Access 97 - 2003 (discontinued in ETO 2.0 version)<br />
&bull;&nbsp;Presto (Hadoop)<br />
&bull;&nbsp;Oracle<br />
<br />
&bull;&nbsp;All datatypes are handled except: (var)binary, lob's, image. Fields with these datatypes are automatically filtered out by PL/SQL package.<br />
Other fieldtypes are converted to corresponding Oracle types. Mostly to varchar2, number and date. User- defined conversions are possible, as long as they are valid for external tables. Character fields with content longer than 4,000 bytes are cut of at that length (extended varchar length of Oracle 12c is partially supported). Character set conversions are carried out by Oracle.<br />
Expand Down
1 change: 1 addition & 0 deletions Documentation/eto-index.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
&bull;&nbsp;All functions can be used from within the database using SQL or PL/SQL.<br />
&bull;&nbsp;Simple to install and use<br />
&bull;&nbsp;Can be used for any kind of data-integration, like loading of a datawarehouse, data migration and even creating a data-virtualization platform<br />
&bull;&nbsp;Binary releases (i.e. precompiled executables) are available via: <a href ="http://www.easydatawarehousing.com/easy-to-oracle-download/">easydatawarehousing.com</a><br />
<br />
<b>More information</b><br />
&bull;&nbsp;Learn how it works. See the <a title="ETO – Technical overview" href="eto-technical-overview.html">Technical overview</a>, the <a title="comparison" href="eto-comparison.html">comparison</a> with other data-integration methods and the <a title="ETO – Requirements" href="eto-requirements.html">Technical Requirements</a><br />
Expand Down
2 changes: 1 addition & 1 deletion Documentation/eto-requirements.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<span class="kop4">Easy ... To Oracle - Requirements<br /></span>
<br />
<b>Oracle</b><br />
ETO uses the Oracle external table "pre-processor" feature. This feature is available from Oracle releases 10.2.0.5, 11.1.0.7 and 11.2.0.1.<br />
ETO uses the Oracle external table "pre-processor" feature. This feature is available from Oracle releases 10.2.0.5, 11.1.0.7, 11.2.0.1 and 12.*.<br />
Any edition of the database will do (Express, Standard, Enterprise). Since the "pre-processor" feature was developed for RAC it should also work in a RAC environment, but this has not been tested by me.<br />
<br />
<b>OS</b><br />
Expand Down
25 changes: 25 additions & 0 deletions ETO_Common/LICENSE INIPARSER
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Iniparser

Copyright (c) 2000-2012 by Nicolas Devillard.
MIT License

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
27 changes: 23 additions & 4 deletions ETO_Common/src/eto_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ extern int __cdecl tolower(_In_ int _C);
ETO_PARAMS* eto_new_ini_params(const char* ini_file_name)
{
ETO_PARAMS* params;
unsigned int i;
unsigned int i, j;
bool copy_port = true;

if (!ini_file_name)
{
Expand Down Expand Up @@ -81,10 +82,26 @@ ETO_PARAMS* eto_new_ini_params(const char* ini_file_name)
// Check if tcp port is included in database string
for (i = 0; i < strlen(params->dbs); i++)
{
// Look for a colon
if (strncmp(params->dbs + i, ":", 1) == 0)
{
params->prt = atoi(params->dbs + i + 1);
params->dbs[i] = 0; // Modifying an iniparser string here !
// Check that the portnumber is not followed by a string
// for instance an Oracle servicename
for (j = i + 1; j < strlen(params->dbs); j++)
{
if ( ! (strncmp(params->dbs + j, "0", 1) >= 0 && strncmp(params->dbs + j, "9", 1) <= 0) )
{
copy_port = false;
break;
}
}

if (copy_port)
{
params->prt = atoi(params->dbs + i + 1);
params->dbs[i] = 0; // Modifying an iniparser string here !
}

break;
}
}
Expand Down Expand Up @@ -300,7 +317,9 @@ bool eto_create_query(char **sql, const char *in_statement, const char *in_table
tempsql = (char*)calloc(strlen(*sql) + 1, sizeof(char) );

if (!tempsql)
exit(1); strcpy(tempsql, *sql);
exit(1);

strcpy(tempsql, *sql);
strcpy(*sql, "SELECT * FROM (");
strcat(*sql, tempsql);
strcat(*sql, ") WHERE 1=0");
Expand Down
8 changes: 4 additions & 4 deletions EasyMTOra/src/eto_dbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ bool eto_open_database(ETO_PARAMS* params)
}

// Check/copy/create sql
if (!eto_create_query(&qdata->sql, params->sql, params->tbl, false /* is_describe: always false for freetdp */, true) )
if (!eto_create_query(&qdata->sql, params->sql, params->tbl, false /* is_describe: always false for MySQL */, true) )
{
// Log messages added by eto_create_query
return false;
Expand All @@ -283,20 +283,20 @@ bool eto_open_database(ETO_PARAMS* params)

if (!conn)
{
eto_log_add_entry_s("ETO-10202 Open database: Connection allocation failed. MySQL client version: ", mysql_get_client_info() );
eto_log_add_entry_s("ETO-10202 Open database: Connection allocation failed. MySQL client version:", mysql_get_client_info() );
return false;
}

// Login to database
if (mysql_real_connect(conn, params->dbs, params->usr, params->pwd, NULL, params->prt, NULL, 0) == NULL)
{
eto_log_add_entry_s("ETO-10206 Open database: Create connection failed: ", mysql_error(conn));
eto_log_add_entry_s("ETO-10206 Open database: Create connection failed:", mysql_error(conn));
return false;
}

if (mysql_set_character_set(conn, "utf8"))
{
eto_log_add_entry_s("ETO-10207 Open database: Could not set UTF-8 character set. Default is: ", mysql_character_set_name(conn) );
eto_log_add_entry_s("ETO-10207 Open database: Could not set UTF-8 character set. Default is:", mysql_character_set_name(conn) );
}

// Execute query
Expand Down
35 changes: 35 additions & 0 deletions EasyNTOra/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Set target
set(TARGET_NAME "EasyNTOra")

# Add libraries
set(ORACLE_OCI_NAMES libclntsh.so)
set(ORACLE_LIB_DIR "${CMAKE_SOURCE_DIR}/bin/lib")

find_library(ORACLE_OCI_LIBRARY
NAMES ${ORACLE_OCI_NAMES}
PATHS ${ORACLE_LIB_DIR}
NO_DEFAULT_PATH
)

set(LIBS ${ORACLE_OCI_LIBRARY})

# Add include dirs
include_directories ("${CMAKE_SOURCE_DIR}/ETO_Common/include")
include_directories ("${CMAKE_SOURCE_DIR}/EasyNTOra/instantclient/include")

# Add sources
set(SRC
src/eto_dbs.c
${CMAKE_SOURCE_DIR}/ETO_Common/src/dictionary.c
${CMAKE_SOURCE_DIR}/ETO_Common/src/iniparser.c
${CMAKE_SOURCE_DIR}/ETO_Common/src/eto_log.c
${CMAKE_SOURCE_DIR}/ETO_Common/src/eto_util.c
${CMAKE_SOURCE_DIR}/ETO_Common/src/eto_main.c
)

# Add executable and dependancies. Setup RPATH to the executable (lib) directory
add_executable (${TARGET_NAME} ${SRC})

SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,'$ORIGIN:$ORIGIN/lib'" )

target_link_libraries (${TARGET_NAME} ${LIBS})
1 change: 1 addition & 0 deletions EasyNTOra/INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Easy ... To Oracle - ORACLE==========================#### Executable name: EasyNTOra#### Used library: ORACLE Instant Client / OCI#### Minimum library version: 11.1.0.6.0#### Recommended library version: 12.1.0.1.0Preparations------------Download the Oracle Instant Client from: http://www.oracle.com/technetwork/database/features/instant-client/index-097480.htmlGrab these 2 packages for your platform: Instant Client Package - Basic Lite Instant Client Package - SDKExtract these somewhere. Copy these files:Windows Headerfiles: from instantclient/sdk/include to EasyNTOra/instantclient/include .lib, files: instantclient to EasyNTOra/instantclient/lib (only need oci.lib) .dll/.sym files: instantclient to msvc/EasyNTOra/Debug (only: oci.dll, oraons.dll, oraociicus12.dll, plus the corresponding .sym files) .dll files: instantclient to msvc/EasyNTOra/Release (only: oci.dll, oraons.dll, oraociicus12.dll)Linux/Debian Headerfiles: from instantclient/sdk/include to EasyNTOra/instantclient/include .so files: instantclient to bin/lib (libclntsh.so.12.1 libclntshcore.so.12.1 libnnz12.so libociicus.so lobons.so ) Create a symbolic link (libclntsh.so => libclntsh.so.12.1) in order to work with cmake 2.6: cd bin/lib ln -s libclntsh.so.12.1 libclntsh.soBuilding EasyNTO----------------See the general installation instructions.Specific usage information--------------------------NoneTest script----------- DECLARE r number; BEGIN DBMS_OUTPUT.enable(20000); r := SYS.UTL_ETO.ETO_Create_Database_Connection('ORACLE'); r := SYS.UTL_ETO.ETO_Set_Parameter('ORACLE', SYS.UTL_ETO.Eto_par_executable, 'EasyNTOra'); r := SYS.UTL_ETO.ETO_Set_Parameter('ORACLE', SYS.UTL_ETO.Eto_par_bin_dir, 'user_dir_eto_bin'); r := SYS.UTL_ETO.ETO_Set_Parameter('ORACLE', SYS.UTL_ETO.Eto_par_data_dir, 'user_dir_eto_data'); r := SYS.UTL_ETO.ETO_Set_Parameter('ORACLE', SYS.UTL_ETO.Eto_par_db_name, 'ipadress_or_servername:port/servicename'); -- ORACLE uses 1521 as default tcp port, the port and servicename are both optional r := SYS.UTL_ETO.ETO_Set_Parameter('ORACLE', SYS.UTL_ETO.Eto_par_db_user, 'user'); r := SYS.UTL_ETO.ETO_Set_Parameter('ORACLE', SYS.UTL_ETO.Eto_par_db_pwd, 'password'); r := SYS.UTL_ETO.ETO_Set_Parameter('ORACLE', SYS.UTL_ETO.Eto_par_default_charset, 'AL32UTF8'); r := SYS.UTL_ETO.ETO_Set_Parameter('ORACLE', SYS.UTL_ETO.Eto_par_def_cacherows, '25'); -- For Oracle sources a cache size between 15-45 works fastest -- r := SYS.UTL_ETO.ETO_Set_Parameter('ORACLE', SYS.UTL_ETO.Eto_par_list_table_query, 'select owner || ''.'' || table_name from all_tables where owner=''schemaname'''); -- Replace schemaname with the actual name !!! -- r := SYS.UTL_ETO.ETO_Create_Tables_From_DB ( pOutputSchema => 'SCHEMA' -- replace , pOutputPrefix => 'ORA_' , pConnectionname => 'ORACLE' , pDropAllowed => 'Y' ); DBMS_OUTPUT.PUT_LINE('Return value = ' || r); END; -------------------------------------Copyright (C) 2011-2014 Ivo Herweijer
Expand Down
37 changes: 37 additions & 0 deletions EasyNTOra/Oracle_testfile.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This file is part of Easy to Oracle - Free Open Source Data Integration

# Copyright (C) 2011-2014 Ivo Herweijer

# Easy to Oracle is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

# You can contact me via email: [email protected]
#
# This is an example ini file
# Note that entries starting with an underscore _
# are not read. These were added as examples.
#

[EasyXTOra]
database = server/servicename;
user = user;
password = pwd;
_table = schema.tablename;
sql = select * from dual;
cache_rows = 25;
logfilename = Oracle_testfile.log;
_describe_id = 123; # If used, ETO will return field information, not data
fieldseparator = ";"; # Default value is \2 Valid values are: \t , ;
lineseparator = \n; # Default value is \1 Valid values are: \r \n \r\n
addheader = 1;
maxvarcharlen = 4000;
1 change: 1 addition & 0 deletions EasyNTOra/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Easy to Oracle - Free open source data integration==================================================Oracle To Oracle, why ?-----------------------Datareplication from an Oracle source database to an Oracle target database!Why I hear you ask. Isn't a database link or datapump easier and faster ?This is absolutely true. Database links are easier to install (part of the database) and easier to use. And is in fact about two times faster thaneasy-2-oracle. So why add this option?Well, this part of easy-2-oracle wasn't meant for Oracle target databases, butfor versions ported to other target databases/platforms, like R.EasyNTOra---------Name of the executable should be EasyOTOra, but this name is already in usefor 'Office' databases. I used the nearest letter in the alphabet instead.
Expand Down
Loading

0 comments on commit 4ffcf62

Please sign in to comment.