Migrating a table with BLOB field from SQL-Server to Oracle.

Hi All,
I'm trying to create a Class to migrate data from SQL-Server to Oracle, this table has a BLOB field.
The Code:
package br.com.infox;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
public class Migrador {
     public static void main(String[] args){
          try {
               // Conex�o com o SQL Server
               Class.forName("net.sourceforge.jtds.jdbc.Driver");
               Connection conSQL = DriverManager.getConnection ("jdbc:jtds:sqlserver://10.10.2.9/protocolo","prot","suinf2002");
               // Conex�o com o Oracle
               Class.forName("oracle.jdbc.driver.OracleDriver");
               Connection conORA = DriverManager.getConnection ("jdbc:oracle:thin:@10.10.2.2:1521:des","protocolo","protocolo");
               Statement stSQL = conSQL.createStatement();
               String querySQL = "SELECT * FROM DOC_INCORPORADO";
               ResultSet rsSQL = stSQL.executeQuery(querySQL);
               String queryORA = "INSERT INTO PROT_VITALICIAMENTO (NU_PROCESSO, ANO_PROCESSO, CD_USUARIO, DT_ENVIO," +
                         "DE_COMPLEMENTO, NM_ARQUIVO, ARQUIVO, NU_SEQ, CD_TIPO_ARQUIVO, MES, ANO) VALUES (?,?,?,?,?,?,?,?,?,?,?)";
               PreparedStatement psORA = conORA.prepareStatement(queryORA);
               while (rsSQL.next()){
                    System.out.println("Linha: " + rsSQL.getRow());
                    psORA.setInt(1, rsSQL.getInt("nu_processo"));
                    psORA.setInt(2, rsSQL.getInt("ano_processo"));
                    psORA.setInt(3, rsSQL.getInt("cd_usuario"));
                    psORA.setDate(4, rsSQL.getDate("dt_incorporacao"));
                    psORA.setString(5, rsSQL.getString("complemento"));
                    psORA.setString(6, rsSQL.getString("nm_arquivo"));
                    psORA.setBinaryStream(7, rsSQL.getBinaryStream("arquivo"), (int)rsSQL.getBlob("arquivo").length());
                    psORA.setInt(8, rsSQL.getInt("num_seq"));
                    psORA.setInt(9, rsSQL.getInt("cd_tipo_arquivo"));
                    psORA.setInt(10, rsSQL.getInt("mes"));
                    psORA.setInt(11, rsSQL.getInt("ano"));
                    psORA.executeUpdate();
               stSQL.close();
               psORA.close();
               conORA.close();
               conSQL.close();
          } catch (Exception e){
               e.printStackTrace();
The ERROR:
java.sql.SQLException: Exce��o de E/S: Connection reset
     at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
     at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
     at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:334)
     at oracle.jdbc.ttc7.TTC7Protocol.handleIOException(TTC7Protocol.java:3668)
     at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1986)
     at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1119)
     at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2191)
     at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:2064)
     at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2989)
     at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:658)
     at br.com.infox.Migrador.main(Migrador.java:41)
What's the problem of these Class?
Thank's.

Depending on the version of the database you have, you could use transportable tablespaces.
http://download-east.oracle.com/docs/cd/B10501_01/server.920/a96524/c04space.htm#9370

