copy access tables to oracle

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • igurov
    New Member
    • Jun 2008
    • 7

    #1

    copy access tables to oracle

    Hi, I want to copy access tables to oracle database.
    Till now I have opened the connections to both of them.
    Can anyone explain me what are the next steps?
    Here is the code that I wrote till now:


    String connString = "User Id=******* ;Password=***** ** ;Data Source=******* ";
    String connString2= " Provider=Micros oft.Jet.OLEDB.4 .0;Data Source=E:\\temp .mdb" ;

    OracleConnectio n oraConnection = new OracleConnectio n(connString);
    DbConnection accessConnectio n = new OleDbConnection (connString2);

    // openning the oracle connection
    try
    {
    oraConnection.O pen();

    Console.WriteLi ne("\nHello, Oracle Here!\n");
    Console.WriteLi ne("Connection String: ");
    Console.WriteLi ne(oraConnectio n.ConnectionStr ing.ToString() + "\n");
    Console.WriteLi ne("Current Connection State: ");
    Console.WriteLi ne(oraConnectio n.State.ToStrin g() + "\n");
    Console.WriteLi ne("Oracle Database Server Version: ");
    Console.WriteLi ne(oraConnectio n.ServerVersion .ToString());
    }
    catch (Exception ex)
    {
    Console.WriteLi ne("Error occured: " + ex.Message);
    }
    finally
    {
    if (oraConnection. State == System.Data.Con nectionState.Op en)
    {
    oraConnection.C lose();
    }
    }




    //openning the access connection

    try
    {
    accessConnectio n.Open();
    Console.WriteLi ne("\nHello, Access Here!\n");
    Console.WriteLi ne("Connection String: ");
    Console.WriteLi ne(accessConnec tion.Connection String.ToString () + "\n");
    Console.WriteLi ne("Current Connection State: ");
    Console.WriteLi ne(accessConnec tion.State.ToSt ring() + "\n");
    Console.WriteLi ne("Microsoft Access Version: ");
    Console.WriteLi ne(accessConnec tion.ServerVers ion.ToString()) ;

    }
    catch (DbException e)
    {
    Console.WriteLi ne( "Unable to open database:" + e.Message);

    throw;
    }
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    How often are you going to be doing this?
    Are you going to be copying the same table everytime?
    Do the source/destination tables have any special columns?

    The easiest method is to get all data from source table into some structure (e.g ArrayList for argument's sake) and then copy from that structure to the destination table.

    Comment

    Working...