[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.6

How can I load data from Sybase into Oracle using jdbc?

Asked by tdsimpso in Oracle Database

Tags: oracle, javaload


I need to select all the data in one table located in a Sybase RDBMS and insert into a table in an Oracle RDBMS.  I can not use the Transparent Gateway because we have not purchased it and management does not have the money.  So, that leave me with using a Java/jdbc solution.

I thought I would Load the Java classes/packages that I needed into the Oracle RDBMS using JavaLoad.  Create a Java Stored Procedure to select all the data in a table located in a Sybase RDBMS and return the record set to the calling procedure so that I can perform a bulk load into a table located into Oracle.

I have figured out how to connect to the Sybase RDBMS and select the data.  Now I need to figure out how I can return the record set to the Calling PL/SQL procedure.

Any ideas how to do this?

Here is what I have come up with so far.  With this code I can connect to the Sybase RDBMS and select data from the the Sybase Table.  Now how would I return the RecordSet/Result Set to the calling Oracle PL/SQL Procedure?

import com.sybase.jdbcx.SybResultSet;
import com.sybase.jdbcx.SybConnection;
import com.sybase.jdbcx.Debug;
//import com.sybase.jdbcx.SybD
//import com.sybase.jdbcx.SybMessageHandler;
import com.sybase.jdbc2.jdbc.*;
import com.sybase.jdbc2.jdbc.SybDriver;
import java.sql.*;

public class JConnect {

      /**
       * @param args
       */
      public static void main(String[] args) {
            // TODO Auto-generated method stub
            SybConnection conn = null;
            SybStatement stmt = null;
            SybDriver drv = null;
            SybResultSet rs = null;
            Debug bug = null;
            try {
            drv = (SybDriver)Class.forName("com.sybase.jdbc2.jdbc.SybDriver").newInstance();
            DriverManager.registerDriver((Driver)drv);
            DriverManager.setLoginTimeout(5);
            System.out.println("Driver Loaded");
            
            bug = drv.getDebug();
            //bug.debug(true,"ALL",System.out);
            
            conn = (SybConnection) DriverManager.getConnection("jdbc:sybase:Tds:192.168.65.32:5500/regstr_ext","userid","password");
            
            
            stmt = (SybStatement) conn.createStatement();
            //stmt.setQueryTimeout(10);
            
            rs = (SybResultSet)stmt.executeQuery("select index_name from database.owner.table where id = '123456'");
      
            if(rs.next()){
                String value = rs.getString(1);
                  //int value = rs.getInt(1);
                  System.out.println("Fetch value: " + value);
            }
            
            //bug.println(this,"Query:" + query);
            rs.close();
            stmt.close();
            conn.close();
            System.out.println("Finished up.");
            
            } catch(Exception e) {
                  System.out.println("Exception...");
                  System.out.println(e.getMessage());
                  e.printStackTrace();
            }
            System.exit(0);
      }

}
[+][-]08/18/05 10:55 PM, ID: 14706732Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Oracle Database
Tags: oracle, javaload
Sign Up Now!
Solution Provided By: samy00001
Participating Experts: 3
Solution Grade: A
 
[+][-]08/17/05 08:14 AM, ID: 14692309Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/17/05 10:43 AM, ID: 14693883Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/17/05 12:00 PM, ID: 14694755Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/17/05 12:10 PM, ID: 14694883Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/17/05 08:51 PM, ID: 14697820Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/18/05 06:31 AM, ID: 14700114Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]08/26/05 02:44 PM, ID: 14765388Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/27/05 06:52 AM, ID: 14767861Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/27/05 07:14 AM, ID: 14767915Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/27/05 01:43 PM, ID: 14768949Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92