Archive

Posts Tagged ‘mysql’

MySQL – Select records matching date, ignoring the time portion

May 29th, 2010 Karthikeyan C No comments

Let us assume you have tasks scheduled for a given day in a planner. You wish to select all tasks in the given day. The following query will serve the purpose (the DATE function does the trick)


select * from task where DATE(startdatetime) = DATE('2010-05-29');
  • Share/Bookmark
Categories: Development Tags:

Validating MySQL database Connection when fetched from a pool using DataSource

April 2nd, 2010 Karthikeyan C No comments

My friend was using Tomcat and MySQL database. He had configured a datasource and as his web application was relatively new, users to his website were very less. As a result the connections were timed out after the default timeout period and exceptions were thrown.

One of the solution to avoid this scenario is to add attributes to validate the connection when borrowing.


<Context path="" reloadable="false" docBase="/home/pathtoapp">
 <Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource"
 maxActive="30" maxIdle="10" maxWait="4000"
 username="username" password="password" driverClassName="com.mysql.jdbc.Driver"
 url="jdbc:mysql://localhost:portnum/dbname" validationQuery="SELECT 1" testOnBorrow="true" />
 </Context>
  • Share/Bookmark
Categories: Development Tags: ,

MySQL database schema browser and SQL executor in Ubuntu 9.10

November 26th, 2009 Karthikeyan C 1 comment

To install MySQL database schema browser,  SQL executor and administrator, use the following command. It gives a cool GUI for  us to work with.


sudo apt-get install mysql-query-browser mysql-admin
  • Share/Bookmark