|
-
Nov 7th, 2003, 02:45 PM
#1
Thread Starter
Junior Member
Sybase 10 & .net & ODBC
Hi all folks
I have the next problem:
I made an application in .net, it is C#, which the main objective is to execute several stored procedures at the same time, and it works. But i had proof this application with a stored procedure which inserted about 40000 registers, and it worked.
So i decided run the application with the real application which it has to work, and it fails, it raises an error; this is the error:
ERROR [HYT00] [INTERSOLV] [0DBC SQL Server driver] [SQL Server] ct_results(): user api layer: internal Client Library error: Read from the server has timed out.
The stored procedured is executed but not completely.
I'm working with framework.net; Odbc.net and Sybase 10.
The strange thing is that i have proof the same Stored procedure with VB6 and also Odbc and it works very well.
I run the stored procedure in a query analizer and it works wery well, it seems that the problem is Odbc.net ot .net
I have proof the stored procedure with Thread and also without thread object and it happens the same thing in both cases.
The stored procedure execute a lot of instruction, inserts, updates, transactions, and also execute other five stored procedures which one of them execute a bat file (with internal sybase stored procedure xp_cmdshell), this bat file (file.bat)
updates some tables, and execute other application which communicate with another application in another server througth a socket, this is a very very large stored procedure.
This is my code in C#.
Code:
/* Para compilar creando un exe
* csc /nologo /out:ThreadPrueba.exe /r:Microsoft.Data.Odbc.dll ThreadPrueba.cs
*/
using System;
using System.Data;
using System.Threading;
using Microsoft.Data.Odbc;
internal class ClaseEjecutar
{
public void ejecutarFuncion()
{
OdbcConnection conexion;
OdbcCommand comando;
string strConexion = "";
string strComando = "";
//int elementos = 0;
OdbcDataReader dataReader;
strConexion = "DSN=BANCA10;Uid=BEMPRE;pwd=BEMPRE";
strComando = " { call sp_procesa_nomina_proof2 } ";
try
{
conexion = new OdbcConnection(strConexion);
conexion.ConnectionTimeout = 6000;
comando = new OdbcCommand();
comando.CommandText = strComando;
comando.CommandType = CommandType.StoredProcedure;
comando.Connection = conexion;
conexion.Open();
Console.WriteLine("Ejecutando Stored Proedure sp_procesa_nomina_KRNuevo ...");
dataReader = comando.ExecuteReader();
Console.WriteLine("Se terminó de procesar nómina ");
Console.WriteLine("\n\n");
while (dataReader.Read())
{
Console.WriteLine(dataReader.GetString(0));
}
dataReader.Close();
conexion.Close();
}
catch (OdbcException oExc)
{
Console.WriteLine(oExc.Message.ToString());
}
catch (Exception e)
{
Console.WriteLine(e.Message.ToString());
}
}
}
public class ThreadPrueba
{
static public int Main(string[] args)
{
ClaseEjecutar objeto = new ClaseEjecutar();
Thread miThread = new Thread ( new ThreadStart(objeto.ejecutarFuncion) );
miThread.Start();
Console.WriteLine("La funcion Main() acaba de llamar la funcion que ejecuta el SP.");
return 0;
}
}
Well i hope someone be able to help me, i really really will thank.
Regards.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|