OutOfMemoryException error
Posted: Wed 11 Feb 2009 06:48
Hi there! I'm a newbie at this, so first I apologize if my question is too naive.
I have used the code below together with C# (VS 2005)
/* create Oracle Connection String */
OracleConnectionStringBuilder oraCSB = new OracleConnectionStringBuilder();
oraCSB.Server = "10.164.81.131";
oraCSB.Port = 1521;
oraCSB.Sid = "GL61";
oraCSB.UserId = "databaseuser";
oraCSB.Password = "manager";
//oraCSB.MaxPoolSize = 150;
//oraCSB.ConnectionTimeout = 30;
OracleConnection vinax_connect = new OracleConnection(oraCSB.ConnectionString);
/* open Oracle Connection */
vinax_connect.Open();
OracleCommand cmd = vinax_connect.CreateCommand();
cmd.CommandText = "SELECT * FROM TABLE_1 WHERE SALES_KEY = '" + textBox1.Text.Trim() + "'";
DataSet testDataSet = new DataSet();
OracleDataAdapter myAdapter = new OracleDataAdapter(cmd.CommandText, vinax_connect);
myAdapter.Fill(testDataSet, "Table");
vinax_connect.Close();
dataGrid1.DataSource = testDataSet.Tables[0];
textBox1.Text = "";
Here's my problem : The above sometimes returns a OutOfMemoryException error on the myAdapter.Fill(testDataSet, "Table") statement. I have several databases (all having the same table with different amounts of data) and by changing the connection String parameters, I can rerun the same program for multiple databases. Some of these work ok while others return the OutOfMemoryException. I've tried controlling the FetchSize parameter but it does not seem to work. The databases are all Oracle 10g, so I really don't get this issue. Is there any additional setting that I have to set?
Thanks in advance
I have used the code below together with C# (VS 2005)
/* create Oracle Connection String */
OracleConnectionStringBuilder oraCSB = new OracleConnectionStringBuilder();
oraCSB.Server = "10.164.81.131";
oraCSB.Port = 1521;
oraCSB.Sid = "GL61";
oraCSB.UserId = "databaseuser";
oraCSB.Password = "manager";
//oraCSB.MaxPoolSize = 150;
//oraCSB.ConnectionTimeout = 30;
OracleConnection vinax_connect = new OracleConnection(oraCSB.ConnectionString);
/* open Oracle Connection */
vinax_connect.Open();
OracleCommand cmd = vinax_connect.CreateCommand();
cmd.CommandText = "SELECT * FROM TABLE_1 WHERE SALES_KEY = '" + textBox1.Text.Trim() + "'";
DataSet testDataSet = new DataSet();
OracleDataAdapter myAdapter = new OracleDataAdapter(cmd.CommandText, vinax_connect);
myAdapter.Fill(testDataSet, "Table");
vinax_connect.Close();
dataGrid1.DataSource = testDataSet.Tables[0];
textBox1.Text = "";
Here's my problem : The above sometimes returns a OutOfMemoryException error on the myAdapter.Fill(testDataSet, "Table") statement. I have several databases (all having the same table with different amounts of data) and by changing the connection String parameters, I can rerun the same program for multiple databases. Some of these work ok while others return the OutOfMemoryException. I've tried controlling the FetchSize parameter but it does not seem to work. The databases are all Oracle 10g, so I really don't get this issue. Is there any additional setting that I have to set?
Thanks in advance