<DIV>Dear list partners,</DIV>
<DIV>&nbsp;</DIV>
<DIV>In the last few days I have been trying to link my map file to a table in a MySQL database.</DIV>
<DIV>I must say I haven't had much success finding documentation on how to do this...</DIV>
<DIV>So I would like to ask for some help.</DIV>
<DIV>&nbsp;</DIV>
<DIV>So far, the map files I used are:</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;LAYER<BR>&nbsp;&nbsp;&nbsp; &nbsp;NAME comuni<BR>&nbsp;&nbsp;&nbsp; &nbsp;TYPE POLYGON<BR>&nbsp;&nbsp;&nbsp; &nbsp;STATUS DEFAULT<BR>&nbsp;&nbsp;LABELITEM 'Nomecomune'</DIV>
<DIV>&nbsp;&nbsp;&nbsp;CONNECTIONTYPE OGR<BR>&nbsp;&nbsp;&nbsp;CONNECTION "C:\Programmi\Apache Group\Apache\htdocs\abruzzo\maps\data\comuni_abruzzo_gb.shp"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;DATA "SELECT * FROM comuni_abruzzo_gb LEFT JOIN 'ODBC:prova'.zzz ON comuni_abruzzo_gb.Id = zzz.ID"<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;CLASSITEM FIELD<BR>&nbsp;&nbsp;CLASS<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;NAME '&lt;3'<BR>&nbsp;&nbsp; &nbsp;&nbsp;EXPRESSION ([FIELD] &lt; (3))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;STYLE<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;OUTLINECOLOR 255 255 255<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;COLOR 215 050 085<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;END<BR>&nbsp;&nbsp;&nbsp;TEMPLATE void<BR>&nbsp;&nbsp;END<BR>&nbsp;&nbsp;CLASS<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;NAME '&lt;6'<BR>&nbsp;&nbsp; &nbsp;&nbsp;EXPRESSION ([FIELD] &lt; (6))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 &nbsp;&nbsp;STYLE<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;OUTLINECOLOR 255 255 255<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;COLOR 215 150 085<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;END<BR>&nbsp;&nbsp;&nbsp;TEMPLATE void<BR>&nbsp;&nbsp;END<BR>&nbsp;&nbsp;CLASS<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;NAME '&lt;10'<BR>&nbsp;&nbsp; &nbsp;&nbsp;EXPRESSION ([FIELD] &lt; (10))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;STYLE<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;OUTLINECOLOR 255 255 255<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;COLOR 215 250 085<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;END<BR>&nbsp;&nbsp;&nbsp;TEMPLATE void<BR>&nbsp;&nbsp;END</DIV>
<DIV><BR>&nbsp;END<BR></DIV>
<DIV>FIELD is the field according to witch values I want to make my thematic map. These values will change allong the time.</DIV>
<DIV>This example works perfectly with an ODBC for an Access Database. I instaled and configured ODBC for my SQL, but still it does not work. I get this message:</DIV>
<DIV>&nbsp;</DIV>
<DIV><STRONG>Warning</STRONG>: [MapServer Error]: msDrawMap(): Failed to draw layer named 'comuni'. in <B>c:\programmi\apache group\apache\htdocs\abruzzo\_test_odbc.php</B> on line <B>6</B><BR><BR><B>Warning</B>: [MapServer Error]: msOGRFileOpen(): ExecuteSQL(SELECT * FROM comuni_abruzzo_gb LEFT JOIN 'ODBC:prova'.zzz ON comuni_abruzzo_gb.Id = zzz.ID) failed. Unable to initialize ODBC connection to DSN prova, [MySQL][ODBC 3.51 Driver]Access denied for user 'ODBC'@'localhost' (using password: NO) in <B>c:\programmi\apache group\apache\htdocs\abruzzo\_test_odbc.php</B> on line <B>6</B><BR><BR><B>Fatal error</B>: Call to a member function on a non-object in <B>c:\programmi\apache group\apache\htdocs\abruzzo\_test_odbc.php</B> on line <B>7</B><BR></DIV>
<DIV>As if my configuration for the ODBC MySQL was ignored.. Within this configuration I am using a valuable mysql user and an existent password. Here i get&nbsp;a message as if I was trying to get into the system with no settings, user and pass by default.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Anyway, I also tried to make this connection this way:</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;LAYER<BR>&nbsp;&nbsp;&nbsp; &nbsp;NAME comuni<BR>&nbsp;&nbsp;DATA comuni_abruzzo_gb<BR>&nbsp;&nbsp;&nbsp; &nbsp;TYPE POLYGON<BR>&nbsp;&nbsp;&nbsp; &nbsp;STATUS DEFAULT<BR>&nbsp;&nbsp;LABELITEM 'Nomecomune'<BR>&nbsp;&nbsp;JOIN<BR>&nbsp;&nbsp;&nbsp;CONNECTIONTYPE mysql<BR>&nbsp;&nbsp;&nbsp;CONNECTION "server:'localhost' user:'tuna' pass:'caparica' database:'abruzzo'"<BR>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;DATA "SELECT * FROM comuni_abruzzo_gb LEFT JOIN 'ODBC:abr_2'.zzz ON comuni_abruzzo_gb.Id = zzz.ID"<BR>&nbsp;&nbsp;&nbsp;NAME "TM"<BR>&nbsp;&nbsp;&nbsp;TABLE zzz<BR>&nbsp;&nbsp;&nbsp;FROM Id<BR>&nbsp;&nbsp;&nbsp;TO ID<BR>&nbsp;&nbsp;&nbsp;TYPE SINGLE<BR>&nbsp;&nbsp;END<BR>&nbsp;&nbsp;&nbsp; &nbsp;CLASSITEM FIELD<BR>&nbsp;&nbsp;CLASS<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;NAME '&lt;3'<BR>&nbsp;&nbsp; &nbsp;&nbsp;EXPRESSION ([FIELD] &lt; (3))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;STYLE<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 &nbsp;&nbsp;OUTLINECOLOR 255 255 255<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;COLOR 215 050 085<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;END<BR>&nbsp;&nbsp;&nbsp;TEMPLATE void<BR></DIV>
<DIV>But again, this does not work.. This time I get this message:</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR><B>Warning</B>: [MapServer Error]: msDrawMap(): Failed to draw layer named 'comuni'. in <B>c:\programmi\apache group\apache\htdocs\abruzzo\_test_odbc.php</B> on line <B>6</B><BR><BR><B>Warning</B>: [MapServer Error]: msDBFGetItemIndex(): Item 'FIELD' not found. in <B>c:\programmi\apache group\apache\htdocs\abruzzo\_test_odbc.php</B> on line <B>6</B><BR><BR><B>Fatal error</B>: Call to a member function on a non-object in <B>c:\programmi\apache group\apache\htdocs\abruzzo\_test_odbc.php</B> on line <B>7</B></DIV>
<DIV><STRONG></STRONG>&nbsp;</DIV>
<DIV>Can someone give me a hand with this?</DIV>
<DIV>I' ve been searching for documentation and/or examples in the net but so far I just cannot have clear ideas about how to use/what's the sintax of&nbsp;some of the elements of the map file..</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks a lot in advance.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Joao Antunes</DIV>
<DIV><STRONG></STRONG>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV><p>
                <hr size=1> <font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a href="http://uk.rd.yahoo.com/mail/taglines/default/messenger/*http://uk.messenger.yahoo.com"><strong><font face="Arial, Helvetica, sans-serif">ALL-NEW
Yahoo! Messenger</font></strong></a><font face="Arial, Helvetica, sans-serif"><strong>
- all new features - even more fun!</strong></font><strong><font color="#FF9900">
</font></strong></font>