Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Database Connection Limits?


I am in big confusion right now plz tell me one thing with explaination.

Situation is:

I have a script in that i am using database connection and some database operation. 10 users are accessing this script same time.

what happen is there 10 connection to database sever or there will be only one connection?? if there would be 10 connections then what is the max limit of mysql.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Database Connection ?
I am very new to PHP...Can i get the starting code for connecting to database....how to open the connection...what is the connectionstring ?

Database Connection
<?php

I have a question about 2 connection strings to a ms sql database.

# TEST DATABASE

$connecttest = MSSQL_CONNECT("TEST", "sa", "123456") or exit("Unable to
connect to MS SQL Server at 10.0.10.58");

$select = mssql_select_db ("database1",$connecttest) or exit("Unable to
select database TEST");

# PRODUCTION DATABASE

$connectprod = MSSQL_CONNECT("PROD", "sa", "654321") or exit("Unable to
connect to database at 10.0.10.59");

$select = mssql_select_db ("database2",$connectprod) or exit("Unable to
select database PROD");

$SQL = "SELECT * FROM table1";

$RESULT = mssql_query($SQL);

// What data will i find here? Is it data from the TEST or from PROD and
will it be data from database1 or from database 2?

?>

Connection To Database
Running RH8 and have installed mysql, apache, php. I have pypmyadmin working fine, adding and editing databases.. but when I try to get a form (to enter data) its does not connect or just sumbits as if all was ok but nothing happend.

Class For Database Connection
Can anyone tell How to write class for database connection in PHP . Class must provide a general function for executing queries.

Closing A Database Connection
for my php site, i open a mysql connection for each page cause most of my pages uses some data from the database. however, i did not close the mysql connection - will this have any bad effect to my database? or is it better to have all connection closed once my php script is finished?

Database Connection Problems?
I am all new to php/mysql and was wondering if someone might help me
out on a little problem that I am having.
It must be something very simple that I am missing, it seems that I am
having trouble connecting to the database, yet all of my information
seems to be correct - the error is as follows:

Parse error: parse error in
/data/members/free/tripod/uk/t/h/e/theresearcher/htdocs/scripts/conf.inc.php
on line 6
the error repeats twice.

Line 6 in my conf.inc.php states:
$mysql_database='theresearcher_uk_db'

I have enabled both php and mysql twice just to be sure. Hostname
localhost is correct. Double checked the database name. No password is
required so i left it blank. (should I take the line out alltogether?)
I dont know what to do about the port..lycos didnt say anything about
it so I left it blank. The table prefix I am not sure of either.

Here is the surrounding code:
$mysql_hostname='localhost'
$mysql_port=''
$mysql_user='theresearcher'
$mysql_password=''
$mysql_database='theresearcher_uk_db'
$mysql_table_prefix=''
$mysql_pconnect="NO";
$pages_dir='/data/members/free/tripod/uk/t/h/e/theresearcher/htdocs/'
$pages_url='http://members.lycos.co.uk/theresearcher/pages/'
$scripts_dir='/data/members/free/tripod/uk/t/h/e/theresearcher/htdocs/;
$scripts_url='http://members.lycos.co.uk/theresearcher/scripts/'

Connection To Database Or Die Message
When connection to the database fails I would like to include an email link in the response message, but I need help with how it can be done.  Below is my code and I want the error message text to include a Report This email html link. Code:

Php Mysql Database Connection
i want to add my form details to the mysql database. i had done it with mysql_connect('localhost','root',''); but the error was localhost connection failed. Code:

PHP MySQL Database Connection
I'm involved in a project where I have to create a web application with PHP and MySQL. My question is, usually we use one user name and password to connect to the database for the whole application, in which case all the users will connect to the database with that username we set in PHP script.

If we want to have different users with various access rights on the database this strategy will not work, because we give one username and give maximum access rights for that username. Is there any way where you can define the access rights of a user in the database(MySQL) and use the same username and password when the user connects to database through PHP application?

If so, we will have hundreds of users connecting through the PHP application with different usernames and password, will this have any impact on the web server or DB server? Is it secure? Is there any other way this can be done?

PHP/MySQL Database Connection Problem
when I'm doing an insert (using mysql database) it produces the following two error messages :

Warning: MySQL: Unable to save result set in [file].

Lost connection to MySQL server during query

These errors occur after the number of conncections increases, before this there is'nt any problem.

I am using PHP 4 with Apache on Redhat Linux 6.2.

How To Make A Database Connection Available To All Pages?
How can I make a database connection available to all the pages in my
application? I tried doing it with session but it doesn't seem to work.

here's what a did:

What Is Going Wrong In The Database Connection With PHP MYSql
I am setting up a site for a client that requires signup and
login. I have written most fo the code but, for some reason am
have trouble with the database connection. The problem is with
the connection. I believe I have the right server but, have had
trouble getting the correct iser and password. Is there a way to
determine what is going wrong in the connection because
setting up die with a message doesn't tell me anything other
than the connection failed. I going back to client and getting the
support # from yahoo who set up the server and database.

Hopefully I can talk to the person who set up the server for him
and get the proper server, user and password. It would be nice
to know how to troubleshoot the connection in a more
meaningful way.

No Luck Making A Database Connection
I've included db.php into my script, and this is all it contains:

$host = 'localhost'
$username = '***'
$password = '***'
$database = '***'
$connection = mysql_pconnect($host, $username, $password);
$mysql_select_db($database, $connection);

obviously with the other fields filled out.

My webhost tells me to use this script:

$dbh=mysql_connect ("localhost", "<USERNAME HERE>", "<PASSWORD HERE>") or
die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("<TABLE NAME>");

neither one of these methods work, actually - I get this error:
[the contents of my db.php file here, in plain text!]No Database Selected

Database Class: Closing Connection
I am just learning OOP in PHP and I decided making a DB class would be a good start for my first real type of OOP class. Everything is working fine but I am having problem's closing the connection. I was wondering if anyone can see what the problem might be if it is in the coding. database.class.php PHP Code:

Hiding Database Connection Info
In a php script, I have to connect to a remote mysql database. I'm a bit
worried that some user might be bale to retrieve the source of the page and
see the user name and password to connect to the db.

Is this resonable? What's the best way to avoid it?

ADODB Multiple Database Connection
I'm using ADODB for a PHP project and am having problems with multiple (MySQL) databases. I've looked through all the docs and am stumped. I know how to use PHP and MySQL and I still haven't got a clue why this isn't working. Code:

How Do I Connect To A .mdb (access) Database With A Dsn-less Connection Using Php4?
I need to connect to an Access database without a dsn. Can you give me an example (a simple table display with a while !rs->eof)

Using Global Variables In The Database Connection String
I'm sure this has been asked a million times but I can't seem to
formulate a google search that returns what i'm looking for.

I've go a dev and live environment. Currently the DB connect string is
hard coded into each php file which means i'm going to have to change
every page - Arrgh!!

If i put the DBonnect into a function and store it in an include file,
it doesn't seem to work, Also the connetion works with inline PHP
statements, but I have to repeat it in every function even if they are
in the main php file??? which doesn't seem right to me..

I need to either :-

Store the connection variables in an include file and retrieve them as
global values

OR

Store the connection string in a function in an include file which can
be accessed by all functions.

also do I really have to call the dbconnect inside every function.

Please note, if it makes any difference, I still havn't got my head
round OO programming in PHP so it is still pretty much procedural. I
am using PEAR but dont really understand (or care at the moment) about
what it is doing.

Connect To Foxpro 2.6 DOS Database Using Php Odbc Connection.
The driver that I use in ODBC Data Source Administrator is Microsoft dBase Driver (*.dbf). Is it correct. Code:

Preg_match_all Has Some Limits?
i'm trying to replace a picture inside an RTF file.

I have found that this is the format the picture is described inside RTF:

{*shppict{pictpicscalex80picscaley80piccropl 0piccropr0piccropt0piccropb0picw800pich600pi cwgoal12000pichgoal9000jpeglib
....some binary data...}}

RTF file is about 3,9MB and this expression "{*shppict{pict(.*?)}}/"

doesn't return anything that i can change.

My wish is to change attribute of the string that I have paste on the
top and obviously change binary data!

Errors - Putty.exe (telent Connection To Mysql Database)
The following code produces an error when I try to run it under
putty.exe (telent connection to mysql database). Can anyone identify
the error in the code? The server is running PHP5.


DELIMITER ;;
/*!50003 DROP PROCEDURE IF EXISTS `aaa` */;;
/*!50003 SET SESSION
SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER"*/;;
/*!50003 CREATE PROCEDURE `aaa`()
begin
declare iTest int;
set iTest = 5;
end */;;

Check If Database Exists Even If Connection Credentials Are Incorrect..
How can I check if database exists even if the connection credentials are incorrect?

Xml Parsing (SAX) Buffer Limits
Is there any good documentation of what sort of input buffer limits there
are for the expat parser used by PHP? I found out (by accident) that my
webhosting service's version has a 1024 byte limit.

PHP5: Memory Limits Not Available?
I've been googling all day and I haven't seen anyone else having this
problem, so I thought I'd check to see if I'm unique or I should be
expecting this behavior.

I've recompiled and reinstalled my PHP SO for Apache with the configure
flag "--enable-memory-limit" I'm running Apache 2.0.52 and PHP 5.0.3
(on FreeBSD 5.3). After restarting Apache with the new PHP SO in
place, I checked phpinfo(). The "configure line" does, in fact, show
"--enable-memory-limit" as one of the many configure options. However,
I've heard that there might also be a section or indication of memory
limit further down in the phpinfo() page. I don't see anything (the
only time the word "memory" shows up on the page is for the configure
line)--not even the php.ini settings are shown in the table.

I've checked the PHP 5.0.4 changelog and there is no indication that
they touched the memory limit code. There are currently no submitted
bugs regarding memory limits. I also haven't found any indication that
this function might not be available in the Apache module form of PHP.

The most important problem I'm having is that the memory_get_usage()
function is not available. I'm trying to write a small benchmarking
script to help generate statistics to compare scaling with large
amounts of database activity. I hope to prove that my technique is
faster and uses less memory than an existing piece of code. I've toyed
with the idea of reading the memory usage for the entire process using
ps, but that seems to scew things since, in addition to my script,
there's also a PHP interpreter with a bunch of overhead along with
whatever resources were necessary to open the shell and run

Table Limits (MySQL)
I made a database of links. I now have a real long list of links when I list them on a page, I was wondering if there was a way to limit this list within a table. Basically instead of having a long list of 30 links, I would like a table with three columns of ten. Is there any way to do this with PHP and/or MySQL.

Database Connection Problem In Included File On Root Directory
I have a file called tophtml.php that connects to the database. It's in the root directory of the site. It works perfect in the root directory. But if I call it in a sub directory. (e.g. require("../tophtml.php") or require("C:websitesdogrealm ophtml.php")) I get errors saying it can't connect to the database.

Resize Image And Memory Limits
I've to resize uploaded images with the "imagecopyresampled" but when I've
images quite large (common those days) I reach the 16mb limits of the ISP.

How can I fix this ? I absolutely need to resize such images.

How Do I Hide Database Connection Files Using PHP Include Files?
I have the following at the beginning of the PHP page:

<?php require_once('Connections/conn.php'); ?>

I want to hide the connection file, "conn.php", so it's out of the web
accessible file structure. I understand putting them in the php include
directory shoudl do this. For example, let's say the directory I put them
in is /www/phpIN/, and /www/ht/ is the root web directory.

So I put "conn.php" in the inlcude directory (/www/phpIN/conn.php) and
removed it form CONNECTIONS directory.

How Do I Hide Database Connection Files Using PHP Include Files?
I have the following at the beginning of the PHP page:

<?php require_once('Connections/conn.php'); ?>

I want to hide the connection file, "conn.php", so it's out of the web
accessible file structure. I understand putting them in the php include
directory shoudl do this. For example, let's say the directory I put them
in is /www/phpIN/, and /www/ht/ is the root web directory.

So I put "conn.php" in the inlcude directory (/www/phpIN/conn.php) and
removed it form CONNECTIONS directory.

Now it doesn't work.

What do I need to change?

DB Connection Handling - I Get "too Many Connection" - What's The Solution?
I have a php-webpage that needs the database in the beginning and in
the end of the script. In the middle there is a lot of processing that
takes several seconds - during that time I don't use the database
connection.

What is the best approach? Should I close the connection after I'm
done with it OR should I reuse the connection thru my whole script?

Where can I read more about this? Any pointers?

Today I'm using the same connection thru my script. And sometimes I
get an error from the database "too many connections". What does that
mean? My webserver provider says that I have at least 100 connections
to play with. How come I get this error?

Raw SSL Connection
I need to send (not post, just send) some string to an SSL server. This is nog a SSL enabled webserver, but a pure SSL-server wich doensn't understand HTTP. Therefor I think I need to make a SSL socket connection and fwrite() the string to the socket. The SSL-server performs certificate authorisation, so I need to send my certificate and private key with the string.
As far as I understand, PHP can't to this so I need to perform the ssl handshake myself with some openssl functions, then ssl encrypt the string with another openssl function, send it to the socket... read the response, decrypt it, and process this further?

Does anyone have a clue how to do this?
cURL is not an option since cURL, as far as I know, only talks HTTP over a wide range of protocols.

I've been messing with 'openssl s_client' but after the SSL handshaking completes the connection is closed and I am unable to send a message.

Php Sql Connection
i get this error when trying to use php to add something into the database, i thought Php wasnt compiled correctly but i am using phpMyAdmin so surely that uses mysql_connect!! and that works fine. I am using a cobalt raq4 if that has anything to do with it!
Error i get!

Fatal error: Call to undefined function: mysql_connect() in /home/sites/site20/web/vb/confadd.php on line 2 Code:

<?php
mysql_connect ('localhost','username','password');
mysql_select_db ('database');
$result=mysql_query("INSERT INTO table (accesscode,referee,username,password) VALUES ('$accesscode','$referee','$newuser','$password')");
echo ("User has been added");?>

Which Connection Is Best?
I started with php and mysql and i discovered three methods for connecting
to a database:


$conn="DRIVER={MySQL ODBC 3.51 DRIVER};SERVER=10.0.0.181;DATABASE=reserv";
$connect=odbc_connect($conn,'root','pw');

include('/inetpub/wwwroot/resphpaccess/adodb/adodb.inc.php');
$db = &ADONewConnection('mysql');
$db->Connect('localhost', 'root', 'pw', 'reserv');

$link = mysql_connect("localhost", "mysql_user", "mysql_password")
or die("Impossible de se connecter : " . mysql_error());


Which one is the best and why?
What are the pro/contras for each?

Connection To An Outside Db
Can we connect to a database(mySQL) using php, on another site. IE:  siteOne.co.uk runs some script that can connect to siteTwo.co.uk mysql database, therefore looking as its got is own etc? Any ideas or a straight NO.

I did mention about running a php to xml page that reads the db and converts it to an xml page and then it can get the data from there with absolute path etc ?

Oracle Connection
I am running a PHP script on unix. I am trying to connect to Oracle database. Before i start using the functions like Ora_Logon etc, what steps do i have to take in order to make PHP talk to Oracle database?

Microsoft SQL Connection
I am looking to have a php page that will have a required include of a
config file with the MS SQL connection creation. I want to have a form
that saves into a MS SQL database. Could call out to a stored
procedure or have inline code in the php page.

Anyone have examples or generic sample code I can use?

I Need A Universal Connection
I am interested in developing a web application to which I can attach any of db
like mysql,access,sql server,oracle ... as it is there in most of projects where during the installation we select any of optional db.

how to write such a code which can work with all of databases.

Db Connection Issues
The pages I have are template driven and they seem to work until I try and connect to the MySql db - then the pages don't want to display properly. I am sure it is some error in the way I am coding it. code:

Connection Errors ?
host -{ The server }- is blocked because of many connection errors. Unblock with 'mysqladmin flush-hosts'

anyone know why this message show up allot of times and goes away only after restarting mysql and apache ? is there a other way if fixing this ?

Authorize.net AIM Connection
Has anyone else connected using the AIM method yet? Code snippets would help me see the error of my ways.

SQL Anywhere 5.5 Odbc Connection
Is possible connect to database SQL Anywhere 5.5 started by
rtdsk50.exe from php using odbc?

I have error : Unable to connect to database server: unable to start
database engine, SQL state 08001.

I can connect to database using the same data source from MS Access.

Best Way To Set DB Connection Settings
I was wondering what is the best way to code the DB connection settings, by settings I mean the username/password and DB name. Right now I'm doing it in every php file that talks to the MySQL DB, but I think it may not be a good idea. How do you guys do it? like call it from a central file or something?

Remote DSN Connection
I am trying to set up a website to connect to an SQL Anywhere database located on a remote machine.

The webserver is located on a linux server, while the database is running on a windows machine on the local network.

How can I connect to this remote database, and what ports will I have to enable access to through the firewall?

Connection Pooling In PHP?
Is that when using pconnect to mysql, it is already mean connection
pooling?

Open Db Connection
I'm trying to close unnecessary db connection to reduce the concurrent
connection. Is there any way I can find the open connection?

PHP SSH And Mysql Connection
For a long time I've been trying to connect to mysql through a SSH tunnel. Although that si possible by setting up the tunnel manually (with 'ssh -L ...'), I'd like it to be done by PHP itself.

Now, with the SSH2 extension (http://www.php.net/manual/en/ref.ssh2.php) it is possible to issue a 'ssh2_connect' and then a 'ssh2_tunnel' command.
That returns a socket resource to the destination server.
So far, all fine.

Problem:
How can I force that socket onto 'mysql_connect'?
I mean, what I have is:
$tunnel = ssh2_tunnel($connection, &#3910;.0.0.101', 12345);

But $tunnel is a PHP resource, and not in the format ':/path/to/socket' that mysql_connect expects...

Is this possible at all?

Sybase Connection
This is the first time I need to connect via PHP to a Sybase DB.
I'm working with PHP5 and Apache 2 under WinXP... no problem
connecting with Mysql...
I enabled in php.ini the correct dll: "php_sybase_ct.dll" but when I
restart Apache got this error:

PHP Startup: Unable to load dynamic library 'c:phpphp_sybase_ct.dll'
- Can't find the specified module

I read that the library needs Sybase DLL: on my PC I installed the
whole Sybase SQL Studio 8 (it works fine) but no result... the
php_sybase_ct.dll is in the same dir as the other DLLs (c:php) and
Sybase is in c:programssybase...

JDBC Connection
Can PHP connect via JDBC?

Connection Pool
Is anyone aware of a means of connection pooling (to MySQL, say) in php?


Copyright © 2005-08 www.BigResource.com, All rights reserved