Similar Messages

  • Problems with TIMESTAMP Field from SQL Server

    OBIEE 11g
    Hi All,
    I want to convert data into OBIEE that is coming from a TIMESTAMP field in SQL Server Database. So in SQL Server field has data like '9/20/2012 12:05:08 AM'. I have first changed the datatype in physical layer to DATETIME and then in BMM I do a CAST(<DATE_FIELD> AS DATE). On the frontend when I use this column the error I get back is [nQSError: 59030] Illegal data type conversion from source type: VARBINARY to target type: TIMESTAMP. (HY000). Does anyone know a workaround or solution.
    Thanks in Advance!

    Hi Guys,
    None of the solutions you mentioned have worked unfortunately. I have a date column and another column that holds user id. I basically want to do a count of all the user id's where that particular date column is NULL. I have checked in the physical layer and the date column in question is coming from SQL Server as a TIMESTAMP datatype. So I initially did not change anything and brought the column in as is but that did not work out. I then tried to change the datatype in the physical layer to DATETIME and then also DATE. After changing the datatype in the physical layer in the BMM I would do a CAST(<date column> as DATE) and this still did not work. I then tried to just change the datatype to DATETIME and DATE without doing the CAST in the BMM and this still did not work. Not too sure what to do now.

  • Migrating a table with BLOB column from one db to another

    Hello everybody,
    I have two databases D1 and D2. Each database contains table T1 (same structure in both databases). T has a BLOB column and is populated in D1. I have to move all the data from T database D1 into T database D2.
    D1 and D2 are located on different machines. T in D1 is a huge table (milions of records). What is the best solution to migrate the T data between the 2 databases?
    Any help will be appreciated.
    Thank you in advance.
    daniela

    Depending on the version of the database you have, you could use transportable tablespaces.
    http://download-east.oracle.com/docs/cd/B10501_01/server.920/a96524/c04space.htm#9370

  • Migrating from SQL Server to Oracle 8i

    Hi all :),
    I am trying to migrate from SQL Server to Oracle 9i.
    I am using the Migration Workbench.
    Everything goes fine during Capturing phase, but while
    creating Oracle model the Workbench just hangs at
    "Mapping Tablespaces" for over three hours.
    (not exactly hangs in the sense that it responds to mouse
    events and I can abort the ongoing activity ...)
    What should I do ? Should I let it go on and see what
    happens.
    I follow each and every step as mentioned in the
    documentation ... but obviously I am doing something
    wrong. Any pointers ???
    However ... if I try to migrate to Personal Oracle 8 ...
    the migration goes fine from start to end ... just that
    the SQL Server triggers aren't successfully migrated.

    You may want to start by downloading the Oracle Migration Workbench. That generally does a reasonable job in moving the tables, stored procedures, etc. from SQL Server to Oracle. If your VB code is database agnostic, it should continue to work without any more intervention. Realistically, however, you'll rpobably have to at least tweak a few things that don't work the same way in the old ODBC/ OLE DB provider and the new one.
    The hard part of migrations like this is that you may need to revisit some of your architectural decisions if you want Oracle to perform well. There are plenty of things that one does in SQL Server (i.e. frequent commits) to improve performance that have the opposite affect in Oracle. Identifying and fixing these sorts of things tends to be the largest part of a migration like this. Unfortunately, I don't know of a resource that talks addresses all the possible gotchas here.
    Justin
    Distributed Database Consulting, Inc.
    www.ddbcinc.com

  • Migration of table from sql server to oracle

    Hi,
    I had to export few tables from SQL Server to Oracle. After the migration, I am checking to see all the tables in Oracle that have been migrated from Sql Server. I am executing select * from tab; and am seeing all the the tables (including those have been exported) from the output list of tables. However, when I am doing a select * from x; where x is one of the few tables that have been migrated, it says table or view does not exist. This is the problem with all other migrated tables. Any help is appreciated in advance. Thanks.
    [email protected]

    Try select * from "x"

  • Related to migration of db from sql server to oracle 11 g

    We're trying to migrate a Sql server managment studio database to Oracle 11g using SQL Developer 4.0. We can successfully connect to both Sql server managment studion 8.0 and Oracle 11g using the tool, as well as click through the Migration Wizard and start the migration.
    This opens the Database Migration dialog box, which indicates the capture process starts normally. we get the following error:
    ora :01440 : can not insert null into migrlog (id column) ,
    \and then after some time , i get an error that migration failed
    i am not getting the reason,I thing it may be due to reason that , I have table's column in my source db with more than 30 character.
    If i am migrating one by one table . then it is not giving any error, and identifier name is getting shrink in 30 character. but i am not getting the view , stored procedure , indexes , and others
    then what is the solution  for that, somebody pls suggest any help?????????????               

    Pl do not post duplicates - related to migration of db from sql server to oracle 11 g
    Continue the discussion in your original thread
    The error message is explicitly clear
    ora :01440 : can not insert null into migrlog (id column)
    Your process is trying to insert a NULL value into the ID column, which presumably cannot be NULL

  • Faster way to migrate data from SQL Server to Oracle 10g

    We have to migrate data from SQL Server to Oracle 10 g.
    One particular table on SQL Server has records around 1.25 millions.
    We tried moving data using DTS package, but looks it will take hours with current speed of 300 records/minute.
    This table has TEXT column, which has XML strings stored. I am not sure, if this is the reason for slow migration.
    Would you please suggest better options to migrate it faster?
    Thanks in advance !!!

    Have you tried Migration work bench?

  • Migration from SQL Server to Oracle 8i

    Hi,
    what are the general issues to be considered when migrating a database from SQL server to Oracle 8i.
    Is it documented on the web/ or any publication
    Samit

    What we did was to create the schema using migration work bench and then transfer the data using data junction
    The main issues that you have to handle are
    1) Data type issue, here problem comes converting chars to varchars as chars are padded and may not work in indexes, so you have to trim the afterwards, and if you have any image type data types in Sqlserver, you can use either lobs or long raw, it again depends upon your application, if you uses lobs you may have to recode your application
    2) Sql statements, Oracle cannot understand Sqlserver sql statements, so you have to convert them all. Sqlserver allows two outerjoins to a table, Oracle does not, so you have to modify your functionality
    3) Connections to the database. if you are using ODBC then use Oracle ODBC drivers and the latest ones, otherwise you may encounter memory leaks.
    These are from the top of my head, if you have any specific problem I may be able to help.
    Good luck

  • How to extract incremental data from SQL server to oracle tables in ODI

    HI All,
    In my ODI sql server is install.My Source is in SQL server and my target is in Oracle.
    I need to create a interface mapping where i need to extract incremental data from sql server to oracle.
    There is a datetime(with Timestamp) field in sql server .I need to pull incremental data based on dateime.
    Example = tablename.DateTime > (select '1-jan-11' from dual) .....i am using this query but its not woking.the error is Invalid object name"dual".
    We are not going to use Incremental in IKM and LKM.
    Request you to please provide any suggestion ASAP.
    Thanks,
    Lony

    You can do that via Variable.
    In the interface mapping create a filter on Tablename.DateTime
    and put the condition like this
    Tablename.DateTime BETWEEN #VAR and in the variable use this query in refreshing tab with oracle schema
    SELECT max(start_time)||' AND '||max(END_TIME)+1 from audit_table where ETL_JOB_CODE = '20'In the package call the above variable in refresh mode and then interface.
    This way you will pass from the query between and condition date and pass to interface so that SQL Server fetches the data between those too range.
    Note:- You might need to tweak the date format so that SQL Server can understand.
    Hope this helps.

  • Insert and update tables from SQL server to oracle database tables

    Hi,
    I am having problem while update data from sql server to oracle database tables.
    I am doing one way insert +updates that is from SQL Server tables ==> Oracle database tables
    I am using tools Sql server Integration service. I can insert data from sql server to oracle but update can't. Please help me how can I update + insert from sql server to oracle database tables easily.
    Thanks in advance.

    Hi,
    What about using Oracle SQL Developer for migration
    http://www.oracle.com/technetwork/database/migration/sqlserver-095136.html
    HTH

  • How to migrate from sql server to oracle

    Hi ,
    My requirement is we are planning to migrate the sql server data to oracle.
    what is the way to do migration from sql server to oracle. Please let me know if any tools are there for migration.Previous we used sql developer( which is provided by oracle i.e. freeware )
    tool but it was created only table structures not ported any data.

    Hi,
    Oracle sql developer is a great tool for migration from sql server to oracle..
    Refer the link,
    http://www.oracle.com/technetwork/database/migration/sqlserver-095136.html

  • Migrating from SQL Server to ORACLE - Pls help

    Hi All,
    I am a .Net developer. I am asked to migrate a project from SQL Server to ORACLE. Can anyone help me how to move forward.
    I used SQLDEVELPOR tool and migrated all the tables. But the Stored Procedures haven't got migrated properly. I need to migrate all the SP's from the scratch.
    Please help me.
    Thanks in advance,
    Srinivasan.T

    You might consider post your question in Migration Bench forum.
    Database and Application Migrations

  • Migrating from SQL Server to ORACLE using SqlDeveloper tool - IN OUT CURSOR

    Hi All,
    I am new to Oracle. I am asked to migrate a database from SQL Server to ORACLE. I have migrated all the SP's and functions except 2. I am facing the following problem. Pls do reply me if anyone knows the solution since I am struggling for the past 2 days for these two functions
    the function is as follows in ORACLE.
    create or replace
    FUNCTION ABC
    AA IN VARCHAR2,
    BB IN DATE,
    CV_1 IN OUT SYS_REFCURSOR
    When I tried to call from some other function its showing me an error.
    I called from another function as follows:
    ABC(CC,DD,CV_2);
    Shall I know how to call the above function? I feel someone has faced the same problem before. Thanks in advance for the help.
    Thanks,
    Srinivasan.T

    Its returing a number only. I am just giving part of the function.
    create or replace
    FUNCTION ABC
    AA IN VARCHAR2,
    DD IN DATE,
    CV_1 IN OUT SYS_REFCURSOR
    RETURN NUMBER
    AS
    When I call the function which has a IN OUT SYS_REFCURSOR as a parameter I am facing this problem.
    I need to know how to call a function which has the IN OUT SYS_REFCURSOR parameter.
    Thanks,
    Srinivasan.T

  • How to merge data from SQL server to Oracle Database

    Dear Expert,
    I am having problem with SQL server with Oracle.
    Problem: I want to merge table records from SQL server to Oracle Table. Which License free tool I can use to achive the goals.
    If I able to make a free DB link from Oracle to SQL server , then we can select table and will be able to update.
    Right now I have made a DB link from SQL server to Oracle, Using that I can see the records from oracle database but I can't update them.
    Thanks,
    Sher

    Hi,
    What about using Oracle SQL Developer for migration
    http://www.oracle.com/technetwork/database/migration/sqlserver-095136.html
    HTH

  • Transfering Data from SQL Server 2 Oracle

    Hellow All,
    Even the subject is not here, but i'm trying to transfere data from SQL Server to Oracle 8 (8.0.6) .. using the Wizard that ships with MS SQL Server. All Connections (ODBC or OLE DB) are alright, but still have problems in moving Data .. and Failure.
    Failure in Data Movement and not in Table structures.
    I have tried using most of the Valid and consistent ODBC and OLE Providers from Microsoft & From Oracle... but still have problems.
    Even The Oracle Migration Assitiant from Access 97 dose not work properly.
    Any commenets please ???
    Regards
    Tariq
    null

    Anil,
    OMWB has an inbuilt collision manager, that will check for conflicting words and aptly replaces them with an alternative word.
    OMWB also allows users to change these words once you finish performing capture. In this particular case, when you capture the view with the name 'rule', you can go to the oracle model in omwb and change the name to "rule1" or anything that is desirable, preferably those words that do not conflict with the oracle d/b's reserved words.
    Regards,
    Srinivas

