\documentclass[a4paper]{article}
\usepackage{ifthen}
\begin{document}
\texdbconnection{dbi:odbc:ACM301}
\texdbdef{##products}{select ct_name from changetype}{##prodname}
\newcounter{mycolumn}
\setcounter{mycolumn}{0}
\begin{tabular}{|l|l|l|l|}
\hline
\texdbfor{##products}{
\ifthenelse{\value{mycolumn}=4}{\\ \hline \setcounter{mycolumn}{0} }{} % begin new row
##prodname  % table cell stuff
\stepcounter{mycolumn}
\ifthenelse{\value{mycolumn}=4}{}{&} % cell separator unless last cell in row
}%%  ok
%Now fill up last row with empty cells
\ifthenelse{\value{mycolumn}=0}{}{
\ifthenelse{\value{mycolumn}=3}{}{&\stepcounter{mycolumn}} 
\ifthenelse{\value{mycolumn}=3}{}{&\stepcounter{mycolumn}} 
\ifthenelse{\value{mycolumn}=3}{}{&\stepcounter{mycolumn}} 
\\ \hline }
\end{tabular}
\end{document}
