Results 1 to 2 of 2

Thread: Help Needed

  1. #1
    Join Date
    Mar 2006

    Red face Unanswered: Help Needed

    Hi, I'm developing a project where i need to copy whatever Sybase has in its Database, directly into Oracle... the restriction is that i have to do this via a JAVA program, i have the Oracle and the Sybase classes and is as follows;
    my code compiles, and it gives you back a Resultset for whatever you want column you want, and here comes the tricky part, which is the part I'm stuck on, how can i manipulate a Resultset in a way that i can export that information into an oracle database, do i need to create a repository table? or what else can i do?? because i can get it to display it but i need it to go into to Oracle... any suggestion would be nice, can anyone help??? thanx in adavanced for your help.

    package sybaseoracle;

    import java.sql.*;
    import com.sybase.jdbcx.*;
    import com.sybase.jdbc3.tds.*;
    import com.sybase.jdbc3.jdbc.*;
    import com.sybase.jdbc3.timedio.*;
    import com.sybase.jdbc3.utils.*;
    import java.util.*;
    import java.sql.ResultSet;

    public class SybaseMainClassRS {

    private static final String Make = "create table Test ( " + " id INT PRIMARY KEY, firstName VARCHAR(20), lastName VARCHAR(20), " + " title VARCHAR(20), salary VARCHAR(20) " + ")";

    public static Connection getConnection() throws ClassNotFoundException, SQLException {
    String driver = "com.sybase.jdbc3.jdbc.SybDataSource";
    String url = "jdbc:sybase:Tds:W2VZ2DTT02:5000/testsybase";
    String username = "sa";
    String password = "";
    Connection conn = DriverManager.getConnection(url, username, password);
    return conn;

    public static void main(String args[]) {
    Connection conn = null;
    Statement stmt = null;
    try {
    conn = getConnection();
    stmt = conn.createStatement();
    stmt.executeUpdate("insert into Test(id, firstName, lastName, title, salary) values(100, 'German', 'Garcia', 'Analyst', '3000')");
    stmt.executeUpdate("insert into Test(id, firstName, lastName, title, salary) values(200, 'German', 'Grajeola', 'Architect', '5000')");
    System.out.println("Table Created.");
    } catch (ClassNotFoundException e) {
    System.out.println("error: failed to load Sybase driver.");
    } catch (SQLException e) {
    System.out.println("error: failed to create a connection object.");
    } catch (Exception e) {
    System.out.println("other error:");
    try {
    stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery("SELECT id FROM Test WHERE id = 200");
    while ( {
    } catch (SQLException e) {
    System.out.println("Missing Query Statement");
    } finally {
    try {

    } catch (Exception e) {
    System.out.println("Can't close the connection");

  2. #2
    Join Date
    Jan 2005


    I thing may help you.
    As I know with that you can convert tables to java classes and xml from databases

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts