×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

ODBC Connection + Oracle Database

ODBC Connection + Oracle Database

ODBC Connection + Oracle Database

(OP)
Hi,
I am using oracle database and using C#.

ODBC CODE with Oracle database:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Odbc;
using System.IO;

public void Open()
{
connection = new OdbcConnection(connectionString);
command = connection.CreateCommand();
connection.Open();
Console.WriteLine("Connnection Open");
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Odbc;
using System.IO;

public override void Insert()
{
base.Insert();

command.CommandText = "Select to_char(current_timestamp, 'YYYY-MM-DD HH24:MI:SS.FF')from dual";
Object oStartTime = command.ExecuteScalar();
StartTime = DateTime.Parse(oStartTime.ToString());/*Getting the StartTime*/
Console.WriteLine(StartTime.ToString("MM/dd/yyyy hh:mm:ss.fff tt"));

command.CommandText = "Insert into tablename (Col1, Col2, ...) Values(?, ?,...)"
command.Prepare();

for (int i = 0; i < count; i++)
{
command.Parameters.AddWithValue("?", 0);
command.Parameters.AddWithValue("?", 0);
.
.
.
command.ExecuteNonQuery();
command.Parameters.Clear();

//connection.commit();

}
}

command.CommandText = "Select to_char(current_timestamp, 'YYYY-MM-DD HH24:MI:SS.FF')from dual";
Object oStartTime = command.ExecuteScalar();
StartTime = DateTime.Parse(oStartTime.ToString());/*Getting the EndTime*/
Console.WriteLine(StartTime.ToString("MM/dd/yyyy hh:mm:ss.fff tt"));

The above code connects to my Oracle database and it populates the data,but the data which is populated is very slow when the same set of query is executed in SQL server with appropriate code change to SQL server but the concept of insertion is same.The time taken for SQL server with 10k records it takes around 5min to insert in SQL server,where it takes 8min in Oracle.What is the reason for change in time, i have used ODBC Connection for both the database.

what needs to be done here.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close