Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ODBC_connect slow

Status
Not open for further replies.

QatQat

IS-IT--Management
Nov 16, 2001
1,031
IT
Hi there,

I have developed a reporting utility that will need to be installed on different systems and platforms.

Because the database may be either MsSQL or MySQL I wanted to give users a chance to specify a DSN, username and password and fire it up.

Now if I use odbc_connect() with MSSQL server it performs considerably faster than MySQL. Sometimes MySQL stops executing the query and times out (after 30 sec).

I tried to use mysql_connect() and it performs faster than MSSQL, as I expected.

Is there any issue about ODBC and MySQL that I am not aware of?


thank you.

Qatqat



Life is what happens when you are making other plans.
 
You mean besides the fact that by its very nature, ODBC has an enormous amount of code and resource overhead and because of that its performance sucks? Not much.


I recommend that whenever possible a programmer should use native communications libraries when writing code to interact with database servers. On Linux, I have written code at one time or another which interacted with MySQL, PostgreSQL and MSSQL using the mysql_*, pg_* and mssql_* families of functiosn respectively.

Now I've never had to write software that, depending on configuration, might have to interact with one of many database servers. But I have examined code that does. In all cases, the programmers either used class factories or dynamically-included libraries to insure that a single call to a user-defined function could contact, depending on configuration, the required datbase server.

The only cases in which multidatabase PHP code has used ODBC is when a database-specific function family was not available.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Thanks sleipnir214 for your posting.

I do not know on what platform this utility is going o be istalled; being a government tool, some departments will run windoz version of php connecting to MSSQL, some other will run linux connecting to MySQL, other will have a hybrid, linux to sql server. I thought therefore that ODBC could offer me the versatility I was looking for.

I also found out that freeDTS can give a lot of problems to compile on linux, so not many departments will have it configured properly.

I think I will have to add a bit more code to detect the database and use native libs as you suggest.


Thanks a lot


Qatqat

Life is what happens when you are making other plans.
 
That's interesting that you've seen FreeTDS problems when compiling on Linux. I've installed FreeTDS many times to use PHP's mssql_* family of functions on Linux and never had a problem.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
I have freeDTS running perfectly on my box, the problems have been reported by network guys in regional offices. Apparently they do not have all needed libraries.


I work in Southern Africa and linux knowledge at least in the gov sector is still not very advanced.
I do not have time to go and configure RH boxes around myself, neither I want to.
I have also tested apache2/php5 on windoz platform with the same results, MySQL is very slow on ODBC connection while MSSQL seems to like ODBC. It must be a Microsoft thing.

Thanks again for your time.

Qatqat

Life is what happens when you are making other plans.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top