MySQL Locks
Hi,
This is quite complicated, and probably I'm making a big mess in many concepts... but can someone help me with this??
All right... I'm using MySQL DB, and it's default table types do not support transactions, so I'm supposed to use table locks instead. There are also InnoDB table types in MySQL which support transactions, but since the server I'm putting all in is still unknown, I don't want to assume it will support InnoDB tables.
Then, when using JDBC API to access this DB, it seems by the documentation that all results are in the ResultSet type. But this representation is in fact a pointer to the DB row, and it pulls up the data just when requested.
For example, if I execute a select statement that returns me 10 rows, one will be read directly from the DB everytime i call the method next.
Is everything correct until now?
OK... the problem is... if I lock the table in order to protect this reading from other threads writings and the rows take some time to process individually, will the table be locked all that long? Or the JDBC implementation does all that for me and I don't even have to use locks? Or this is just an illusion and all the results are read and there is no further concurrency problem - after I release the lock, of course?
I know select, update and other operations are atomic in mysql default tables, but this will be used all over...
One last thing, I'm using MySQL Connector/J 3.0 JDBC driver.
I hope I could describe my doubt...
Thanks
There are also InnoDB table types in MySQL which support
transactions, but since the server I'm putting all in
is still unknown, I don't want to assume it will
support InnoDB tables.If you really need transactions, I think you can safely assume that it is available, since MySQL-Max versions since around 3.23.40+ have supported InnoDB.
Still, if you want to use MyISAM, you could, but individual table locking won't really give you transactional semantics. It may prevent premature dirty reads, but that's all, and it's an extremely expensive way of doing this.
But you may not need to do this, since the MyISAM table manager automatically locks the table when processing a query (so that no inserts or updates can take place while the query is being processed). So you won't get inconsistent results in terms of reading the result of half of an update, for instance.
However, you will never really get transactional semantics unless you lock the entire DB, but that's REALLY nasty.
But this representation is in fact a pointer to the DB
row, and it pulls up the data just when requested.False. MySQL doesn't have anything like DB cursors, so the entire
query result is read into memory as soon as you executeQuery(),
and the next() simply returns you values from memory.
So yes, if you start a query without a restrictive WHERE clause and without a LIMIT clause on a giant table, you'll run out of memory before you can even get the first row.
OK... the problem is... if I lock the table in order
to protect this reading from other threads writings
and the rows take some time to process individually,
will the table be locked all that long? No - see the above. If you're not using explicit locking, the tables being queried will be temporarily locked until the results are generated into the server's memory, and then the locks are released. Then the results are transferred completely to the client's JDBC driver memory, and it then feeds the results on each next() call.
On the other hand, if you lock the DB, you won't get a chance to unlock the DB until all the above steps are completed (i.e. until the last byte of the result set has been sent back to the JDBC driver and processed by it into the ResultSet).
This would make your application nearly unusable.
Or the JDBC implementation does all that for me and I don't
even have to use locks? Well, JDBC won't do this for you. If all you want is a clean query without partial individual-update side-effects, you can get that for free without doing any locking, courtesy of MySQL's MyISAM table manager.
However, if you need transactional semantics (i.e. you want to consider a series of updates or inserts as one transaction, and don't want any other query to see partial results after a subset of those updates), then:
(a) you'll have to do explicit locking, with all the hazards described above,
OR
(b) you'll have to break down and use InnoDB, and ask your users to install MySQL-Max 3.23.latest or 4.0.latest.
Similar Messages
-
MySQL lock table size Exception
Hi,
Our users get random error pages from vibe/tomcat (Error 500).
If the user tries it again, it works without an error.
here are some errors from catalina.out:
Code:
2013-07-31 06:23:12,225 WARN [http-8080-8] [org.hibernate.util.JDBCExceptionReporter] - SQL Error: 1206, SQLState: HY000
2013-07-31 06:23:12,225 ERROR [http-8080-8] [org.hibernate.util.JDBCExceptionReporter] - The total number of locks exceeds the lock table size
2013-07-31 06:23:12,242 WARN [http-8080-8] [org.kablink.teaming.web.portlet.handler.LogContextInfoInterceptor] - Action request URL [http://vibe.*******.ch/ssf/a/do?p_name=ss_forum&p_action=1&entryType=4028828f3f0ed66d013f0f3ff208013d&binderId=2333&action=add_folder_entry&vibeonprem_url=1] for user [kablink,ro]
2013-07-31 06:23:12,245 WARN [http-8080-8] [org.kablink.teaming.spring.web.portlet.DispatcherPortlet] - Handler execution resulted in exception - forwarding to resolved error view
org.springframework.dao.InvalidDataAccessApiUsageException: object references an unsaved transient instance - save the transient instance before flushing: org.kablink.teaming.domain.FolderEntry; nested exception is org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: org.kablink.teaming.domain.FolderEntry
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:654)
at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)
2013-07-31 06:23:36,474 ERROR [Sitescape_QuartzSchedulerThread] [org.quartz.core.ErrorLogger] - An error occured while scanning for the next trigger to fire.
org.quartz.JobPersistenceException: Couldn't acquire next trigger: The total number of locks exceeds the lock table size [See nested exception: java.sql.SQLException: The total number of locks exceeds the lock table size]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTrigger(JobStoreSupport.java:2794)
at org.quartz.impl.jdbcjobstore.JobStoreSupport$36.execute(JobStoreSupport.java:2737)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3768)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTrigger(JobStoreSupport.java:2733)
at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:264)
Caused by: java.sql.SQLException: The total number of locks exceeds the lock table size
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:946)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
at com.mysql.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:1169)
2013-07-31 06:27:12,463 WARN [Sitescape_Worker-8] [org.hibernate.util.JDBCExceptionReporter] - SQL Error: 1206, SQLState: HY000
2013-07-31 06:27:12,463 ERROR [Sitescape_Worker-8] [org.hibernate.util.JDBCExceptionReporter] - The total number of locks exceeds the lock table size
2013-07-31 06:27:12,463 ERROR [Sitescape_Worker-8] [org.jbpm.graph.def.GraphElement] - action threw exception: Hibernate operation: could not execute update query; uncategorized SQLException for SQL [update SS_ChangeLogs set owningBinderKey=?, owningBinderId=? where (entityId in (? , ?)) and entityType=?]; SQL state [HY000]; error code [1206]; The total number of locks exceeds the lock table size; nested exception is java.sql.SQLException: The total number of locks exceeds the lock table size
org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not execute update query; uncategorized SQLException for SQL [update SS_ChangeLogs set owningBinderKey=?, owningBinderId=? where (entityId in (? , ?)) and entityType=?]; SQL state [HY000]; error code [1206]; The total number of locks exceeds the lock table size; nested exception is java.sql.SQLException: The total number of locks exceeds the lock table size
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
at org.springframework.orm.hibernate3.HibernateAccessor.convertJdbcAccessException(HibernateAccessor.java:424)
2013-07-31 06:27:22,393 INFO [CT-kablink] [org.kablink.teaming.lucene.LuceneProvider] - (kablink) Committed, firstOpTimeSinceLastCommit=1375251142310, numberOfOpsSinceLastCommit=12. It took 82.62174 milliseconds
2013-07-31 06:28:22,686 INFO [Sitescape_Worker-9] [org.kablink.teaming.jobs.CleanupJobListener] - Removing job send-email.sendMail-1375252102500
2013-07-31 06:29:51,309 INFO [Sitescape_Worker-10] [org.kablink.teaming.jobs.CleanupJobListener] - Removing job send-email.sendMail-1375252191099
2013-07-31 06:32:08,820 WARN [http-8080-2] [org.hibernate.util.JDBCExceptionReporter] - SQL Error: 1206, SQLState: HY000
2013-07-31 06:32:08,820 ERROR [http-8080-2] [org.hibernate.util.JDBCExceptionReporter] - The total number of locks exceeds the lock table size
2013-07-31 06:32:10,775 WARN [http-8080-1] [org.hibernate.util.JDBCExceptionReporter] - SQL Error: 1206, SQLState: HY000
2013-07-31 06:32:10,775 ERROR [http-8080-1] [org.hibernate.util.JDBCExceptionReporter] - The total number of locks exceeds the lock table size
2013-07-31 06:32:12,305 WARN [http-8080-1] [org.hibernate.util.JDBCExceptionReporter] - SQL Error: 1206, SQLState: HY000
2013-07-31 06:32:12,305 ERROR [http-8080-1] [org.hibernate.util.JDBCExceptionReporter] - The total number of locks exceeds the lock table size
2013-07-31 06:32:14,605 WARN [http-8080-3] [org.hibernate.util.JDBCExceptionReporter] - SQL Error: 1206, SQLState: HY000
2013-07-31 06:32:14,606 ERROR [http-8080-3] [org.hibernate.util.JDBCExceptionReporter] - The total number of locks exceeds the lock table size
2013-07-31 06:32:16,056 WARN [http-8080-3] [org.hibernate.util.JDBCExceptionReporter] - SQL Error: 1206, SQLState: HY000
2013-07-31 06:32:16,056 ERROR [http-8080-3] [org.hibernate.util.JDBCExceptionReporter] - The total number of locks exceeds the lock table size
2013-07-31 06:32:24,166 WARN [http-8080-1] [org.hibernate.util.JDBCExceptionReporter] - SQL Error: 1206, SQLState: HY000
2013-07-31 06:32:24,166 ERROR [http-8080-1] [org.hibernate.util.JDBCExceptionReporter] - The total number of locks exceeds the lock table size
2013-07-31 06:32:24,167 WARN [http-8080-1] [org.kablink.teaming.spring.web.portlet.DispatcherPortlet] - Handler execution resulted in exception - forwarding to resolved error view
org.springframework.jdbc.UncategorizedSQLException: Hibernate flushing: could not insert: [org.kablink.teaming.domain.AuditTrail]; uncategorized SQLException for SQL [insert into SS_AuditTrail (zoneId, startDate, startBy, endBy, endDate, entityType, entityId, owningBinderId, owningBinderKey, description, transactionType, fileId, applicationId, deletedFolderEntryFamily, type, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'A', ?)]; SQL state [HY000]; error code [1206]; The total number of locks exceeds the lock table size; nested exception is java.sql.SQLException: The total number of locks exceeds the lock table size
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
at org.springframework.orm.hibernate3.HibernateTransactionManager.convertJdbcAccessException(HibernateTransactionManager.java:805)
at org.springframework.orm.hibernate3.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:791)
at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:664)
It always logs the Mysql error code 1206:
MySQL :: MySQL 5.4 Reference Manual :: 13.6.12.1 InnoDB Error Codes
1206 (ER_LOCK_TABLE_FULL)
The total number of locks exceeds the lock table size. To avoid this error, increase the value of innodb_buffer_pool_size.
The value of innodb_buffer_pool_size is set to 8388608 (8MB) on my server.
In the documentation (MySQL :: MySQL 5.4 Reference Manual :: 13.6.3 InnoDB Startup Options and System Variables) it says that the default is 128MB.
Can i set the value to 134217728 (128MB) or will this cause other problems? Will this setting solve my problem?
Thanks for your help.I already found an entry from Kablink:
https://kablink.org/ssf/a/c/p_name/s...beonprem_url/1
But i think this can't be a permanent solution...
Our MySQL Server version is 5.0.95 running on sles11 -
MYSQL backup, mysql -e "FLUSH TABLES WITH READ LOCK" doesnt work
I want to backup mysql locking tables first using flush tables with readlock, then do rsync and then unlock tables.
I want to do it automatically using script.
When I log in to mysql using: mysql -u root -p
the command:
FLUSH TABLES WITH READ LOCK;
works and locks the tables...but when I create my.cnf with login information to mysql:
[client]
user=root
password=xxx
the command:
mysql -e "SHOW DATABASES"
works and shows the databases....
but when I run this command:
mysql -e "FLUSH TABLES WITH READ LOCK"
it doesnt lock the tables...why?
thanksAre calling the 'mysql -e' command as your user or as root? If you call it as root (typical for a backup script), then the .my.cnf file needs to be in /root instead of $HOME.
Scott -
Can't connect to local MySQL server through socket '/var/mysql/mysql.sock'
I'm using the pre-installed versions of php and mysql under Mac OS X Server 10.4.4 running on a G4 and am unable to get anything involving mysql to work.
I ssh to the server and enter various commands in Terminal:
on typing "mysql" I get
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2)
and on typing "mysqladmin version" I get
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/var/mysql/mysql.sock' exists!
On typing "sudo mysqld_safe" I get
Starting mysqld daemon with databases from /var/mysql
STOPPING server from pid file /var/mysql/MyServer.local.pid
070722 16:06:05 mysqld ended
/var/mysql/MyServer.local.err contains
070722 16:06:04 mysqld started
070722 16:06:04 [Warning] Setting lowercase_tablenames=2 because file system for /var/mysql/ is case insensitive
070722 16:06:04 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
070722 16:06:05 InnoDB: Starting log scan based on checkpoint at
InnoDB: log sequence number 0 43634.
/var/mysql has permissions 775.
The line
mysql.default_socket = /var/mysql/mysql.sock
is in /etc/php.ini
whereis mysqladmin ->
/usr/bin/mysqladmin
whereis mysql ->
/usr/bin/mysql
ls /var/mysql ->
MyServer.local.err
ib_logfile1
mysql
ib_logfile0
ibdata1
test
Can't find my.cnf or my.ini anywhere
Can't find mysql.sock anywhere
I'm trying to get a bug database running (mantis) under Mac OS X Server 10.4.4 that I can access from local clients.
I'm trying to follow directions at http://www.mantisbugtracker.com/manual/manual.installation.php
without knowing anything about mysql or php and I'm stuck on step 3:
"Next we will create the necessary database tables and a basic configuration
file."
I get a message saying
"Does administrative user have access to the database? ( Lost connection to MySQL server during query )"
I don't even know if following the mantis directions has resulted in the creation of a database or not. Where would it be?
Thanks for any help.
Intel iMac Mac OS X (10.4.10)I've just done a clean install of OSX Server and added the latest MYSQL packaged installer. Afterwards I found the lock file in /private/tmp/mysql.lock
The easiest way to solve this problem is to create a symbolic link so that the lock file appears to be in right place.
e.g.
cd /var
sudo mkdir mysql <== this assumes the directory is missing
cd mysql
sudo ln -s /private/tmp/mysql.sock mysql.sock
After this msql commands should work fine, and you've not fiddled with the security settings on users/groups.
HTH
Christian -
10.4.4. and mySQL
After updating to 10.4.4. I cannot connect to my local mysql server anymore, but get the old "#2002 - Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2)" error again.
I tried starting the database up manually through terminal, but w/o any success. Did anyone experience the same problem and knows how to fix it?I think I solved it, the socket file is located in /tmp/mysql.lock. Aparently some defaults changed in the PHP MySQL client, so it now looks in the wrong place. You need to point PHP to the right socket by editing the php.ini file and restarting the webserver.
I wouldn't know how to do this using the graphical interface, so I just assume you know some UNIX and have the BSD subsystem installed.
Open a terminal, type in "ls -al /etc/php.ini*"
If a php.ini does not exist copy over the default php.ini, "sudo cp /etc/php.ini.default /etc/php.ini"
Now edit the php.ini, "sudo nano /etc/php.ini" (or use your prefered editor)
Find "mysql.default_socket" (you can search using [Ctrl]+[w] in nano)
Enter "/tmp/mysql.sock" after the equals sign.
Don't forget to save the file ([Ctrl]+[o] [Enter] in nano)
Now restart Apache, "sudo apachectl graceful"
And.. Boom! It works!
Mac Mini 1.25GHz 512MB Mac OS X (10.4.3) -
Can't connect to local MySQL server through socket '/tmp/mysql.sock' (46)
I can't connect...I have th connection to the database form
DW to the db....I can't get the server to connect. HELP!I've just done a clean install of OSX Server and added the latest MYSQL packaged installer. Afterwards I found the lock file in /private/tmp/mysql.lock
The easiest way to solve this problem is to create a symbolic link so that the lock file appears to be in right place.
e.g.
cd /var
sudo mkdir mysql <== this assumes the directory is missing
cd mysql
sudo ln -s /private/tmp/mysql.sock mysql.sock
After this msql commands should work fine, and you've not fiddled with the security settings on users/groups.
HTH
Christian -
./mysqlshow: Can't connect to local MySQL server through socket '/tmp/mysql
hi all ,I install mysql on Solaris 10 at first it work fine , but after I restart my PC and go back again I got error on
./mysqlshow: Can't connect to local MySQL server through socket '/tmp/mysql
I google , but still not sure how to deal with it
Thank youI've just done a clean install of OSX Server and added the latest MYSQL packaged installer. Afterwards I found the lock file in /private/tmp/mysql.lock
The easiest way to solve this problem is to create a symbolic link so that the lock file appears to be in right place.
e.g.
cd /var
sudo mkdir mysql <== this assumes the directory is missing
cd mysql
sudo ln -s /private/tmp/mysql.sock mysql.sock
After this msql commands should work fine, and you've not fiddled with the security settings on users/groups.
HTH
Christian -
Help on locking MySQL tables (many can read, but only one can write) Java
Hi there,
I have a question regarding locking of tables so that only one person can write to the file, but many are able to read the files (or tables entities).
I am not sure if I need to lock the tables in my Java code or do I lock the tables within the MySQL syntax. I'm just a little confused on the matter.
This java code is a working prototype of inserting a customer data into the database and that works fine. I just don't know how to implement it so that only one person can update the table at a time.
Here is the Customer.java code that I have written.
Help would be greatly appreciated, thanks so much.
package business;
//~--- non-JDK imports --------------------------------------------------------
import shared.info.CustomerInfo;
//~--- JDK imports ------------------------------------------------------------
import java.sql.*;
* @author
public class Customer {
static Connection con = DBConnection.getConnection();
private CustomerInfo info = new CustomerInfo();
private String customerID;
private String firstName;
private String lastName;
private String email;
private String addressID;
private String homePhone;
private String workPhone;
private String unitNum;
private String streetNum;
private String streetName;
private String city;
private String provinceState;
private String country;
private String zipPostalCode;
public Customer(String id) {
try {
PreparedStatement pstmt = con.prepareStatement("SELECT * FROM " +
"Customer NATURAL JOIN Address WHERE CustomerID = ?");
pstmt.setString(1, id);
ResultSet rs = pstmt.executeQuery();
while (rs.next()) {
customerID = rs.getString("CustomerID");
firstName = rs.getString("FirstName");
lastName = rs.getString("LastName");
homePhone = rs.getString("HomePhone");
workPhone = rs.getString("WorkPhone");
email = rs.getString("Email");
city = rs.getString("City");
provinceState = rs.getString("ProvinceState");
country = rs.getString("Country");
zipPostalCode = rs.getString("ZipPostalCode");
unitNum = rs.getString("UnitNum");
streetNum = rs.getString("StreetNum");
streetName = rs.getString("StreetName");
addressID = rs.getString("AddressId");
} catch (SQLException e) {
e.printStackTrace();
info.setCustomerID(customerID);
info.setFirstName(firstName);
info.setLastName(lastName);
info.setHomePhone(homePhone);
info.setWorkPhone(workPhone);
info.setEmail(email);
info.setCity(city);
info.setProvinceState(provinceState);
info.setCountry(country);
info.setZipPostalCode(zipPostalCode);
info.setUnitNum(unitNum);
info.setStreetNum(streetNum);
info.setStreetName(streetName);
info.setAddressID(addressID);
public static void addCustomer(CustomerInfo cust) {
try {
int id = -1;
PreparedStatement pstmt = con.prepareStatement("INSERT INTO Address" +
"(UnitNum, StreetNum, StreetName, City, ProvinceState, Country," +
" ZipPostalCode) VALUES(?, ?, ?, ?, ?, ?, ?)");
pstmt.setString(1, cust.getUnitNum());
pstmt.setString(2, cust.getStreetNum());
pstmt.setString(3, cust.getStreetName());
pstmt.setString(4, cust.getCity());
pstmt.setString(5, cust.getProvinceState());
pstmt.setString(6, cust.getCountry());
pstmt.setString(7, cust.getZipPostalCode());
pstmt.executeUpdate();
ResultSet rs = pstmt.getGeneratedKeys();
rs.next();
id = rs.getInt(1);
pstmt = con.prepareStatement("INSERT INTO Customer" +
"(FirstName, LastName, HomePhone, WorkPhone, Email, AddressID)"
+ "VALUES(?, ?, ?, ?, ?, ?)");
pstmt.setString(1, cust.getFirstName());
pstmt.setString(2, cust.getLastName());
pstmt.setString(3, cust.getHomePhone());
pstmt.setString(4, cust.getWorkPhone());
pstmt.setString(5, cust.getEmail());
pstmt.setInt(6, id);
pstmt.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
public void setFirstName(String newName) {
try {
PreparedStatement pstmt = con.prepareStatement("UPDATE Customer"
+ " SET FirstName = ? WHERE CustomerID = ?");
pstmt.setString(1, newName);
pstmt.setString(2, customerID);
pstmt.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
firstName = newName;
public void setLastName(String newName) {
try {
PreparedStatement pstmt = con.prepareStatement("UPDATE Customer"
+ " SET LastName = ? WHERE CustomerID = ?");
pstmt.setString(1, newName);
pstmt.setString(2, customerID);
pstmt.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
lastName = newName;
public String getFirstName() {
return firstName;
public String getLastName() {
return lastName;
public void setHomePhone(String number) {
try {
PreparedStatement pstmt = con.prepareStatement("UPDATE Customer"
+ " SET HomePhone = ? WHERE CustomerID = ?");
pstmt.setString(1, number);
pstmt.setString(2, customerID);
pstmt.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
homePhone = number;
public String getHomePhone() {
return homePhone;
public void setWorkPhone(String number) {
try {
PreparedStatement pstmt = con.prepareStatement("UPDATE Customer"
+ " SET WorkPhone = ? WHERE CustomerID = ?");
pstmt.setString(1, number);
pstmt.setString(2, customerID);
pstmt.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
workPhone = number;
public String getWorkPhone() {
return workPhone;
public void setEmail(String email) {
try {
PreparedStatement pstmt = con.prepareStatement("UPDATE Customer" + " SET Email = ? WHERE CustomerID = ?");
pstmt.setString(1, email);
pstmt.setString(2, customerID);
pstmt.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
this.email = email;
public String getEmail() {
return email;
public void setUnitNum(String num) {
try {
PreparedStatement pstmt = con.prepareStatement("UPDATE Address" + " SET UnitNum = ? WHERE AddressId = ?");
pstmt.setString(1, num);
pstmt.setString(2, addressID);
pstmt.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
unitNum = num;
public String getUnitNum() {
return unitNum;
public void setCity(String city) {
try {
PreparedStatement pstmt = con.prepareStatement("UPDATE Address" + " SET City = ? WHERE AddressId = ?");
pstmt.setString(1, city);
pstmt.setString(2, addressID);
pstmt.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
this.city = city;
public String getCity() {
return city;
public void setStreetNum(String num) {
try {
PreparedStatement pstmt = con.prepareStatement("UPDATE Address" + " SET StreetNum = ? WHERE AddressId = ?");
pstmt.setString(1, num);
pstmt.setString(2, addressID);
pstmt.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
streetNum = num;
public String getStreetNum() {
return streetNum;
public void setStreetName(String name) {
try {
PreparedStatement pstmt = con.prepareStatement("UPDATE Address"
+ " SET StreetName = ? WHERE AddressId = ?");
pstmt.setString(1, name);
pstmt.setString(2, addressID);
pstmt.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
streetName = name;
public String getStreetName() {
return streetName;
public void setZipPostalCode(String code) {
try {
PreparedStatement pstmt = con.prepareStatement("UPDATE Address"
+ " SET ZipPostalCode = ? WHERE AddressId = ?");
pstmt.setString(1, code);
pstmt.setString(2, addressID);
pstmt.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
zipPostalCode = code;
public String getZipPostalCode() {
return zipPostalCode;
public CustomerInfo getInfo(){
return info;
static void deleteCustomer(String customerId) {
try{
PreparedStatement pstmt = con.prepareStatement("DELETE FROM Customer" +
" WHERE CustomerId = ?");
pstmt.setString(1, customerId);
pstmt.executeUpdate();
}catch(SQLException e){
e.printStackTrace();
static void updateCustomer(CustomerInfo custInf) {
try{
PreparedStatement pstmt = con.prepareStatement("UPDATE customer" +
" SET firstName = ?, SET lastName = ?," +
" SET homePhone = ?, SET workPhone = ?, SET email = ?" +
" WHERE CustomerId = ?");
pstmt.setString(1, custInf.getFirstName());
pstmt.setString(2, custInf.getLastName());
pstmt.setString(3, custInf.getHomePhone());
pstmt.setString(4, custInf.getWorkPhone());
pstmt.setString(5, custInf.getEmail());
pstmt.setString(6, custInf.getCustomerID());
pstmt.executeUpdate();
pstmt = con.prepareStatement("UPDATE address" +
" SET unitNum = ?, SET StreetNum = ?, SET StreetName = ?," +
" SET city = ?,SET Province = ?,SET country = ?,SET ZipPostalCode = ?" +
" WHERE AddressId = ?");
pstmt.setString(1, custInf.getUnitNum());
pstmt.setString(2, custInf.getStreetNum());
pstmt.setString(3, custInf.getStreetName());
pstmt.setString(4, custInf.getCity());
pstmt.setString(5, custInf.getProvinceState());
pstmt.setString(6, custInf.getCountry());
pstmt.setString(7, custInf.getZipPostalCode());
pstmt.setString(8, custInf.getAddressID());
pstmt.executeUpdate();
}catch(SQLException e){
e.printStackTrace();
}In addition, here is my customer sql table.
-- Table structure for table `customer`
DROP TABLE IF EXISTS `customer`;
CREATE TABLE `customer` (
`CustomerID` mediumint(9) NOT NULL auto_increment,
`FirstName` varchar(20) NOT NULL,
`LastName` varchar(20) NOT NULL,
`HomePhone` varchar(11) NOT NULL,
`WorkPhone` varchar(11) default NULL,
`Email` varchar(20) NOT NULL,
`AddressID` mediumint(9) default NULL,
PRIMARY KEY (`CustomerID`),
KEY `AddressID` (`AddressID`),
CONSTRAINT `customer_ibfk_1` FOREIGN KEY (`AddressID`) REFERENCES `address` (`AddressID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- Dumping data for table `customer`
LOCK TABLES `customer` WRITE;
/*!40000 ALTER TABLE `customer` DISABLE KEYS */;
/*!40000 ALTER TABLE `customer` ENABLE KEYS */;
UNLOCK TABLES;to the best of my knowledge, this is something related to the database and not the programming. If you'd want to be the only user to read and edit the table, speicify only one user with that privilege and make it password protected. User must enter the password to write to the tables.
-
Lock problem using Innodb MySQL and JNDI
I have written an web application that uses tomcat 5, MySQL, JSP, JDBC, JNDI.
My problem is that if an application running in the browser sets a lock on a data item. Then all applications running in the browser on the same pc holds the lock. I know the lock is set correctly as I have tried to update the database.
Has it got anything to do with I am using JNDI so all applications connecting to the database is seen belonging to the same transaction?
I would really appreciate if someone could help me
MetteHi
Could you please provide some sample snap shot of your code,
i did not understand what the meaning of same transaction..... -
MySQL - Transactions without locks?
Hi , I am using the native transaction support of mysql innodb ( setautocommit(false) etc etc).
I also want to have multiple connections to the database which are able to update the same rows etc. - -now the error I'm getting is 'lock wait timeout'.
Probably this forum is not the exact place for this question, but is there any way of unlocking the rows? ie i start a transaction, insert some row, then want another connection/transaction to be able to update that row - and then commit or rollback either transaction I feel like. Timeout is not a solution as i want overlapping transactions.
This might sound mad/bad but please don't reply telling me its dangerous etc etc
Any help much appreciated,
thanksHi , I am using the native transaction support of
mysql innodb ( setautocommit(false) etc etc).
I also want to have multiple connections to the
database which are able to update the same rows etc.
- -now the error I'm getting is 'lock wait timeout'.
Probably this forum is not the exact place for this
question, but is there any way of unlocking the rows?
ie i start a transaction, insert some row, then want
another connection/transaction to be able to update
that row - and then commit or rollback either
transaction I feel like. Timeout is not a solution
n as i want overlapping transactions.
As far as I know, no database does overlapping transactions. (I suspect that either it is not feasible or it would have a huge performance impact. Or both.)
So your choice is either to live with the locks or stop using explicit transactions and write one row at a time. -
Help needed with locking tables+Mysql
Hello!
I have a table "A" which is of kind "auto_increament" (field "A1")
When I do an insert in A I need to know the next "auto_increament" index because I have to encrypt that index into another field in A lets say this field is called A2.
I understand that I have to do like like I do below (the semantic syntax) but I dont know the java syntax for locking tables and getting the next "auto_increament" index. The "lock type" of the ttable should be so now one else can write to the table.
--------semantic syntax---------------
1) LOCK A
2) Get "next" index from A
3) Make an insert
4) UNLOCK A
Very greatful for help!
Regards/D_Shttp://www.mysql.com/search/?q=jdbc+autoincrement&base=http%3A%2F%2Fdev.mysql.com&lang=en&doc=0&m=a
-
Hi,
I'm building a mysql database which is accessed via JDBC. The database can have many users, but I want to simplify it by only allowing one user to connect to the database at a time. My Java application creates and holds onto a connection until it exits. I just need to know how to lock the whole database whilst somebody is connected! Any ideas?
Cheerz,
Steve.The best solution i've come up with is to change th mysql system variable max_connections to 0 which only allows one person access at a time.
If anybody knows of a better solution then let me know!! -
when I type "rc.d start mysqld" it displays busy for a while, then fails. At this point it does not generate an error message. I have changed the permissions of /var/lib/mysql recursively to 777. I have also created the mysqld directory in /var/run and given it 777 permissions. I hope I have included all the relevant files.
I have read every suggestion on the internet and gotten nowhere. Please help a noobus out. Thanks in advance.
/var/lib/mysql/localhost.err
120115 01:11:48 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
120115 1:11:48 [Warning] One can only use the --user switch if running as root
120115 1:11:48 InnoDB: The InnoDB memory heap is disabled
120115 1:11:48 InnoDB: Mutexes and rw_locks use GCC atomic builtins
120115 1:11:48 InnoDB: Compressed tables use zlib 1.2.5
120115 1:11:48 InnoDB: Initializing buffer pool, size = 128.0M
120115 1:11:48 InnoDB: Completed initialization of buffer pool
120115 1:11:48 InnoDB: highest supported file format is Barracuda.
120115 1:11:50 InnoDB: Waiting for the background threads to start
120115 1:11:51 InnoDB: 1.1.8 started; log sequence number 1595675
120115 1:11:51 [ERROR] Can't start server : Bind on unix socket: Permission denied
120115 1:11:51 [ERROR] Do you already have another mysqld server running on socket: /var/run/mysqld/mysqld.sock ?
120115 1:11:51 [ERROR] Aborting
120115 1:11:51 InnoDB: Starting shutdown...
120115 1:11:51 InnoDB: Shutdown completed; log sequence number 1595675
120115 1:11:51 [Note] /usr/bin/mysqld: Shutdown complete
120115 01:11:51 mysqld_safe mysqld from pid file /var/lib/mysql/localhost.pid ended
/etc/rc.conf
# /etc/rc.conf - Main Configuration for Arch Linux
# LOCALIZATION
# LOCALE: available languages can be listed with the 'locale -a' command
# DAEMON_LOCALE: If set to 'yes', use $LOCALE as the locale during daemon
# startup and during the boot process. If set to 'no', the C locale is used.
# HARDWARECLOCK: set to "", "UTC" or "localtime", any other value will result
# in the hardware clock being left untouched (useful for virtualization)
# Note: Using "localtime" is discouraged, using "" makes hwclock fall back
# to the value in /var/lib/hwclock/adjfile
# TIMEZONE: timezones are found in /usr/share/zoneinfo
# Note: if unset, the value in /etc/localtime is used unchanged
# KEYMAP: keymaps are found in /usr/share/kbd/keymaps
# CONSOLEFONT: found in /usr/share/kbd/consolefonts (only needed for non-US)
# CONSOLEMAP: found in /usr/share/kbd/consoletrans
# USECOLOR: use ANSI color sequences in startup messages
LOCALE="en_US.UTF-8"
DAEMON_LOCALE="no"
HARDWARECLOCK="UTC"
TIMEZONE="America/New_York"
KEYMAP="us"
CONSOLEFONT=
CONSOLEMAP=
USECOLOR="yes"
# HARDWARE
# MODULES: Modules to load at boot-up. Blacklisting is no longer supported.
# Replace every !module by an entry as on the following line in a file in
# /etc/modprobe.d:
# blacklist module
# See "man modprobe.conf" for details.
MODULES=()
# Udev settle timeout (default to 30)
UDEV_TIMEOUT=30
# Scan for FakeRAID (dmraid) Volumes at startup
USEDMRAID="no"
# Scan for BTRFS volumes at startup
USEBTRFS="no"
# Scan for LVM volume groups at startup, required if you use LVM
USELVM="no"
# NETWORKING
# HOSTNAME: Hostname of machine. Should also be put in /etc/hosts
HOSTNAME="localhost"
# Use 'ip addr' or 'ls /sys/class/net/' to see all available interfaces.
# Wired network setup
# - interface: name of device (required)
# - address: IP address (leave blank for DHCP)
# - netmask: subnet mask (ignored for DHCP) (optional, defaults to 255.255.255.0)
# - broadcast: broadcast address (ignored for DHCP) (optional)
# - gateway: default route (ignored for DHCP)
# Static IP example
# interface=eth0
# address=192.168.0.2
# netmask=255.255.255.0
# broadcast=192.168.0.255
# gateway=192.168.0.1
# DHCP example
# interface=eth0
# address=
# netmask=
# gateway=
interface=eth0
address=
netmask=
broadcast=
gateway=
# Setting this to "yes" will skip network shutdown.
# This is required if your root device is on NFS.
NETWORK_PERSIST="no"
# Enable these netcfg profiles at boot-up. These are useful if you happen to
# need more advanced network features than the simple network service
# supports, such as multiple network configurations (ie, laptop users)
# - set to 'menu' to present a menu during boot-up (dialog package required)
# - prefix an entry with a ! to disable it
# Network profiles are found in /etc/network.d
# This requires the netcfg package
NETWORKS=(menu)
WIRELESS_INTERFACE="wlan0"
WIRED_INTERFACE="ethO"
# DAEMONS
# Daemons to start at boot-up (in this order)
# - prefix a daemon with a ! to disable it
# - prefix a daemon with a @ to start it up in the background
# If something other takes care of your hardware clock (ntpd, dual-boot...)
# you should disable 'hwclock' here.
DAEMONS=(hwclock syslog-ng @network crond net-auto-wired dbus acpid)
/etc/hosts
# /etc/hosts: static lookup table for host names
#<ip-address> <hostname.domain.org> <hostname>
127.0.0.1 localhost.localdomain localhost
#::1 localhost.localdomain localhost
# End of file
/etc/mysql/my.cnf
# MySQL config file for medium systems.
# This is for a system with little memory (32M - 64M) where MySQL plays
# an important part, or systems up to 128M where MySQL is used together with
# other programs (such as a web server)
# MySQL programs look for option files in a set of
# locations which depend on the deployment platform.
# You can copy this option file to one of those
# locations. For information about these locations, see:
# http://dev.mysql.com/doc/mysql/en/option-files.html
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.
# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /var/run/mysqld/mysqld.sock
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
port = 3306
socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
skip-networking
# Replication Master Server (default)
# binary logging is required for replication
log-bin=mysql-bin
# binary logging format - mixed recommended
binlog_format=mixed
# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id = 1
# Replication Slave (comment out master section to use this)
# To configure this host as a replication slave, you can choose between
# two methods :
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
# the syntax is:
# CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
# MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
# where you replace <host>, <user>, <password> by quoted strings and
# <port> by the master's port number (3306 by default).
# Example:
# CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
# MASTER_USER='joe', MASTER_PASSWORD='secret';
# OR
# 2) Set the variables below. However, in case you choose this method, then
# start replication for the first time (even unsuccessfully, for example
# if you mistyped the password in master-password and the slave fails to
# connect), the slave will create a master.info file, and any later
# change in this file to the variables' values below will be ignored and
# overridden by the content of the master.info file, unless you shutdown
# the slave server, delete master.info and restart the slaver server.
# For that reason, you may want to leave the lines below untouched
# (commented) and instead use CHANGE MASTER TO (see above)
# required unique id between 2 and 2^32 - 1
# (and different from the master)
# defaults to 2 if master-host is set
# but will not function as a slave if omitted
#server-id = 2
# The replication master for this slave - required
#master-host = <hostname>
# The username the slave will use for authentication when connecting
# to the master - required
#master-user = <username>
# The password the slave will authenticate with when connecting to
# the master - required
#master-password = <password>
# The port the master is listening on.
# optional - defaults to 3306
#master-port = <port>
# binary logging - not required for slaves, but recommended
#log-bin=mysql-bin
# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /var/lib/mysql
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = /var/lib/mysql
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 16M
#innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 5M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
[myisamchk]
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeoutHi,
I seem to have had an issue with mysql as well and it appears to be that I don't have a sock file as I have checked /var/run/mysqld for mysqld.sock and it does not exist so would that be what is stopping mysql server from starting and if so how do I create the sock file ??
Cheers
Quazza
Update - Actually I solved my problem to, it was to do with my log files filling up but that also led to the bigger problem of a failing HD oh what fun anyway got there before any major data loss.
Last edited by quazza (2012-01-20 08:09:26) -
How to show/hide div based on mysql value
I have a dataset that has a column 'locked' that is a boolean that I want to use to remove a button on a form. The idea being that it will be set to 1 after a period of time thus removing the buttun that links to an update form and preventing the data from being changed. Currently, I have the field linked to a check box at the top of the table. How do I use this to hide the button (or any other html element for that matter) when set to 1 and show the element when set to 0? I understand I need to creat a php variable from the mysql boolean and then use a if/else loop to hide/display the html but I don't know how to impliment this? Thanks for any help offered.
Here's the code:
<?php require_once('Connections/testmypms.php'); ?>
<?php
$currentPage = $_SERVER["PHP_SELF"];
$maxRows_spec_rx = 10;
$pageNum_spec_rx = 0;
if (isset($_GET['pageNum_spec_rx'])) {
$pageNum_spec_rx = $_GET['pageNum_spec_rx'];
$startRow_spec_rx = $pageNum_spec_rx * $maxRows_spec_rx;
$colname_spec_rx = "1";
if (isset($_GET['pxID'])) {
$colname_spec_rx = (get_magic_quotes_gpc()) ? $_GET['pxID'] : addslashes($_GET['pxID']);
mysql_select_db($database_testmypms, $testmypms);
$query_spec_rx = sprintf("SELECT spec_rx.spec_rx_id, spec_rx.FK_px_id, DATE_FORMAT(spec_rx.spec_rx_date, '%%d-%%m-%%Y') as formatted_rx_date, spec_rx.FK_user_id, spec_rx.spec_rx_rsph, spec_rx.spec_rx_rcyl, spec_rx.spec_rx_raxis, spec_rx.spec_rx_rhprism, spec_rx.spec_rx_rhprismbase, spec_rx.spec_rx_rvprism, spec_rx.spec_rx_rvprismbase, spec_rx.spec_rx_rnadd, spec_rx.spec_rx_rnhprism, spec_rx.spec_rx_rnhprismbase, spec_rx.spec_rx_rnvprism, spec_rx.spec_rx_rnvprismbase, spec_rx.spec_rx_rintadd, spec_rx.spec_rx_rinthprism, spec_rx.spec_rx_rinthprismbase, spec_rx.spec_rx_rintvprism, spec_rx.spec_rx_rintvprismbase, spec_rx.spec_rx_lsph, spec_rx.spec_rx_lcyl, spec_rx.spec_rx_laxis, spec_rx.spec_rx_lhprism, spec_rx.spec_rx_lhprismbase, spec_rx.spec_rx_lvprism, spec_rx.spec_rx_lvprismbase, spec_rx.spec_rx_lintadd, spec_rx.spec_rx_linthprism, spec_rx.spec_rx_linthprismbase, spec_rx.spec_rx_lintvprism, spec_rx.spec_rx_lintvprismbase, spec_rx.spec_rx_lnadd, spec_rx.spec_rx_lnhprism, spec_rx.spec_rx_lnhprismbase, spec_rx.spec_rx_lnvprism, spec_rx.spec_rx_lnvprismbase, spec_rx.locked, users.user_id, users.user_firstname, users.user_surname FROM spec_rx, users WHERE %s = spec_rx.FK_px_id AND spec_rx.FK_user_id = users.user_id ORDER BY spec_rx.spec_rx_date DESC, spec_rx.spec_rx_id DESC", $colname_spec_rx);
$query_limit_spec_rx = sprintf("%s LIMIT %d, %d", $query_spec_rx, $startRow_spec_rx, $maxRows_spec_rx);
$spec_rx = mysql_query($query_limit_spec_rx, $testmypms) or die(mysql_error());
$row_spec_rx = mysql_fetch_assoc($spec_rx);
if (isset($_GET['totalRows_spec_rx'])) {
$totalRows_spec_rx = $_GET['totalRows_spec_rx'];
} else {
$all_spec_rx = mysql_query($query_spec_rx);
$totalRows_spec_rx = mysql_num_rows($all_spec_rx);
$totalPages_spec_rx = ceil($totalRows_spec_rx/$maxRows_spec_rx)-1;
$colname_demographics = "1";
if (isset($_GET['pxID'])) {
$colname_demographics = (get_magic_quotes_gpc()) ? $_GET['pxID'] : addslashes($_GET['pxID']);
mysql_select_db($database_testmypms, $testmypms);
$query_demographics = sprintf("SELECT demographics.px_id, demographics.FK_title_id, demographics.firstname, demographics.surname, DATE_FORMAT(demographics.dob, '%%d-%%m-%%Y') as formatted_dob, title.title_id, title.title FROM demographics, title WHERE %s = demographics.px_id AND demographics.FK_title_id = title.title_id", $colname_demographics);
$demographics = mysql_query($query_demographics, $testmypms) or die(mysql_error());
$row_demographics = mysql_fetch_assoc($demographics);
$totalRows_demographics = mysql_num_rows($demographics);
$queryString_spec_rx = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_spec_rx") == false &&
stristr($param, "totalRows_spec_rx") == false) {
array_push($newParams, $param);
if (count($newParams) != 0) {
$queryString_spec_rx = "&" . htmlentities(implode("&", $newParams));
$queryString_spec_rx = sprintf("&totalRows_spec_rx=%d%s", $totalRows_spec_rx, $queryString_spec_rx);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Spec Rx3</title>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
//-->
</script>
</head>
<body>
<p>Spec Rx</p>
<p><?php echo $row_demographics['px_id']; ?></p>
<p><?php echo $row_demographics['title']; ?> <?php echo $row_demographics['firstname']; ?> <?php echo $row_demographics['surname']; ?> <?php echo $row_demographics['formatted_dob']; ?> </p>
<p>
<input name="Add_spec_rx" type="button" id="Add_spec_rx" onClick="MM_goToURL('parent','add_spec_rx.php');return document.MM_returnValue" value="New Rx">
</p>
<p> <a href="<?php printf("%s?pageNum_spec_rx=%d%s", $currentPage, max(0, $pageNum_spec_rx - 1), $queryString_spec_rx); ?>">Previous</a> <a href="<?php printf("%s?pageNum_spec_rx=%d%s", $currentPage, min($totalPages_spec_rx, $pageNum_spec_rx + 1), $queryString_spec_rx); ?>">Next</a></p>
<?php do { ?>
<table border="1" cellspacing="1" cellpadding="5">
<tr>
<td> </td>
<td><?php echo $row_spec_rx['formatted_rx_date']; ?></td>
<td><?php echo $row_spec_rx['spec_rx_id']; ?></td>
<td>locked:
<input <?php if (!(strcmp($row_spec_rx['locked'],1))) {echo "checked";} ?> name="locked" type="checkbox" id="locked" value="1"></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>Sph</td>
<td>Cyl</td>
<td>Axis</td>
<td>HPrism</td>
<td>HPrismBase</td>
<td>VPrism</td>
<td>VPrismBase</td>
<td>NrAdd</td>
<td>NrHPrism </td>
<td>NrHPrismBase</td>
<td>NrVPrism</td>
<td>NrVPrismBase</td>
<td>IntAdd</td>
<td>IntHPrism</td>
<td>IntHPrismBase</td>
<td>IntVPrism</td>
<td>IntVPrismBase</td>
</tr>
<tr>
<td>R</td>
<td><?php echo ($row_spec_rx['spec_rx_rsph']<>null) ? sprintf ("%+4.2f",$row_spec_rx['spec_rx_rsph']) : null; ?></td>
<td><?php echo ($row_spec_rx['spec_rx_rcyl']<>null) ? sprintf ("%+4.2f",$row_spec_rx['spec_rx_rcyl']) : null; ?></td>
<td><?php echo $row_spec_rx['spec_rx_raxis']; ?></td>
<td><?php echo $row_spec_rx['spec_rx_rhprism']; ?></td>
<td><?php echo $row_spec_rx['spec_rx_rhprismbase']; ?></td>
<td><?php echo $row_spec_rx['spec_rx_rvprism']; ?></td>
<td><?php echo $row_spec_rx['spec_rx_rvprismbase']; ?></td>
<td><?php echo $row_spec_rx['spec_rx_rnadd']; ?></td>
<td><?php echo $row_spec_rx['spec_rx_rnhprism']; ?></td>
<td><?php echo $row_spec_rx['spec_rx_rnhprismbase']; ?></td>
<td><?php echo $row_spec_rx['spec_rx_rnvprism']; ?></td>
<td><?php echo $row_spec_rx['spec_rx_rnvprismbase']; ?></td>
<td><?php echo $row_spec_rx['spec_rx_rintadd']; ?></td>
<td><?php echo $row_spec_rx['spec_rx_rinthprism']; ?></td>
<td><?php echo $row_spec_rx['spec_rx_rinthprismbase']; ?></td>
<td><?php echo $row_spec_rx['spec_rx_rintvprism']; ?></td>
<td><?php echo $row_spec_rx['spec_rx_rintvprismbase']; ?></td>
</tr>
<tr>
<td>L</td>
<td><?php echo ($row_spec_rx['spec_rx_lsph']<>null) ? sprintf ("%+4.2f",$row_spec_rx['spec_rx_lsph']) : null; ?></td>
<td><?php echo ($row_spec_rx['spec_rx_lcyl']<>null) ? sprintf ("%+4.2f",$row_spec_rx['spec_rx_lcyl']) : null; ?></td>
<td><?php echo $row_spec_rx['spec_rx_laxis']; ?></td>
<td><?php echo $row_spec_rx['spec_rx_lhprism']; ?></td>
<td><?php echo $row_spec_rx['spec_rx_lhprismbase']; ?></td>
<td><?php echo $row_spec_rx['spec_rx_lvprism']; ?></td>
<td><?php echo $row_spec_rx['spec_rx_lvprismbase']; ?></td>
<td><?php echo $row_spec_rx['spec_rx_lnadd']; ?></td>
<td><?php echo $row_spec_rx['spec_rx_lnhprism']; ?></td>
<td><?php echo $row_spec_rx['spec_rx_lnhprismbase']; ?></td>
<td><?php echo $row_spec_rx['spec_rx_lnvprism']; ?></td>
<td><?php echo $row_spec_rx['spec_rx_lnvprismbase']; ?></td>
<td><?php echo $row_spec_rx['spec_rx_lintadd']; ?></td>
<td><?php echo $row_spec_rx['spec_rx_linthprism']; ?></td>
<td><?php echo $row_spec_rx['spec_rx_linthprismbase']; ?></td>
<td><?php echo $row_spec_rx['spec_rx_lintvprism']; ?></td>
<td><?php echo $row_spec_rx['spec_rx_lintvprismbase']; ?></td>
</tr>
<tr>
<td> </td>
<td>User ID <?php echo $row_spec_rx['user_id']; ?></td>
<td><?php echo $row_spec_rx['user_firstname']; ?></td>
<td><?php echo $row_spec_rx['user_surname']; ?></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<p> </p>
<?php } while ($row_spec_rx = mysql_fetch_assoc($spec_rx)); ?>
<p> </p>
<p> </p>
<p> </p>
</body>
</html>
<?php
mysql_free_result($spec_rx);
mysql_free_result($demographics);
?>Thanks for your help, nearly worked but only returned results where the if statement was met ie where locked =0, so I used an additional statement to display something else when when locked=1
<?php
if($row_spec_rx['locked'] == 1) {
echo "button html goes here";
?>
<?php
if($row_spec_rx['locked'] == 0) {
echo "something else";
?>
I am sure there must be a more elegant way of doing this! -
[resolved] Can not install mysql
Oooops, I fixed it. Somehow /tmp had wrong permissions..
Hello,
after an upgrade my mysql dameon did not work anymore so I did what https://bbs.archlinux.org/viewtopic.php?pid=889846 says and removed all configs and removed it.
Now pacman -S mysql gives my this
# pacman -S mysql
resolving dependencies...
looking for inter-conflicts...
Targets (1): mysql-5.5.11-1
Total Download Size: 0.00 MB
Total Installed Size: 62.59 MB
Proceed with installation? [Y/n] y
(1/1) checking package integrity [################################################] 100%
(1/1) checking for file conflicts [################################################] 100%
(1/1) installing mysql [################################################] 100%
Installing MySQL system tables...
ERROR: 1 Can't create/write to file '/tmp/#sql_1d4d_0.MYI' (Errcode: 13)
110503 9:20:58 [ERROR] Aborting
110503 9:20:58 [Note] /usr/bin/mysqld: Shutdown complete
Installation of system tables failed! Examine the logs in
/var/lib/mysql for more information.
You can try to start the mysqld daemon with:
shell> /usr/bin/mysqld --skip-grant &
and use the command line tool /usr/bin/mysql
to connect to the mysql database and look at the grant tables:
shell> /usr/bin/mysql -u root mysql
mysql> show tables
Try 'mysqld --help' if you have problems with paths. Using --log
gives you a log in /var/lib/mysql that may be helpful.
Please consult the MySQL manual section
'Problems running mysql_install_db', and the manual section that
describes problems on your OS. Another information source are the
MySQL email archives available at http://lists.mysql.com/.
Please check all of the above before mailing us! And remember, if
you do mail us, you MUST use the /usr/scripts/mysqlbug script!
Optional dependencies for mysql
perl-dbi
perl-dbd-mysql
The hostname.err contains
110503 09:29:53 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
110503 9:29:53 InnoDB: The InnoDB memory heap is disabled
110503 9:29:53 InnoDB: Mutexes and rw_locks use GCC atomic builtins
110503 9:29:53 InnoDB: Compressed tables use zlib 1.2.5
/usr/bin/mysqld: Can't create/write to file '/tmp/ibwoHE0m' (Errcode: 13)
110503 9:29:54 InnoDB: Error: unable to create temporary file; errno: 13
110503 9:29:54 [ERROR] Plugin 'InnoDB' init function returned error.
110503 9:29:54 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
110503 9:29:54 [ERROR] Unknown/unsupported storage engine: InnoDB
110503 9:29:54 [ERROR] Aborting
110503 9:29:54 [Note] /usr/bin/mysqld: Shutdown complete
110503 09:29:54 mysqld_safe mysqld from pid file /var/lib/mysql/icarus.pid ended
And my my.cnl (I didnt touch it)
1 # MySQL config file for medium systems.
2 #
3 # This is for a system with little memory (32M - 64M) where MySQL plays
4 # an important part, or systems up to 128M where MySQL is used together with
5 # other programs (such as a web server)
6 #
7 # MySQL programs look for option files in a set of
8 # locations which depend on the deployment platform.
9 # You can copy this option file to one of those
10 # locations. For information about these locations, see:
11 # http://dev.mysql.com/doc/mysql/en/option-files.html
12 #
13 # In this file, you can use all long options that a program supports.
14 # If you want to know which options a program supports, run the program
15 # with the "--help" option.
16
17 # The following options will be passed to all MySQL clients
18 [client]
19 #password = your_password
20 port = 3306
21 socket = /var/run/mysqld/mysqld.sock
22
23 # Here follows entries for some specific programs
24
25 # The MySQL server
26 [mysqld]
27 port = 3306
28 socket = /var/run/mysqld/mysqld.sock
29 datadir = /var/lib/mysql
30 skip-external-locking
31 key_buffer_size = 16M
32 max_allowed_packet = 1M
33 table_open_cache = 64
34 sort_buffer_size = 512K
35 net_buffer_length = 8K
36 read_buffer_size = 256K
37 read_rnd_buffer_size = 512K
38 myisam_sort_buffer_size = 8M
39
40 # Don't listen on a TCP/IP port at all. This can be a security enhancement,
41 # if all processes that need to connect to mysqld run on the same host.
42 # All interaction with mysqld must be made via Unix sockets or named pipes.
43 # Note that using this option without enabling named pipes on Windows
44 # (via the "enable-named-pipe" option) will render mysqld useless!
45 #
46 skip-networking
47
48 # Replication Master Server (default)
49 # binary logging is required for replication
50 log-bin=mysql-bin
51
52 # binary logging format - mixed recommended
53 binlog_format=mixed
54
55 # required unique id between 1 and 2^32 - 1
56 # defaults to 1 if master-host is not set
57 # but will not function as a master if omitted
58 server-id = 1
59
60 # Replication Slave (comment out master section to use this)
61 #
62 # To configure this host as a replication slave, you can choose between
63 # two methods :
64 #
65 # 1) Use the CHANGE MASTER TO command (fully described in our manual) -
66 # the syntax is:
67 #
68 # CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
69 # MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
70 #
71 # where you replace <host>, <user>, <password> by quoted strings and
72 # <port> by the master's port number (3306 by default).
73 #
74 # Example:
75 #
76 # CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
77 # MASTER_USER='joe', MASTER_PASSWORD='secret';
78 #
79 # OR
80 #
81 # 2) Set the variables below. However, in case you choose this method, then
82 # start replication for the first time (even unsuccessfully, for example
83 # if you mistyped the password in master-password and the slave fails to
84 # connect), the slave will create a master.info file, and any later
85 # change in this file to the variables' values below will be ignored and
86 # overridden by the content of the master.info file, unless you shutdown
87 # the slave server, delete master.info and restart the slaver server.
88 # For that reason, you may want to leave the lines below untouched
89 # (commented) and instead use CHANGE MASTER TO (see above)
90 #
91 # required unique id between 2 and 2^32 - 1
92 # (and different from the master)
93 # defaults to 2 if master-host is set
94 # but will not function as a slave if omitted
95 #server-id = 2
96 #
97 # The replication master for this slave - required
98 #master-host = <hostname>
99 #
100 # The username the slave will use for authentication when connecting
101 # to the master - required
102 #master-user = <username>
103 #
104 # The password the slave will authenticate with when connecting to
105 # the master - required
106 #master-password = <password>
107 #
108 # The port the master is listening on.
109 # optional - defaults to 3306
110 #master-port = <port>
111 #
112 # binary logging - not required for slaves, but recommended
113 #log-bin=mysql-bin
114
115 # Uncomment the following if you are using InnoDB tables
116 #innodb_data_home_dir = /var/lib/mysql
117 #innodb_data_file_path = ibdata1:10M:autoextend
118 #innodb_log_group_home_dir = /var/lib/mysql
119 # You can set .._buffer_pool_size up to 50 - 80 %
120 # of RAM but beware of setting memory usage too high
121 #innodb_buffer_pool_size = 16M
122 #innodb_additional_mem_pool_size = 2M
123 # Set .._log_file_size to 25 % of buffer pool size
124 #innodb_log_file_size = 5M
125 #innodb_log_buffer_size = 8M
126 #innodb_flush_log_at_trx_commit = 1
127 #innodb_lock_wait_timeout = 50
128
129 [mysqldump]
130 quick
131 max_allowed_packet = 16M
132
133 [mysql]
134 no-auto-rehash
135 # Remove the next comment character if you are not familiar with SQL
136 #safe-updates
137
138 [myisamchk]
139 key_buffer_size = 20M
140 sort_buffer_size = 20M
141 read_buffer = 2M
142 write_buffer = 2M
143
144 [mysqlhotcopy]
145 interactive-timeout
I can't start mysql daemon, it says "FAIL"
Last edited by cyberius (2011-05-03 08:35:56)hi DILIPDKJ,
Just to verify, is this the PowerDVD software that you're trying to install?
PowerDVD 10 BD
v10.0.3029.52
IN12STW153WW5.exe
114 MB
Regards
Did someone help you today? Press the star on the left to thank them with a Kudo!
If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"! This will help the rest of the Community with similar issues identify the verified solution and benefit from it.
Follow @LenovoForums on Twitter!
Maybe you are looking for
-
Fill in the blanks...
Alright so I have this asteroid project I am having to do for a class... I pretty much have to make the asteroids game out of a template he gave us... I have a lot of it done but There are probably like 12ish blanks I need help fiilling in. He gives
-
Restructuring Small Bus Network on RV016
Hello. I have been with a fast paced growing business the past 9 years. When we started we maybe had 10 devices or so on the computer network, we now probably have a couple hundred or so. We are planning on expanding even more and I am looking into r
-
USB Keyboard not working on MBP
Hi, I have a mechanical usb keyboard (PC) that I like to use, but it isn't working on my 2010 MBP. I did a bit of googling & a series of experiments to figure out the problem, but I am no closer to a satisfactory solution. Here are my observations: 1
-
Hi all, I am not assigning MM with any Tax procedure as i dont have to take credit of it. So while po creation no tax code is required. But in MIRO it is asking for tax code. Please suggest can i have no FI procedure linking in MM. If yes, then how t
-
When I tried to start the names server on my Linux Server, it can't be started, just error messages shown: NAMESCTL> start Starting "/u03/app/oracle/product/8.1.7/bin/names"...server not started, errors follow TNS-12546: TNS:permission denied TNS-125