Slow Inserts over Internet using MFC



Hi,

I've got an MFC app, that needs about 1,5 to 2 minutes to insert 850 rows
consisting of 2 fields, into a table on an SQL Express server. The server is
accessed via odbc using its IP address.

If I trace the insert-statements using the VC debugger window, then copy
them to a query window of the SQL Express Management Studio, it takes about
15 seconds to process the same 850 inserts.
The Management Studio is on the same local pc as my app, and also connected
usinig the IP address of the remote sql server.

This would mean, using ODBC creates an 800% overhead, which I can't really
believe.

A snippet of my code:

long p;
long u,a;
ret = ::SQLAllocStmt(m_pDB->m_hdbc, &hStmt);
ret = SQLPrepare(hStmt, (unsigned char*)"INSERT INTO TABC (USERNR, ADRNR)
VALUES (?, ?)", SQL_NTS);
if (ret == SQL_SUCCESS || ret == SQL_SUCCESS_WITH_INFO)
{
SQLBindParameter(hStmt, 1, SQL_PARAM_INPUT, SQL_C_SSHORT, SQL_INTEGER, 0,
0, &u, 0, &p);
SQLBindParameter(hStmt, 2, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0,
&a, 0, &p);

for(i=0; i<=list->GetUpperBound(); i++)
{
u = m_pPointer->GetUSERNR();
a = list->GetAt(i);
ret = SQLExecute(hStmt);
}
}

As you can see, I'm preparing the statement and at least trying to avoid
unnecessary overhead.
Does anyobody have an explanation for this behaviour and maybe a solution?

Thanks a lot,

Thomas


.



Relevant Pages

  • RE: Fulltext failure on a 2 node cluster
    ... Server full-text search resource online: "SQL Cluster Resource 'Full Text' ...
    (microsoft.public.sqlserver.clustering)
  • Re: HELP PLEASE ~ ???
    ... You mentioned that it went ahead and added a SQL ... SQL Server 2000 database for all my data. ... find the connectionString in the newly recreated SQLExpress database. ... The connection string specifies a local Sql Server Express instance ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Multi-Channel Raid VS SAN Storage
    ... A 5~6 years old server is a very old server. ... As I mentioned, the server is one node in a cluster environment, and SQL is ... We actually are running RAID 1+0 and our aplication is definately more ... needs it's own SAN device, or at least a dedicated IO channel on the SAN. ...
    (microsoft.public.sqlserver.setup)
  • RE: How do I get back to base SQL server on my SBS 2003 server?
    ... After you uninstall SQL 2005, the instance which you upgraded will not go ... Uninstall and then reinstall ISA server. ... Uninstall and then reinstall the Monitoring component. ... Tools to Maintenance, change Monitoring component to Install, and then ...
    (microsoft.public.windows.server.sbs)
  • Re: Multi-Channel Raid VS SAN Storage
    ... A 5~6 years old server is a very old server. ... As I mentioned, the server is one node in a cluster environment, and SQL is ... We actually are running RAID 1+0 and our aplication is definately more ... needs it's own SAN device, or at least a dedicated IO channel on the SAN. ...
    (microsoft.public.sqlserver.setup)