Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MySQL table last update

 
Alaneus Kingingestingest
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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/
 
Alaneus Kingingestingest
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, but do you know how to read platform on which is MySQL (Win, Mac, Linux)?
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for help, I found that you can use something like:

for getting system variables
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic