This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes MySQL table last update Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "MySQL table last update" Watch "MySQL table last update" New topic
Author

MySQL table last update

Alaneus Kingingestingest
Greenhorn

Joined: Dec 17, 2008
Posts: 12
MySQL keeps track of last update made on table. This feature does not work if MySQL is running on windows platform or if database uses INNODB.
While running application needs to know that feature is not supported.
In phpmyadmin I saw system variables "storage engine" and "version compile os" that hold information about that.
So how can I get values of these variables from java, or is there other solutions of getting to know these values? Maybe by DatabaseMetaData?

Thanks
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2904
    
    1

Just query the MySQL and read the results, which tell you which storage engine is being used for which schema.
About SQL query, read:
http://www.electrictoolbox.com/mysql-table-storage-engine/


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Alaneus Kingingestingest
Greenhorn

Joined: Dec 17, 2008
Posts: 12
Thanks, but do you know how to read platform on which is MySQL (Win, Mac, Linux)?
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2904
    
    1

Nope, I don't know nor Google search show any hint. You gotta find out the other way, like reading the system info of db server.
James Ward
Ranch Hand

Joined: Apr 27, 2003
Posts: 263
If you want to automatically store the row update time on a MySQL Table Row, you can have a column like this on the table:

`modified` timestamp NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP

The modified column is automatically updated, if a new row is inserted OR that row is updated.
Alaneus Kingingestingest
Greenhorn

Joined: Dec 17, 2008
Posts: 12
Thanks for help, I found that you can use something like:

for getting system variables
 
Have you checked out Aspose?
 
subject: MySQL table last update
 
jQuery in Action, 3rd edition