Dual Connections
I am developing a PHP script that needs to connect to two different databases in one script. There is one catch, however. One database is on a local computer (laptop). The other database is on a server 1,000 miles away.Is this possible?
In case you are wondering why I need this capability:
This application allows a user to enter data into a database on their local computer (laptop). With the click of a button, I want to transfer all of the data from the local database to the database on the server. Therefore I need to connect to the local database, loop through each record, copy it into an array. Then I need to connect to the server database, loop through the array, and insert each row into the server database. This must all be in the same script.
View Complete Forum Thread with Replies
Related Forum Messages:
Dual Foreign Key
How would one implement a dual foreign key, kind of like an "and". for example table a( field01, field02) table b(field01, field02 foreign key "field01 AND field 02" )
View Replies !
MySQL With Dual OS
I have a dual OS system with XP and Linux (Ubuntu). I generally use Ubuntu, but switch back to XP for the few things it does better (eg read SD cards). I also thought it would be better to use XP when visiting clients that are Windows only users. I therefore wanted to have my database accessable from both OSs. It took me a while, but I managed it this way: - installed MySQL in XP on the shared drive, which is formatted as FAT32. - created the database in XP. - installed MySQL in Linux - created a symbolic link in Linux from /var/lib/mysql/data to /shared/mysql/data From there, everything was accessable and I thought it was working fine until I got a dreaded 127 error and found many of my tables were corrupt. Googling around, it seems that the usual cause of this was that a table was too big. That wasn't possible because at the time, I only had 20 rows in the largest table. It seems more likely that it was because the access counts were screwed up from switching between systems. I found an error message (not sure where so I can't paste it here) that said something to the effect that the application thought the (query number?) was earlier than the database did. Does any of this sound familiar? Has anyone found a way to access the same database from 2 OSs?
View Replies !
Dual-master Replication
I would like to set up a dual-master replication setup for my MySQL database (running on RedHat 9). Could someone please point me to appropriate website that details this setup process and management as well (i.e. what should I do if one of the masters goes down?). Also, are there any solutions that allow auto-increment fields in this kind of setup?
View Replies !
Dual Sort In ORDER BY Clause?
I'm wondering if there's a way to order results by two criteria? I want to order forum threads by (1) their "stuck status" (enum, 0 or 1) and (2) by their "last post date" (int, unix timestamp). The resulting output would have the "stuck" threads at the top regardless of their last post date, followed by the "unstuck" threads ordered by their last post date. Can this be done with SQL?
View Replies !
Dual Master Replication In MySQL 4.1
I have been charged with the task of setting up dual master replication with our company's MySQL servers. I know that their are inherent auto_increment problems with this set up, and the mechanisms to fix this problem weren't introduced until version 5.0. Can anyone give me some tips, pointers, or advice for safely setting up this replication topology in 4.1? Are there any steps I can take to make sure there are no auto_increment issues? Has anyone had experience setting this up?
View Replies !
AUTO_INCREMENT - Configuration For Replication With Dual Masters
I'm looking at setting up two mysql servers in replication with both being masters. The most obvious snag in this scenario is auto_increment, as disconnections between servers could allow user interaction to generate duplicate keys. In a moment of zen I thought, "What if one server dealt only in even numbers, and the other only in odd numbers?" This solution would keep things simple and manageable, while also keeping the servers off eachothers' toes. Has anyone ever tried this? Is it even possible? if not, is there a similar solution allowing for the same kind of integration? Going further, I wonder if it's possible to do the same thing with three or more servers, giving each an algorythm to generate a series of auto_increment numbers that doesnt collide with the other master servers in the chain.
View Replies !
MySQL 4.0.18 On Dual AMD64 Opteron Causing Thread Zombie Even When Timeout Is Set To 60 Seconds
We have a problem with Dual AMD64 Opteron/MySQL 4.0.18/Mandrake 10 for a very high volume site. We are evaluating the performance on our new server AMD64 and it seems it's slow compared to Dual Xeon/MySQL 4.0.15/RedHat8 and Dual Xeon/MySQL 4.0.18/Mandrake 10. And it seems there are zombie threads. 570 threads in 1 hour and we didn't even use JDBC connection pooling at all. These threads are supposed to be gone within 60 seconds, since we set that option in mysqld. Note that we run many SELECT queries (can be up to 150 queries/seconds), but the system does not indicate any slow query: it's 0! Our configuration is Apache 2.0.48 + Tomcat 5.0.27 + MySQL 4.0.18 with MySQL connector/J 3.0.14 (latest stable). The Redhat 8 runs on Apache 2 + Tomcat 4.0 + MySQL 4.0.15. The old Redhat 8 on Xeon was fine. We have another machine running Mandrake 10 on Xeon and they were fine under the same load. I have set the wait_timeout to 60 seconds, and it appears to be fine within 10 minutes, all the threads that are in "sleep" mode disappeared after 60 seconds. After a few minutes though, it's back like it was before. Is this Mandrake problem? MySQL problem? I read in here than Mandrake win hands down on AMD64 compared to FreeBSD. Code:
View Replies !
Allow Outside Connections
i need to be able to connect from one server to another... i need to know how to allow outside connections. so i can use blah.com as the host instead of localhost or is this turned on by defult in MySQL??
View Replies !
20 Connections
Is it normal for mysql's performance to plummet when it hits about 20 connections? These connections are all from scripts running as cron jobs. I have max_connections set to 500 and max_user_connections set to 35.
View Replies !
Too-many Connections
i am using MYSQL database in my system.i have public IP like (202.***.**.**)ie accessed 10 people in my organization.after some time it is showing too-many connections. actually that is used only 10 persons but in my.ini file max_connections=255 are 255 but it is showing always too-many connections error.at that time we are restarting the system the problem is tempararyly solved? what is the permenat solutions for that? by using showprocesslist; command showing the list it is showing 10 users why it is showing the too-many connections?
View Replies !
Max Connections
I have stupidly set the max questions/conections options to such a low number that its locked me out before i even got a chance to play with this new version. Is there any way i can reset all the options and just start again. I have tried uninstalling and deleting the service from windows but on reinstall it just gives the same errors.
View Replies !
Too Many Connections
I am using Joomla 1.0.x and have ISPconfig Installed on my vps server. However since past few days I get the following message when accessing phpmyadmin phpMyAdmin - Error #1040 - Too many connections and on the homepage I get Joomla! Logo Site-Name This site is mysqlorarily unavailable.Please notify the System Administrator Could not connect to the database server. Previously every thing was fine suddenly this happened what can be done?
View Replies !
Too Many Connections Error
I have been getting the following error consistently every few days: Warning: Too many connections in /path/to/connection.php I altered the max_connections in my.cnf to allow for 300 connections. I am not using persistent connections with php. I used to use them but got this too many connections error all the time, so I switched to non-persistent connections, but they don't seem to be getting killed off? I am using php to connect. has anyone else dealt with this issue? Should I perhaps be closing the mysql_connect() after running each query?
View Replies !
MAX OPEN CONNECTIONS
My site has available by default 15 connections to MYSQL. Many connections remain open for much time, so when a new user enter the page it shows a message UNABLE TO CONNECT TO DB. How do I avoid this, without need change the number of connections of the server?
View Replies !
Network Connections
I can connect to the database on my FreeBSD system, but not from another system on my network. How do I set it up to allow remote connections?
View Replies !
Persistant Connections
when installing oscommerce i noticed that it had an option - enable persistant database connections. How does this differ to 'normal' connections, and how would this be implemented?
View Replies !
'Too Many Connections' Error;
I manage a Linux box that runs a small website and today, my clients got the 'Could not connect: Too many connections' error when they tried to connect to their CMS. Here is what I did: 1. Ran "show full processlist" from a mysql prompt and got the following info: +-----+------+-----------+------+---------+------+-------+-----------------------+ | Id | User | Host | db | Command | Time | State | Info | +-----+------+-----------+------+---------+------+-------+-----------------------+ | 405 | root | localhost | NULL | Query | 0 | NULL | show full processlist | +-----+------+-----------+------+---------+------+-------+-----------------------+ 1 row in set (0.00 sec) In other words, there was only one person logged on, and that was me. I ran this a bunch of times during the day and this was all I ever saw.
View Replies !
How Many Connections Are Open?
We have a large database that has suddenly become extremely slow. It is running on Fedora core 4. How can I find ou thow many connection are open? When I look at CPU usage thru CPanel this appears to use a lot of CPU, sometimes over 90% /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/mail.realivent.com.pid --skip-external-locking
View Replies !
What Are Connections And How To Manage Them
I have been using mySQL for several years now, but I currently developing a larger/broader usage website with intense mySQL contents usage. I have been told that mySQL has a so-called connection limit of 50-70. QUESTIONS: 1) What is a connection limit? Or... How do you count 1 connection? 2) How do you properly manage this, to e.g. handle a site that has 1000 simultaneous users logged in to a web site and interacting with the database.
View Replies !
Connections And Timers.
Is it possible to establish connection with other DB ie ORACLE and execute select and insert the result to the MySQL DB. If yes how to do it ? Are there avilable tasks which can be fired on the timer basis ?
View Replies !
Selecting Across Connections
This is either a very simple answer or a very dumb question, i'm also sure there is alot of documentation on how/why not to do this possibly too much hence my issue with figuring it out. I have a db on-site at locationA. I have a db hosted online at locationB. I want to schedule a query to run regularly (twice daily) that Selects into a table on db at locationB data from tables at locationA, the query needs to be executed at locationA. I.e. SELECT locationA.myonsitedb.tblMyTable.* INTO locationB.myonlinedb.tblMyRemoteTable.* Unfortunately, in my noobness I have no idea where to start here, I have no problem with the queries but I'm completely green to the setup of connections and how to query across these connections or how to setup the scheduling.
View Replies !
Aborted Connections
I get pages error logs with this message - "Got an error reading communication packets". And the aborted clients are easily in hundreds. Here is my set of configurations: I am running Microsoft .Net 2.0 on Windows 2003 Server using IIS 6.0. I am using Mysql 5.0 with Mysql/.Net Connector 1.0. Some of the settings on my.ini - Connection timeout - 180 Wait timeout - 360 Max packet size - 10 M Max connections - 5000 (pretty high, but set to be on a safer side) When a perform a netstat -ao - I have lot many sockets open with TIME_WAIT status. On the MySql Command client - the Aborted clients average around 100's The connection string from ,Net application has pooling=false with no help. The webserver does not have a heavy load and has less than 5 users at any point in time. On the registry settings, I have the max ports > 60000 and the time_wait setting changed to 30. My application is opens a connection, performs a query and closes the connection and this is the fashion followed for all DB operations.
View Replies !
Multiple Connections
While running under XP my app did perform many successfully db operations. But after a few thousand or so updates and reads in a tight loop, it would eventually crash. A sample trace is included in a prior posting. Code:
View Replies !
ODBC CONNECTIONS
We are in the process of setting up a database to house some information from our (legacy) ERP. Two questions have arisen: 1. Can we create a direct link to the data source from the db? 2. Currently we are using access as an intermediate connection - the link to the dsn in in access and then we have been exporting the data to the MySQL table. However, this will not let us update the tables it creates because it says the file already exists. If we stay with this method, how do we update the tables on a nightly basis (needs to be an automatic function).
View Replies !
Slow Connections
I am using MyODBC-3.51.11-2-win on Win 2003 OS. I am not able to see all of the connections in the list under the System DSN tab. The connections that show allow the ASP pages to run at an expected rate. However, the ones not showing in the list are running extremely slow. If I attpemt to recreate the connection I am told that the connection already exists and asks if I want to replace the existing connection. Wheter I click yes or no the connections do not show and the pages run slowly. How do I get them to show or resolve the issue. The ASP code is the exact same SQL statements and connection strings as the in previous applications.
View Replies !
Database Connections
i have a general question using the mySQL database. Lets say I have 10 database queries in my application. The 10 queries do not happen one after the other in a short time, so it can be that between one and the next query elapse seconds, or minutes, depending on e.g. user actions of my application. Well, should I open and close a connection for every query or should I open one connection in the beginning of my apllication, then do the ten queries with the same connection and afterwards close the connection again? I think both is possible, but what is 'best practice'? Is it a matter of speed from/to the database
View Replies !
Too Many Connections By A Php File
I have been using a certain php file to connect to a mysql database for some time, but the last time that I checked it for bugs, I got an error message "Warning: mysql_connect(): Too many connections in /home/yonni/public_html/cgi-bin/register.php on line 19. ERROR 3: The connection to the registration database is temporarily unavaliable: Too many connections" I have not changed the coding for the connection to the database since I first wrote it. The code for this part of the script is: $dbh=mysql_connect("localhost", "*my username*", "*my password*") or die ('ERROR 3: The connection to the registration database is temporarily unavaliable: '.mysql_error()); mysql_select_db("yonni_") or die ('ERROR 4: unable to select the correct database'); Why has this error occured, and is there a way of avoiding it? There is noone else viewing the site yet, and I do not know what the problem is. Please help
View Replies !
Too Many Faulty Connections [ Was Please Help ]
My website keeps telling me 'Cannot connect to dababase, too many fauly connections' I saw that we can do this: shell> mysqld_safe -O max_connect_errors=10000 & But I don't run Linux, and thus can't do a shell command. Does anyone know how to do this in windows server 2003?
View Replies !
Question About Max Connections
I had a question about maximum connections to a database. How does that work? I've read different things about it. If I have a limit of 100 connections and 100 people are currently connected to the database, then 1 more can't... or Is it only during connecting that this issue comes around.
View Replies !
Too Many Connections (my.cnf Set To 3550)
I'm getting the following error in one of my scripts: Warning: mysql_pconnect(): Too many connections in /home/filexoom/public_html/includes/mysql.class.php on line 5 mySQL: Too many connections on line 5 in /home/filexoom/public_html/includes/mysql.class.php To fix the problem I've raised the max_connections to 3550 (had to raise it gradually), but it is still getting the error on occasion. I don't understand what's going on, I only have about 4000 users in the db. I have restarted httpd, mysql, and even the entire server after editting my.cnf. However I'm still getting the same issue. I'm thinking perhaps the script is not closing the db connections, so there are a bunch that are still open, but should be closed. If so, is there anyway I can kill/flush all the current connections?
View Replies !
How Many Active Connections?
i need to know how many connections and where they are coming from becuase my database is taking over the whole cpu after around 20 minutes the deamon has been started. it's very xtrange and i don't know how to work this out i taught it was a windows problem but it's the same over linux
View Replies !
Closing MySQL Connections
Here's a question for you, my hosts have told me that that one my pages, php, was causing their server to reboot because there were too many open connections and that they should be closed. Now, correct me if I am wrong but I thought that the connections were closed after a minute of inactivity. Does this sound right? Could open connections cause their server to reboot a lot, say 3 times in 15 minutes? If so, what can I do about it?
View Replies !
Mysql_pconnect() Do Persistent Connections Ever Die
I currently connect to my db with PHP code that uses non-persistent connections. I've read that persistent connections can help performance since a connection to the db will use an existing unused connection. If my system was to go through a busy period whereby I seen an extra 50% or more activity for ten minutes or so, would the extra connections stay alive for ever or is there a time limit of inactivity? Would the unused connections just sleep if they don't die? Is there any negative effect of having these connections waiting around?
View Replies !
Mysql_pconnect() Do Persistent Connections Ever Die?
I currently connect to my db with PHP code that uses non-persistent connections. I've read that persistent connections can help performance since a connection to the db will use an existing unused connection. If my system was to go through a busy period whereby I seen an extra 50% or more activity for ten minutes or so, would the extra connections stay alive for ever or is there a time limit of inactivity? Would the unused connections just sleep if they don't die? Is there any negative effect of having these connections waiting around?
View Replies !
InnoDB And Lost Connections
I have just recreated several (large) tables in the database as InnoDB and reloaded them using my client application... These tables used to be MyISAM. I haven't tried playing with any InnoDB parameters, right now everything is default. Some operations a noticeably slower, which can probably be fixed. Speed is not essential right now. But I did run into one strange problem with a batch INSERT SELECT that would take about an hour with MyISAM. With InnoDB, if everything would work right, I would expect the query to take longer to execute. In fact, it gets aborted in about 30 minutes with the error 2013 -- lost connection during query. Something obviously related happens if I run it through JDBC -- then I get an exception with a message "unexpected end of input stream" also in about 30 minutes after the statement is submitted. I cannot not ALTER the table in question back to MyISAM for the same reason -- lost connection before the statement gets executed. I'm running MySQL 4.0.16 on Red Hat Linux (don't remember the version, but it's a fairly recent production release) with 1G of RAM.
View Replies !
|