The <sql> task does not automaticylly use any
classpath reference defined in the build file, you
need to tell it about the classpath using in
this case the attribute classpathref
            <sql
                      driver="com.mysql.jdbc.Driver"
                      url="jdbc:mysql//localhost:3306/BROWSE"
                      userid="XXXXX"
                      password="YYYYY"
                      classpathref="projet.classpath"
              ><![CDATA[
                      show tables;
              ]]>
              </sql>

Peter

On 1/20/07, Farid Izem <[EMAIL PROTECTED]> wrote:
Hi julying,

My jdbc driver is in lib directory there is no problem.
My main problem is the simple build.xml script doesn't work at all
To specify the classpath :


<project basedir="/projets/ESE/esepro02" default="mysql">

        <description>
                main project with many futures
        </description>

        <path id="projet.classpath">
            <pathelement location="classes/" />
            <pathelement location="lib/" />
        </path>

        <target name="mysql">
                <classpath refid="projet.classpath" />
                <echo message="Hello World" />
        </target>

</project>
i have still the problem with the classpath tag.

I can't see what i am doing wrong.

Thanks for you help.

Kind Regards,

Farid.

On 1/20/07, julying <[EMAIL PROTECTED]> wrote:
>
>
> make sure your mysql connector is the right version to your driver class!
> and you can use some ant debug tools to print the stracktrace of it's
> procession to make sure
> your lib is in !
> ------------------
> julying
> 2007-01-20
>
> -------------------------------------------------------------
> 发件人:Farid Izem
> 发送日期:2007-01-20 06:39:24
> [EMAIL PROTECTED]
> 抄送:
> 主题:Question about Classpath
>
> Hi all,
>
> I'm new to ant and i d'like to make a connexion to a mysql database.
> To do that, i hava done the following scripts :
>
>
> <project basedir="/projets/ESE/esepro02" default="mysql">
>
>        <description>
>                main project with many futures
>        </description>
>
>        <path id="projet.classpath">
>            <pathelement location="classes/" />
>            <pathelement location="lib/" />
>        </path>
>
>
>        <target name="mysql">
>                <sql
>                        driver="com.mysql.jdbc.Driver"
>                        url="jdbc:mysql//localhost:3306/BROWSE"
>                        userid="XXXXX"
>                        password="YYYYY"
>                ><![CDATA[
>                        show tables;
>                ]]>
>                </sql>
>        </target>
>
> </project>
>
> But, i get the following error :
>
> mysql:
>
> BUILD FAILED
> /LNXVOL01/projets/ESE/esepro02/build2.xml:19: Class Not Found: JDBC driver
> com.mysql.jdbc.Driver could not be loaded
>
> I try adding <classpath refid="projet.classpath" /> in the mysql task
> without success, i get the following error :
>
> Buildfile: build2.xml
>
> mysql:
>
> BUILD FAILED
> /LNXVOL01/projets/ESE/esepro02/build2.xml:14: Problem: failed to create
> task
> or type classpath
> Cause: The name is undefined.
> Action: Check the spelling.
> Action: Check that any custom tasks/types have been declared.
> Action: Check that any <presetdef>/<macrodef> declarations have taken
> place.
>
> Can anyone help solving this issue with the classpath element.
>
> I'm using ant 1.7.0 and JVM 1.5.0_10-b03
>
>
>
> Kind Regards,
>
> Farid
>
>
>

Reply via email to