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;
}
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;
}