473,386 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Incredibly Slow DB Connection

LacrosseB0ss
113 100+
Hello All;

I have the following code in php. It was working fine up until last week or a bit before then the speed came to a grinding halt. Now when the page tries to load it gets stuck in the loop below. There are ~2500 records in the table (SQL database, not access).

Weird thing is, we have asp applications that run off this database also and they are fine. I copied the query into Query Analyzer and it produced all results within 2 seconds. Anyone have any idea why it times out after a full minute with only ~70% of the results?

Expand|Select|Wrap|Line Numbers
  1. $dbuser="otsuser";
  2.     $dbpass = $dbuser; 
  3.     $dbdsn = "Qualification Data";
  4.     $con = odbc_connect($dbdsn, $dbuser, $dbpass) or die("Unable to connect to $dbdsn Database");
  5.     $query = "select Emp_Id, Fname, Lname from employee WHERE Fname NOT LIKE 'Department' order by Fname, Lname";
  6.  
  7. $result = odbc_exec($con, $query);
  8.     if ($result){
  9.         $count = 0;
  10.         while ( odbc_fetch_row($result) ){
  11.             $emp_id = odbc_result($result, "Emp_Id");
  12.             $fname = odbc_result($result, "Fname");
  13.             $lname = odbc_result($result, "Lname");
  14.             $fullName = $fname." ".$lname;
  15.             $emp_ID[] = $emp_id;
  16.             $emp_NAME[] = $fullName;
  17.             $count = $count +1;
  18.             echo "<br />" . $fullName; //testing purposes
  19.         }
  20.     } 
  21.  
We have tried resetting the server, but that did not help. Also we are pretty sure it is not DB related. Thanks in advance for replies providing any insight
- LB
Dec 5 '06 #1
2 1777
steven
143 100+
Are you closing the db connection when you're finished with it or does this code use persistant connections?

Nothing really stands out in your code, that I can see anyway.
Dec 6 '06 #2
LacrosseB0ss
113 100+
At the time I posted this yesterday, the connection wasn't being closed. We've started investigating this issue. To answer your question, the code timed out before getting to a spot where the connection could be closed, but no it wasn't closed anyway.

A semi-related question(s) then: If the code dies or a connection is left open, how long will the database connection remain open for? And, if another application that uses the database opens a connection without closing it, will it slow this one down? Is there a way to check if it's open before opening it?

Ok, so there was 3 questions. We're just out of options here. Sorry folks. Thanks for the reply though.
- LB
Dec 6 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: drife | last post by:
Hello, I need to calculate the eigenvectors and eigenvalues for a 3600 X 3600 covariance matrix. The LinearAlgebra package in Python is incredibly slow to perform the above calculations...
16
by: mamo74 | last post by:
Hello. I am administering a SQL Server (Enterprise Edition on Windows 2003) from some month and can't understand what is going on in the latest week (when the db grow a lot). The DB is around...
5
by: Carlos Moreno | last post by:
Hi, I'm experiencing some really odd behaviour after upgrading to postgresql 7.4.1 We have three different machines: 1) Dual Athlon, 1GB RAM running RedHat 7.3 with all the updates...
0
by: NuB | last post by:
I have a asp.net web application that connects to a database server that is located outside of our building. When I run the web app the initial connection to the database is slow ( around 30-35...
4
by: frizzle | last post by:
Hi group. I have a news management system, with a mySQL backend. I tested it yesterday with 1.000.000+ records, testing my url system. I pulled out records calling them by the url field. It was...
0
by: Michal Seidl | last post by:
Hi, I am trying to download data from remote ftp server connected through GSM modem. The speed is slow 1kB/s. Despite the classic linux ftp client works fine the ftp.retrbinary(),ftpretrlines()...
3
by: jku | last post by:
Hello, after installing DB2 V8.2.3 on OpenSuse 10.1 (in vmware) we have created a database instance with the restore command: db2 "restore database $OLD_DB user db2inst1 using db2inst1 from...
0
by: m.gelosa | last post by:
Hi all, Did anyone experience slow TCP connections with db2 v8.2.7 on AIX 5.3 (5300-05-05). I installed the fixpak to solve the db2ckpwd memory leak, but since then the connection to the...
1
by: GatorDBA | last post by:
Hey Folks, Experiencing strange problem with SQL 2005 running on Windows Server 2008. When trying to connect via named pipes or tcp, it takes 25-45 seconds for the connection to be established....
1
by: smartic | last post by:
users having slow connection view the site very slowly and when they register on any site they make refresh if the page take to long to redirect, in this case they send the data twice in the DB, how...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.