newbie can't connect to/export from MySQL with ant task

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

newbie can't connect to/export from MySQL with ant task

Bullard, Jeffrey W. Dr.
Hi,

I'm trying to export a MySQL database using DdlUtils.  I went through  
a tutorial (http://db.apache.org/derby/integrate/db_ddlutils.html)  
that showed how to export a derby DB and I'm trying to modify the  
build.xml file to do the same thing for a MySQL database on my local  
machine.  The build.xml file is copied below.

When I run "ant export-source-db", I get the following error:

BUILD FAILED
build.xml:16: Could not read the schema from the specified database:  
Could not get a connection from the datasource

I have no doubt that my line 16 is wrong, but I cannot find any  
information about the correct format for connecting to a MySQL  
database.  The full path to the database on my machine is /usr/local/
mysql/data/vcctl_user

Other information:  My mysql server is definitely running on the  
machine, and the vcctl_user database can be accessed from within  
mysql from the command line (show tables, etc.).

Thanks in advance for any help about how I can properly connect to  
MySQL database.

<?xml version="1.0"?>
<project name="MigrateToDerby" basedir=".">

    <path id="classpath">
       <fileset dir="./lib">
          <include name="**/*.jar"/>
       </fileset>
    </path>

    <target name="export-source-db" description="Dumps db structure  
and data">
       <taskdef name="databaseToDdl"
               classname="org.apache.ddlutils.task.DatabaseToDdlTask">
          <classpath refid="classpath"/>
       </taskdef>

       <databaseToDdl modelName="MigrateTest">
           <database url="jdbc:mysql://localhost:3306/vcctl_user"
                  driverClassName="com.mysql.jdbc.Driver"
                  username="root"
                  password="vcctl7"/>

          <writeSchemaToFile outputFile="db-schema.xml"/>
          <writeDataToFile outputFile="data.xml"/>
       </databaseToDdl>

    </target>
</project>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: newbie can't connect to/export from MySQL with ant task

Thomas Dudziak
Could you increase the verbosity of the task (see
http://db.apache.org/ddlutils/ant/org.apache.ddlutils.task.DatabaseToDdlTask.html)
to debug to get more detail logging, and post that here ?

Tom

On Wed, Jan 13, 2010 at 11:20, Jeffrey W. Bullard
<[hidden email]> wrote:

> Hi,
>
> I'm trying to export a MySQL database using DdlUtils.  I went through a
> tutorial (http://db.apache.org/derby/integrate/db_ddlutils.html) that showed
> how to export a derby DB and I'm trying to modify the build.xml file to do
> the same thing for a MySQL database on my local machine.  The build.xml file
> is copied below.
>
> When I run "ant export-source-db", I get the following error:
>
> BUILD FAILED
> build.xml:16: Could not read the schema from the specified database: Could
> not get a connection from the datasource
>
> I have no doubt that my line 16 is wrong, but I cannot find any information
> about the correct format for connecting to a MySQL database.  The full path
> to the database on my machine is /usr/local/mysql/data/vcctl_user
>
> Other information:  My mysql server is definitely running on the machine,
> and the vcctl_user database can be accessed from within mysql from the
> command line (show tables, etc.).
>
> Thanks in advance for any help about how I can properly connect to MySQL
> database.
>
> <?xml version="1.0"?>
> <project name="MigrateToDerby" basedir=".">
>
>   <path id="classpath">
>      <fileset dir="./lib">
>         <include name="**/*.jar"/>
>      </fileset>
>   </path>
>
>   <target name="export-source-db" description="Dumps db structure and data">
>      <taskdef name="databaseToDdl"
>              classname="org.apache.ddlutils.task.DatabaseToDdlTask">
>         <classpath refid="classpath"/>
>      </taskdef>
>
>      <databaseToDdl modelName="MigrateTest">
>          <database url="jdbc:mysql://localhost:3306/vcctl_user"
>                 driverClassName="com.mysql.jdbc.Driver"
>                 username="root"
>                 password="vcctl7"/>
>
>         <writeSchemaToFile outputFile="db-schema.xml"/>
>         <writeDataToFile outputFile="data.xml"/>
>      </databaseToDdl>
>
>   </target>
> </project>
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: newbie can't connect to/export from MySQL with ant task

Bullard, Jeffrey W. Dr.
I added the verbosity parameter to the task like this in the  
build.xml file:

<databaseToDdl modelName="MigrateTest" verbosity="debug">
     <database url="jdbc:mysql://localhost:3306/vcctl_user"
         driverClassName="com.mysql.jdbc.Driver"
         username="root"
         password="vcctl7"/>

     <writeSchemaToFile outputFile="db-schema.xml"/>
     <writeDataToFile outputFile="data.xml"/>
</databaseToDdl>

but the output to stdout is exactly the same as before.  Is there a  
log file somewhere that I should be checking?

Jeff

On Jan 13, 2010, at 3:29 PM, Thomas Dudziak wrote:

> Could you increase the verbosity of the task (see
> http://db.apache.org/ddlutils/ant/ 
> org.apache.ddlutils.task.DatabaseToDdlTask.html)
> to debug to get more detail logging, and post that here ?
>
> Tom
>
> On Wed, Jan 13, 2010 at 11:20, Jeffrey W. Bullard
> <[hidden email]> wrote:
>> Hi,
>>
>> I'm trying to export a MySQL database using DdlUtils.  I went  
>> through a
>> tutorial (http://db.apache.org/derby/integrate/db_ddlutils.html)  
>> that showed
>> how to export a derby DB and I'm trying to modify the build.xml  
>> file to do
>> the same thing for a MySQL database on my local machine.  The  
>> build.xml file
>> is copied below.
>>
>> When I run "ant export-source-db", I get the following error:
>>
>> BUILD FAILED
>> build.xml:16: Could not read the schema from the specified  
>> database: Could
>> not get a connection from the datasource
>>
>> I have no doubt that my line 16 is wrong, but I cannot find any  
>> information
>> about the correct format for connecting to a MySQL database.  The  
>> full path
>> to the database on my machine is /usr/local/mysql/data/vcctl_user
>>
>> Other information:  My mysql server is definitely running on the  
>> machine,
>> and the vcctl_user database can be accessed from within mysql from  
>> the
>> command line (show tables, etc.).
>>
>> Thanks in advance for any help about how I can properly connect to  
>> MySQL
>> database.
>>
>> <?xml version="1.0"?>
>> <project name="MigrateToDerby" basedir=".">
>>
>>   <path id="classpath">
>>      <fileset dir="./lib">
>>         <include name="**/*.jar"/>
>>      </fileset>
>>   </path>
>>
>>   <target name="export-source-db" description="Dumps db structure  
>> and data">
>>      <taskdef name="databaseToDdl"
>>              classname="org.apache.ddlutils.task.DatabaseToDdlTask">
>>         <classpath refid="classpath"/>
>>      </taskdef>
>>
>>      <databaseToDdl modelName="MigrateTest">
>>          <database url="jdbc:mysql://localhost:3306/vcctl_user"
>>                 driverClassName="com.mysql.jdbc.Driver"
>>                 username="root"
>>                 password="vcctl7"/>
>>
>>         <writeSchemaToFile outputFile="db-schema.xml"/>
>>         <writeDataToFile outputFile="data.xml"/>
>>      </databaseToDdl>
>>
>>   </target>
>> </project>
>>
>>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: newbie can't connect to/export from MySQL with ant task

Thomas Dudziak
Since Ddlutils doesn't do anything unusual as far as JDBC is
concerned, could you try to connect with that connection information
and the same driver jar, e.g. by using SquirrelSQL or something
similar (but Java/JDBC based) ?

Tom

On Wed, Jan 13, 2010 at 12:45, Jeffrey W. Bullard
<[hidden email]> wrote:

> I added the verbosity parameter to the task like this in the build.xml file:
>
> <databaseToDdl modelName="MigrateTest" verbosity="debug">
>    <database url="jdbc:mysql://localhost:3306/vcctl_user"
>        driverClassName="com.mysql.jdbc.Driver"
>        username="root"
>        password="vcctl7"/>
>
>    <writeSchemaToFile outputFile="db-schema.xml"/>
>    <writeDataToFile outputFile="data.xml"/>
> </databaseToDdl>
>
> but the output to stdout is exactly the same as before.  Is there a log file
> somewhere that I should be checking?
>
> Jeff
>
> On Jan 13, 2010, at 3:29 PM, Thomas Dudziak wrote:
>
>> Could you increase the verbosity of the task (see
>>
>> http://db.apache.org/ddlutils/ant/org.apache.ddlutils.task.DatabaseToDdlTask.html)
>> to debug to get more detail logging, and post that here ?
>>
>> Tom
>>
>> On Wed, Jan 13, 2010 at 11:20, Jeffrey W. Bullard
>> <[hidden email]> wrote:
>>>
>>> Hi,
>>>
>>> I'm trying to export a MySQL database using DdlUtils.  I went through a
>>> tutorial (http://db.apache.org/derby/integrate/db_ddlutils.html) that
>>> showed
>>> how to export a derby DB and I'm trying to modify the build.xml file to
>>> do
>>> the same thing for a MySQL database on my local machine.  The build.xml
>>> file
>>> is copied below.
>>>
>>> When I run "ant export-source-db", I get the following error:
>>>
>>> BUILD FAILED
>>> build.xml:16: Could not read the schema from the specified database:
>>> Could
>>> not get a connection from the datasource
>>>
>>> I have no doubt that my line 16 is wrong, but I cannot find any
>>> information
>>> about the correct format for connecting to a MySQL database.  The full
>>> path
>>> to the database on my machine is /usr/local/mysql/data/vcctl_user
>>>
>>> Other information:  My mysql server is definitely running on the machine,
>>> and the vcctl_user database can be accessed from within mysql from the
>>> command line (show tables, etc.).
>>>
>>> Thanks in advance for any help about how I can properly connect to MySQL
>>> database.
>>>
>>> <?xml version="1.0"?>
>>> <project name="MigrateToDerby" basedir=".">
>>>
>>>  <path id="classpath">
>>>     <fileset dir="./lib">
>>>        <include name="**/*.jar"/>
>>>     </fileset>
>>>  </path>
>>>
>>>  <target name="export-source-db" description="Dumps db structure and
>>> data">
>>>     <taskdef name="databaseToDdl"
>>>             classname="org.apache.ddlutils.task.DatabaseToDdlTask">
>>>        <classpath refid="classpath"/>
>>>     </taskdef>
>>>
>>>     <databaseToDdl modelName="MigrateTest">
>>>         <database url="jdbc:mysql://localhost:3306/vcctl_user"
>>>                driverClassName="com.mysql.jdbc.Driver"
>>>                username="root"
>>>                password="vcctl7"/>
>>>
>>>        <writeSchemaToFile outputFile="db-schema.xml"/>
>>>        <writeDataToFile outputFile="data.xml"/>
>>>     </databaseToDdl>
>>>
>>>  </target>
>>> </project>
>>>
>>>
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: newbie can't connect to/export from MySQL with ant task

Bullard, Jeffrey W. Dr.

Thanks, Tom, that was a big help, and now the problem seems to be solved.  Here's what I did:
I installed SquirrelSQL and tried to connect to the same MySQL database, and I received the following error when I tried to specify the com.mysql.jdbc.Driver driver:

Could not find class com.mysql.jdbc.Driver in neither the Java class path nor the Extra class path of the MySQL Driver driver definition:
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

So the driver wasn't found, which led me to suspect that the mysql-connector-java-3.1.12-bin.jar was not in my CLASSPATH.  So I added it to my CLASSPATH and now everything seems to be working fine.  Not really a DdlUtils issue after all, but you really helped me out.  Thanks again.

Jeff

On 1/13/10 3:48 PM, "Thomas Dudziak" <[hidden email]> wrote:

Since Ddlutils doesn't do anything unusual as far as JDBC is
concerned, could you try to connect with that connection information
and the same driver jar, e.g. by using SquirrelSQL or something
similar (but Java/JDBC based) ?

Tom

On Wed, Jan 13, 2010 at 12:45, Jeffrey W. Bullard
<[hidden email]> wrote:

> I added the verbosity parameter to the task like this in the build.xml file:
>
> <databaseToDdl modelName="MigrateTest" verbosity="debug">
>    <database url="jdbc:mysql://localhost:3306/vcctl_user"
>        driverClassName="com.mysql.jdbc.Driver"
>        username="root"
>        password="vcctl7"/>
>
>    <writeSchemaToFile outputFile="db-schema.xml"/>
>    <writeDataToFile outputFile="data.xml"/>
> </databaseToDdl>
>
> but the output to stdout is exactly the same as before.  Is there a log file
> somewhere that I should be checking?
>
> Jeff
>
> On Jan 13, 2010, at 3:29 PM, Thomas Dudziak wrote:
>
>> Could you increase the verbosity of the task (see
>>
>> http://db.apache.org/ddlutils/ant/org.apache.ddlutils.task.DatabaseToDdlTask.html)
>> to debug to get more detail logging, and post that here ?
>>
>> Tom
>>
>> On Wed, Jan 13, 2010 at 11:20, Jeffrey W. Bullard
>> <[hidden email]> wrote:
>>>
>>> Hi,
>>>
>>> I'm trying to export a MySQL database using DdlUtils.  I went through a
>>> tutorial (http://db.apache.org/derby/integrate/db_ddlutils.html) that
>>> showed
>>> how to export a derby DB and I'm trying to modify the build.xml file to
>>> do
>>> the same thing for a MySQL database on my local machine.  The build.xml
>>> file
>>> is copied below.
>>>
>>> When I run "ant export-source-db", I get the following error:
>>>
>>> BUILD FAILED
>>> build.xml:16: Could not read the schema from the specified database:
>>> Could
>>> not get a connection from the datasource
>>>
>>> I have no doubt that my line 16 is wrong, but I cannot find any
>>> information
>>> about the correct format for connecting to a MySQL database.  The full
>>> path
>>> to the database on my machine is /usr/local/mysql/data/vcctl_user
>>>
>>> Other information:  My mysql server is definitely running on the machine,
>>> and the vcctl_user database can be accessed from within mysql from the
>>> command line (show tables, etc.).
>>>
>>> Thanks in advance for any help about how I can properly connect to MySQL
>>> database.
>>>
>>> <?xml version="1.0"?>
>>> <project name="MigrateToDerby" basedir=".">
>>>
>>>  <path id="classpath">
>>>     <fileset dir="./lib">
>>>        <include name="**/*.jar"/>
>>>     </fileset>
>>>  </path>
>>>
>>>  <target name="export-source-db" description="Dumps db structure and
>>> data">
>>>     <taskdef name="databaseToDdl"
>>>             classname="org.apache.ddlutils.task.DatabaseToDdlTask">
>>>        <classpath refid="classpath"/>
>>>     </taskdef>
>>>
>>>     <databaseToDdl modelName="MigrateTest">
>>>         <database url="jdbc:mysql://localhost:3306/vcctl_user"
>>>                driverClassName="com.mysql.jdbc.Driver"
>>>                username="root"
>>>                password="vcctl7"/>
>>>
>>>        <writeSchemaToFile outputFile="db-schema.xml"/>
>>>        <writeDataToFile outputFile="data.xml"/>
>>>     </databaseToDdl>
>>>
>>>  </target>
>>> </project>
>>>
>>>
>
>


Loading...