Maybe you are looking for

  • Posting a document using FM PRELIMINARY_POSTING_FB01

    Hello Experts, I know we can FM PRELIMINARY_POSTING_FB01 to PARK a Document. But I think we can also use this FM to Post the Document. The reason I want to use this FM, not other BAPI's, is I have all the structures (BSEG, BKPF, BSET etc) that I need

  • {990FXA GD-80 v2} Phase LED noise

    I hadn't notice this before. There is a frequency pitch that corresponds to the Phase Switching LEDs in the top right corner of the board. It isn't loud enough to be much of an annoyance and the system runs stable. My bios version is 13.1 and I've en

  • Creating Repositories using MS SQL Server DataBase in Data Service Reposito

    HI All, I installed BODS and I am trying to create repository using Data Service Repository Manager but I am getting the following error message : Cannot open connection to the repository.  The error message from the underlying DBMS is <ODBC call <SQ

  • ITunes sees no photos on new MacBook

    I just bought a new MacBook Air and transferred all of my user settings over from my old PowerBook using Time Machine. When synching my iPod Touch, iTunes says there are 0 photos in my iPhoto library. (There are, in fact, nearly 10,000.) iTunes does

  • QOSMIO X775 - 3DV80 - Win 7 64 bits UPGRADE TO WIN 8 ?

    I have read that Microsoft will no longer provide support for my Windows 7 Home Edition (original Win 7 64). What Toshiba suggest ? 1. Do I upgrade to what Win version ? 2. Do you provide step by step to do this without damaging original drivers ? 3.