aspose file tools*
The moose likes JDBC and the fly likes why db is taking so long time to respond ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "why db is taking so long time to respond ?" Watch "why db is taking so long time to respond ?" New topic
Author

why db is taking so long time to respond ?

naved momin
Ranch Hand

Joined: Jul 03, 2011
Posts: 692

i have coded my final year project which is a bussiness management system which process a lot of database work but my problem
suppose you want to add a new employee to the database you will fill the correct details and then you will click on submit which will submit the details into the database but the thing is after you clicked on the submit button it takes actually 10 to 11 sec to do this work and same when you retrieve the employee details from the system it again took 10 to 12 minutes to retrieve just the details

so where exactly it is taking huge time , in connecting to the database or at the time of retrieval of info from the db
can you help me so that my processing work will be as fast as possible


this was just the sample db i was checking with i have to code the full BMS db for my project


The Only way to learn is ...........do!
Visit my blog http://inaved-momin.blogspot.com/
Daniel Doboseru
Ranch Hand

Joined: Sep 26, 2011
Posts: 57
Well, there could be many causes for your very big delays. But first, some things must be clear to rule out obvious reasons. I suppose you don't have many entries, regarding is just an educational project, then, you use an application to consume the database, is it locally, or remote? Which DBMS you use for mantaining it? If you run the queries from within, still takes that long for the results?
naved momin
Ranch Hand

Joined: Jul 03, 2011
Posts: 692

Daniel Doboseru wrote:Well, there could be many causes for your very big delays. But first, some things must be clear to rule out obvious reasons. I suppose you don't have many entries, regarding is just an educational project, then, you use an application to consume the database, is it locally, or remote? Which DBMS you use for mantaining it? If you run the queries from within, still takes that long for the results?


i m using ms sql server 2005 in my home pc , local ,...and in sql server the quaries run fine but in ide's the quaries are dam slow even if i go to print just
empid empname
1 naved

for this much it takes the time which i have told you in my earlier post
anything else can i provide you ?
can you tell me why it is dam slow
Daniel Doboseru
Ranch Hand

Joined: Sep 26, 2011
Posts: 57
Well, if in SQL queries run fine, then the problem is definetely in the IDE. I'm not an expert at benchmarking, but basically is something la this:

Initiate connection -- (time1 - establishing connection) -- Connected; Send query -- (time2) -- Processing the query on the DB; Generating response -- (time3) -- Processing response in the IDE.

Now, from experience I can tell that time1 is likely to be the problem. Anyways, a quick check could be done by using some println() messages in the console, just after initiating the connection, then after the connection is done, then when the query is sent and of course when is received. That way you can see which one takes longer to appear, so could locate the problem.
But still, I'm betting on time1, so could you please provide more info about the driver used and the connection statement which you used?
naved momin
Ranch Hand

Joined: Jul 03, 2011
Posts: 692

Daniel Doboseru wrote:Well, if in SQL queries run fine, then the problem is definetely in the IDE. I'm not an expert at benchmarking, but basically is something la this:

Initiate connection -- (time1 - establishing connection) -- Connected; Send query -- (time2) -- Processing the query on the DB; Generating response -- (time3) -- Processing response in the IDE.

Now, from experience I can tell that time1 is likely to be the problem. Anyways, a quick check could be done by using some println() messages in the console, just after initiating the connection, then after the connection is done, then when the query is sent and of course when is received. That way you can see which one takes longer to appear, so could locate the problem.
But still, I'm betting on time1, so could you please provide more info about the driver used and the connection statement which you used?




now please help to reduce this time to atleast 2 to 3 sec
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Why are you using an ODBC connection if you want good performance?
naved momin
Ranch Hand

Joined: Jul 03, 2011
Posts: 692

Tim Moores wrote:Why are you using an ODBC connection if you want good performance?

so which driver should i use for good performance ?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18662
    
    8

naved momin wrote:so which driver should i use for good performance ?


How about the one commented out in line 3 of the code you posted?
naved momin
Ranch Hand

Joined: Jul 03, 2011
Posts: 692

Paul Clapham wrote:
naved momin wrote:so which driver should i use for good performance ?


How about the one commented out in line 3 of the code you posted?

getting an exception , note that i have set the path in the environment variable but still it not working can you help ?

[/code]
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18662
    
    8

You'll need to get the jar which contains the driver and make sure the jar is in your classpath.

Also make sure you don't confuse the path with the classpath.
naved momin
Ranch Hand

Joined: Jul 03, 2011
Posts: 692

Paul Clapham wrote:You'll need to get the jar which contains the driver and make sure the jar is in your classpath.

Also make sure you don't confuse the path with the classpath.

ya i have to write classpath in the path name in the environment variable right ? i have done that
and i have also added jar to libraries which is called as Junit 3.8.2 - junit 3.8.2.jar , Junit 4.5 - junit 4.5.jar
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18662
    
    8

There are several ways to set the classpath.

I don't know what's in your classpath, but if your last post was meant to contain useful information, let me just say the the JDBC driver you are trying to use will not be in any of those JUnit jars.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why db is taking so long time to respond ?