[jira] Created: (DDLUTILS-151) Can not export data if multiple schemas from PostgreSQL

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (DDLUTILS-151) Can not export data if multiple schemas from PostgreSQL

JIRA jira@apache.org
Can not export data if multiple schemas from PostgreSQL
-------------------------------------------------------

                 Key: DDLUTILS-151
                 URL: https://issues.apache.org/jira/browse/DDLUTILS-151
             Project: DdlUtils
          Issue Type: Bug
    Affects Versions: 1.0
         Environment: PostgreSQL 8.1.4 on i486-pc-linux-gnu, compiled by GCC gcc-4.0.gcc-opt (GCC) 4.0.3 (Ubuntu 4.0.3-1ubuntu5)
Ant tasks
            Reporter: Laurent ROCHE
         Assigned To: Thomas Dudziak


When running an Ant Task, databaseToDdl with writeDataToFile on a PosgreSQL database with more than the public database, DDL-Utils fails !

The error message is:
 org.apache.ddlutils.DatabaseOperationException: Error while performing a query

and adding the option verbosity="DEBUG" does not add more information.


Cheers,
L@u


--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (DDLUTILS-151) Can not export data if multiple schemas from PostgreSQL

JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/DDLUTILS-151?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12466648 ]

Thomas Dudziak commented on DDLUTILS-151:
-----------------------------------------

Please provide some more info, e.g. the parameters of the ant task (db utl, schemaPattern etc.).

> Can not export data if multiple schemas from PostgreSQL
> -------------------------------------------------------
>
>                 Key: DDLUTILS-151
>                 URL: https://issues.apache.org/jira/browse/DDLUTILS-151
>             Project: DdlUtils
>          Issue Type: Bug
>    Affects Versions: 1.0
>         Environment: PostgreSQL 8.1.4 on i486-pc-linux-gnu, compiled by GCC gcc-4.0.gcc-opt (GCC) 4.0.3 (Ubuntu 4.0.3-1ubuntu5)
> Ant tasks
>            Reporter: Laurent ROCHE
>         Assigned To: Thomas Dudziak
>
> When running an Ant Task, databaseToDdl with writeDataToFile on a PosgreSQL database with more than the public database, DDL-Utils fails !
> The error message is:
>  org.apache.ddlutils.DatabaseOperationException: Error while performing a query
> and adding the option verbosity="DEBUG" does not add more information.
> Cheers,
> L@u

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (DDLUTILS-151) Can not export data if multiple schemas from PostgreSQL

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/DDLUTILS-151?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12466950 ]

Laurent ROCHE commented on DDLUTILS-151:
----------------------------------------

As far as I can tell, that will fail in any cases, but here are 2 ant tasks that fails:

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

      <databaseToDdl modelName="fims" sortforeignkeys="false" schemapattern="export" >
         <database url="jdbc:postgresql://sirocco/fims_mpd_jan"
                 driverClassName="org.postgresql.Driver"
                 username="admin"
                 password="d0csea2"/>
         <writeSchemaToFile outputFile="schema.xml"/>
         <writeDataToFile outputFile="data.xml"/>
      </databaseToDdl>
</target>

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

      <databaseToDdl modelName="fims" sortforeignkeys="false">
         <database url="jdbc:postgresql://sirocco/fims_small_mpd"
                 driverClassName="org.postgresql.Driver"
                 username="admin"
                 password="d0csea2"/>
         <writeSchemaToFile outputFile="schema.xml"/>
         <writeDataToFile outputFile="data-small.xml"/>
      </databaseToDdl>
</target>


Let me know if you need anything else.

> Can not export data if multiple schemas from PostgreSQL
> -------------------------------------------------------
>
>                 Key: DDLUTILS-151
>                 URL: https://issues.apache.org/jira/browse/DDLUTILS-151
>             Project: DdlUtils
>          Issue Type: Bug
>    Affects Versions: 1.0
>         Environment: PostgreSQL 8.1.4 on i486-pc-linux-gnu, compiled by GCC gcc-4.0.gcc-opt (GCC) 4.0.3 (Ubuntu 4.0.3-1ubuntu5)
> Ant tasks
>            Reporter: Laurent ROCHE
>         Assigned To: Thomas Dudziak
>
> When running an Ant Task, databaseToDdl with writeDataToFile on a PosgreSQL database with more than the public database, DDL-Utils fails !
> The error message is:
>  org.apache.ddlutils.DatabaseOperationException: Error while performing a query
> and adding the option verbosity="DEBUG" does not add more information.
> Cheers,
> L@u

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (DDLUTILS-151) Can not export data if multiple schemas from PostgreSQL

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/DDLUTILS-151?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12468177 ]

Thomas Dudziak commented on DDLUTILS-151:
-----------------------------------------

Please test these database urls and credentials using a small Java program and plain JDBC statements. DdlUtils does nothing special to access a database, it uses plain JDBC, so my first guess would be that there is a problem with the connectivity (e.g. access rights).

> Can not export data if multiple schemas from PostgreSQL
> -------------------------------------------------------
>
>                 Key: DDLUTILS-151
>                 URL: https://issues.apache.org/jira/browse/DDLUTILS-151
>             Project: DdlUtils
>          Issue Type: Bug
>    Affects Versions: 1.0
>         Environment: PostgreSQL 8.1.4 on i486-pc-linux-gnu, compiled by GCC gcc-4.0.gcc-opt (GCC) 4.0.3 (Ubuntu 4.0.3-1ubuntu5)
> Ant tasks
>            Reporter: Laurent ROCHE
>         Assigned To: Thomas Dudziak
>
> When running an Ant Task, databaseToDdl with writeDataToFile on a PosgreSQL database with more than the public database, DDL-Utils fails !
> The error message is:
>  org.apache.ddlutils.DatabaseOperationException: Error while performing a query
> and adding the option verbosity="DEBUG" does not add more information.
> Cheers,
> L@u

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (DDLUTILS-151) Can not export data if multiple schemas from PostgreSQL

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/DDLUTILS-151?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12468220 ]

Laurent ROCHE commented on DDLUTILS-151:
----------------------------------------

I will do some tests later on (a couple of weeks) and will post the results on JIRA !
 
Have fun,
L@u
The Computing Froggy

----- Message d'origine ----
De : Thomas Dudziak (JIRA) <[hidden email]>
À : [hidden email]
Envoyé le : Lundi, 29 Janvier 2007, 4h42mn 49s
Objet : [jira] Commented: (DDLUTILS-151) Can not export data if multiple schemas from PostgreSQL


    [ https://issues.apache.org/jira/browse/DDLUTILS-151?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12468177 ]

Thomas Dudziak commented on DDLUTILS-151:
-----------------------------------------

Please test these database urls and credentials using a small Java program and plain JDBC statements. DdlUtils does nothing special to access a database, it uses plain JDBC, so my first guess would be that there is a problem with the connectivity (e.g. access rights).


--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.






       

       
               
___________________________________________________________________________
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions !
Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses
http://fr.answers.yahoo.com


> Can not export data if multiple schemas from PostgreSQL
> -------------------------------------------------------
>
>                 Key: DDLUTILS-151
>                 URL: https://issues.apache.org/jira/browse/DDLUTILS-151
>             Project: DdlUtils
>          Issue Type: Bug
>    Affects Versions: 1.0
>         Environment: PostgreSQL 8.1.4 on i486-pc-linux-gnu, compiled by GCC gcc-4.0.gcc-opt (GCC) 4.0.3 (Ubuntu 4.0.3-1ubuntu5)
> Ant tasks
>            Reporter: Laurent ROCHE
>         Assigned To: Thomas Dudziak
>
> When running an Ant Task, databaseToDdl with writeDataToFile on a PosgreSQL database with more than the public database, DDL-Utils fails !
> The error message is:
>  org.apache.ddlutils.DatabaseOperationException: Error while performing a query
> and adding the option verbosity="DEBUG" does not add more information.
> Cheers,
> L@u

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (DDLUTILS-151) Can not export data if multiple schemas from PostgreSQL

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

     [ https://issues.apache.org/jira/browse/DDLUTILS-151?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Dudziak updated DDLUTILS-151:
------------------------------------

    Fix Version/s: 1.1

> Can not export data if multiple schemas from PostgreSQL
> -------------------------------------------------------
>
>                 Key: DDLUTILS-151
>                 URL: https://issues.apache.org/jira/browse/DDLUTILS-151
>             Project: DdlUtils
>          Issue Type: Bug
>    Affects Versions: 1.0
>         Environment: PostgreSQL 8.1.4 on i486-pc-linux-gnu, compiled by GCC gcc-4.0.gcc-opt (GCC) 4.0.3 (Ubuntu 4.0.3-1ubuntu5)
> Ant tasks
>            Reporter: Laurent ROCHE
>            Assignee: Thomas Dudziak
>             Fix For: 1.1
>
>
> When running an Ant Task, databaseToDdl with writeDataToFile on a PosgreSQL database with more than the public database, DDL-Utils fails !
> The error message is:
>  org.apache.ddlutils.DatabaseOperationException: Error while performing a query
> and adding the option verbosity="DEBUG" does not add more information.
> Cheers,
> L@u

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (DDLUTILS-151) Can not export data if multiple schemas from PostgreSQL

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/DDLUTILS-151?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12681844#action_12681844 ]

Tomislav Nakic-Alfirevic commented on DDLUTILS-151:
---------------------------------------------------

I can confirm the issue: it's exactly the way Laurent described it.
In my case, I have several postgresql (8.3) databases available and the ones where I only have tables in the "default" schema I can export from nicely (well, aside from issue 212 which would be fixed for me by commenting out one line of code, Database.java:451), but the ones where I have tables in multiple schemas break the export.
Here are a couple of details...

$ ant -v export-source-db
Apache Ant version 1.7.0 compiled on August 29 2007
Buildfile: build.xml
Detected Java version: 1.6 in: /usr/lib/jvm/java-6-sun-1.6.0.07/jre
Detected OS: Linux
parsing buildfile /home/tna/projekti/PanBI/acta/ddlutils/build.xml with URI = file:/home/tna/projekti/PanBI/acta/ddlutils/build.xml
Project base dir set to: /home/tna/projekti/PanBI/acta/ddlutils
[antlib:org.apache.tools.ant] Could not load definitions from resource org/apache/tools/ant/antlib.xml. It could not be found.
Build sequence for target(s) `export-source-db' is [export-source-db]
Complete build sequence is [export-source-db, ]

export-source-db:
[databaseToDdl] Written schema to /home/tna/projekti/PanBI/acta/ddlutils/db-schema.xml

BUILD FAILED
/home/tna/projekti/PanBI/acta/ddlutils/build.xml:12: Error while performing a query
        at org.apache.ddlutils.task.Command.handleException(Command.java:81)
        at org.apache.ddlutils.task.WriteDataToFileCommand.execute(WriteDataToFileCommand.java:101)
        at org.apache.ddlutils.task.DatabaseTaskBase.executeCommands(DatabaseTaskBase.java:341)
        at org.apache.ddlutils.task.DatabaseTaskBase.execute(DatabaseTaskBase.java:381)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:357)
        at org.apache.tools.ant.Target.performTasks(Target.java:385)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
        at org.apache.tools.ant.Main.runBuild(Main.java:698)
        at org.apache.tools.ant.Main.startAnt(Main.java:199)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: org.apache.ddlutils.DatabaseOperationException: Error while performing a query
        at org.apache.ddlutils.platform.PlatformImplBase.query(PlatformImplBase.java:1565)
        at org.apache.ddlutils.io.DatabaseDataIO.writeDataForTableToXML(DatabaseDataIO.java:538)
        at org.apache.ddlutils.io.DatabaseDataIO.writeDataToXML(DatabaseDataIO.java:381)
        at org.apache.ddlutils.io.DatabaseDataIO.writeDataToXML(DatabaseDataIO.java:320)
        at org.apache.ddlutils.task.WriteDataToFileCommand.execute(WriteDataToFileCommand.java:95)
        ... 19 more
Caused by: org.postgresql.util.PSQLException: ERROR: relation "cinj_spis_1_stupanj_snimka" does not exist
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1548)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1316)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:191)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:337)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:236)
        at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:205)
        at org.apache.ddlutils.platform.PlatformImplBase.query(PlatformImplBase.java:1559)
        ... 23 more
--- Nested Exception ---
org.apache.ddlutils.DatabaseOperationException: Error while performing a query
        at org.apache.ddlutils.platform.PlatformImplBase.query(PlatformImplBase.java:1565)
        at org.apache.ddlutils.io.DatabaseDataIO.writeDataForTableToXML(DatabaseDataIO.java:538)
        at org.apache.ddlutils.io.DatabaseDataIO.writeDataToXML(DatabaseDataIO.java:381)
        at org.apache.ddlutils.io.DatabaseDataIO.writeDataToXML(DatabaseDataIO.java:320)
        at org.apache.ddlutils.task.WriteDataToFileCommand.execute(WriteDataToFileCommand.java:95)
        at org.apache.ddlutils.task.DatabaseTaskBase.executeCommands(DatabaseTaskBase.java:341)
        at org.apache.ddlutils.task.DatabaseTaskBase.execute(DatabaseTaskBase.java:381)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:357)
        at org.apache.tools.ant.Target.performTasks(Target.java:385)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
        at org.apache.tools.ant.Main.runBuild(Main.java:698)
        at org.apache.tools.ant.Main.startAnt(Main.java:199)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: org.postgresql.util.PSQLException: ERROR: relation "cinj_spis_1_stupanj_snimka" does not exist
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1548)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1316)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:191)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:337)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:236)
        at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:205)
        at org.apache.ddlutils.platform.PlatformImplBase.query(PlatformImplBase.java:1559)
        ... 23 more

Total time: 10 seconds
$

My build.xml is as follows:

<?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:postgresql://localhost/acta" driverClassName="org.postgresql.Driver" username="snip!" password="snip!"/>
                <writeSchemaToFile outputFile="db-schema.xml"/>
                <writeDataToFile outputFile="data.xml"/>
        </databaseToDdl>
        </target>
</project>


Now, I've tried modifying ddlutils code to output things which would help me understand what's going on, but I don't know how I have to set up logging so that I get any kind of output from statements like _log.debug(sql) and the like. Can you give me a hint? Is there any documentation for ddlutils developers (tools to use, environment setup etc.)?

Anyway, to conclude, I think the reason it's breaking is the following:
1.) JdbcModelReader.determineSchemaOf(Connection, String, Table) fails to determine the table schema
2.) PostgreSqlModelReader.java doesn't override deterimenSchemaOf and so that's it

It should be easy enough to verify: check the value of the local variable "schema" after the DatabaseDataIO:482 statement (I obtained ddlutils by compiling it from a fresh svn trunk checkout a couple hours ago).

> Can not export data if multiple schemas from PostgreSQL
> -------------------------------------------------------
>
>                 Key: DDLUTILS-151
>                 URL: https://issues.apache.org/jira/browse/DDLUTILS-151
>             Project: DdlUtils
>          Issue Type: Bug
>    Affects Versions: 1.0
>         Environment: PostgreSQL 8.1.4 on i486-pc-linux-gnu, compiled by GCC gcc-4.0.gcc-opt (GCC) 4.0.3 (Ubuntu 4.0.3-1ubuntu5)
> Ant tasks
>            Reporter: Laurent ROCHE
>            Assignee: Thomas Dudziak
>             Fix For: 1.2
>
>
> When running an Ant Task, databaseToDdl with writeDataToFile on a PosgreSQL database with more than the public database, DDL-Utils fails !
> The error message is:
>  org.apache.ddlutils.DatabaseOperationException: Error while performing a query
> and adding the option verbosity="DEBUG" does not add more information.
> Cheers,
> L@u

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Issue Comment Edited: (DDLUTILS-151) Can not export data if multiple schemas from PostgreSQL

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/DDLUTILS-151?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12681844#action_12681844 ]

Tomislav Nakic-Alfirevic edited comment on DDLUTILS-151 at 3/13/09 12:32 PM:
-----------------------------------------------------------------------------

I ran into the issue as well, but found out it was a problem of an incomplete build.xml (although I would argue that the default behaviour should be schemapattern="%", not "null").

My build.xml was as follows (similar to the introductory ddlutils example):

<?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:postgresql://localhost/acta" driverClassName="org.postgresql.Driver" username="snip!" password="snip!"/>
                <writeSchemaToFile outputFile="db-schema.xml"/>
                <writeDataToFile outputFile="data.xml"/>
        </databaseToDdl>
        </target>
</project>

Changing the following 2 elements like so

<databaseToDdl modelName="MigrateTest" schemapattern="%" databasetype="postgresql">
<writeDataToFile outputFile="data.xml" determineschema="true"/>

made it work (not sure if all 3 changes were necessary, but I'm quite sure setting the schemapattern was).

Btw, I've tried modifying ddlutils code to output things which would help me understand what's going on, but I don't know how I have to set up logging so that I get any kind of output from statements like _log.debug(sql) and the like. Can you give me a hint? Is there any documentation for ddlutils developers (tools to use, environment setup etc.)?


      was (Author: tna):
    I can confirm the issue: it's exactly the way Laurent described it.
In my case, I have several postgresql (8.3) databases available and the ones where I only have tables in the "default" schema I can export from nicely (well, aside from issue 212 which would be fixed for me by commenting out one line of code, Database.java:451), but the ones where I have tables in multiple schemas break the export.
Here are a couple of details...

$ ant -v export-source-db
Apache Ant version 1.7.0 compiled on August 29 2007
Buildfile: build.xml
Detected Java version: 1.6 in: /usr/lib/jvm/java-6-sun-1.6.0.07/jre
Detected OS: Linux
parsing buildfile /home/tna/projekti/PanBI/acta/ddlutils/build.xml with URI = file:/home/tna/projekti/PanBI/acta/ddlutils/build.xml
Project base dir set to: /home/tna/projekti/PanBI/acta/ddlutils
[antlib:org.apache.tools.ant] Could not load definitions from resource org/apache/tools/ant/antlib.xml. It could not be found.
Build sequence for target(s) `export-source-db' is [export-source-db]
Complete build sequence is [export-source-db, ]

export-source-db:
[databaseToDdl] Written schema to /home/tna/projekti/PanBI/acta/ddlutils/db-schema.xml

BUILD FAILED
/home/tna/projekti/PanBI/acta/ddlutils/build.xml:12: Error while performing a query
        at org.apache.ddlutils.task.Command.handleException(Command.java:81)
        at org.apache.ddlutils.task.WriteDataToFileCommand.execute(WriteDataToFileCommand.java:101)
        at org.apache.ddlutils.task.DatabaseTaskBase.executeCommands(DatabaseTaskBase.java:341)
        at org.apache.ddlutils.task.DatabaseTaskBase.execute(DatabaseTaskBase.java:381)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:357)
        at org.apache.tools.ant.Target.performTasks(Target.java:385)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
        at org.apache.tools.ant.Main.runBuild(Main.java:698)
        at org.apache.tools.ant.Main.startAnt(Main.java:199)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: org.apache.ddlutils.DatabaseOperationException: Error while performing a query
        at org.apache.ddlutils.platform.PlatformImplBase.query(PlatformImplBase.java:1565)
        at org.apache.ddlutils.io.DatabaseDataIO.writeDataForTableToXML(DatabaseDataIO.java:538)
        at org.apache.ddlutils.io.DatabaseDataIO.writeDataToXML(DatabaseDataIO.java:381)
        at org.apache.ddlutils.io.DatabaseDataIO.writeDataToXML(DatabaseDataIO.java:320)
        at org.apache.ddlutils.task.WriteDataToFileCommand.execute(WriteDataToFileCommand.java:95)
        ... 19 more
Caused by: org.postgresql.util.PSQLException: ERROR: relation "cinj_spis_1_stupanj_snimka" does not exist
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1548)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1316)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:191)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:337)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:236)
        at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:205)
        at org.apache.ddlutils.platform.PlatformImplBase.query(PlatformImplBase.java:1559)
        ... 23 more
--- Nested Exception ---
org.apache.ddlutils.DatabaseOperationException: Error while performing a query
        at org.apache.ddlutils.platform.PlatformImplBase.query(PlatformImplBase.java:1565)
        at org.apache.ddlutils.io.DatabaseDataIO.writeDataForTableToXML(DatabaseDataIO.java:538)
        at org.apache.ddlutils.io.DatabaseDataIO.writeDataToXML(DatabaseDataIO.java:381)
        at org.apache.ddlutils.io.DatabaseDataIO.writeDataToXML(DatabaseDataIO.java:320)
        at org.apache.ddlutils.task.WriteDataToFileCommand.execute(WriteDataToFileCommand.java:95)
        at org.apache.ddlutils.task.DatabaseTaskBase.executeCommands(DatabaseTaskBase.java:341)
        at org.apache.ddlutils.task.DatabaseTaskBase.execute(DatabaseTaskBase.java:381)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:357)
        at org.apache.tools.ant.Target.performTasks(Target.java:385)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
        at org.apache.tools.ant.Main.runBuild(Main.java:698)
        at org.apache.tools.ant.Main.startAnt(Main.java:199)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: org.postgresql.util.PSQLException: ERROR: relation "cinj_spis_1_stupanj_snimka" does not exist
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1548)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1316)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:191)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:337)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:236)
        at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:205)
        at org.apache.ddlutils.platform.PlatformImplBase.query(PlatformImplBase.java:1559)
        ... 23 more

Total time: 10 seconds
$

My build.xml is as follows:

<?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:postgresql://localhost/acta" driverClassName="org.postgresql.Driver" username="snip!" password="snip!"/>
                <writeSchemaToFile outputFile="db-schema.xml"/>
                <writeDataToFile outputFile="data.xml"/>
        </databaseToDdl>
        </target>
</project>


Now, I've tried modifying ddlutils code to output things which would help me understand what's going on, but I don't know how I have to set up logging so that I get any kind of output from statements like _log.debug(sql) and the like. Can you give me a hint? Is there any documentation for ddlutils developers (tools to use, environment setup etc.)?

Anyway, to conclude, I think the reason it's breaking is the following:
1.) JdbcModelReader.determineSchemaOf(Connection, String, Table) fails to determine the table schema
2.) PostgreSqlModelReader.java doesn't override deterimenSchemaOf and so that's it

It should be easy enough to verify: check the value of the local variable "schema" after the DatabaseDataIO:482 statement (I obtained ddlutils by compiling it from a fresh svn trunk checkout a couple hours ago).
 

> Can not export data if multiple schemas from PostgreSQL
> -------------------------------------------------------
>
>                 Key: DDLUTILS-151
>                 URL: https://issues.apache.org/jira/browse/DDLUTILS-151
>             Project: DdlUtils
>          Issue Type: Bug
>    Affects Versions: 1.0
>         Environment: PostgreSQL 8.1.4 on i486-pc-linux-gnu, compiled by GCC gcc-4.0.gcc-opt (GCC) 4.0.3 (Ubuntu 4.0.3-1ubuntu5)
> Ant tasks
>            Reporter: Laurent ROCHE
>            Assignee: Thomas Dudziak
>             Fix For: 1.2
>
>
> When running an Ant Task, databaseToDdl with writeDataToFile on a PosgreSQL database with more than the public database, DDL-Utils fails !
> The error message is:
>  org.apache.ddlutils.DatabaseOperationException: Error while performing a query
> and adding the option verbosity="DEBUG" does not add more information.
> Cheers,
> L@u

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Issue Comment Edited: (DDLUTILS-151) Can not export data if multiple schemas from PostgreSQL

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/DDLUTILS-151?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12681844#action_12681844 ]

Tomislav Nakic-Alfirevic edited comment on DDLUTILS-151 at 5/31/09 9:00 AM:
----------------------------------------------------------------------------

I ran into the issue as well, but found out it was a problem of an incomplete build.xml (although I would argue that the default behaviour should be schemapattern="%", not "null").

My build.xml was as follows (similar to the introductory ddlutils example):

<?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:postgresql://localhost/acta" driverClassName="org.postgresql.Driver" username="snip!" password="snip!"/>
                <writeSchemaToFile outputFile="db-schema.xml"/>
                <writeDataToFile outputFile="data.xml"/>
        </databaseToDdl>
        </target>
</project>

Changing the following 2 elements like so

<databaseToDdl modelName="MigrateTest" schemapattern="%" databasetype="postgresql">
<writeDataToFile outputFile="data.xml" determineschema="true"/>

made it work (not sure if all 3 changes were necessary, but I'm quite sure setting the schemapattern was).

Btw, I've tried modifying ddlutils code to output things which would help me understand what's going on, but I don't know how I have to set up logging so that I get any kind of output from statements like _log.debug(sql) and the like. Can you give me a hint? Is there any documentation for ddlutils developers (tools to use, environment setup etc.)?

The following change helped me to understand better what was going on:

Index: main/java/org/apache/ddlutils/platform/PlatformImplBase.java
===================================================================
--- main/java/org/apache/ddlutils/platform/PlatformImplBase.java (revision 753277)
+++ main/java/org/apache/ddlutils/platform/PlatformImplBase.java (working copy)
@@ -1562,7 +1562,8 @@
         }
         catch (SQLException ex)
         {
-            throw new DatabaseOperationException("Error while performing a query", ex);
+            //throw new DatabaseOperationException("Error while performing a query", ex);
+            throw new DatabaseOperationException("Error while performing a query [" + sql + "]", ex);
         }
         finally
         {


      was (Author: tna):
    I ran into the issue as well, but found out it was a problem of an incomplete build.xml (although I would argue that the default behaviour should be schemapattern="%", not "null").

My build.xml was as follows (similar to the introductory ddlutils example):

<?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:postgresql://localhost/acta" driverClassName="org.postgresql.Driver" username="snip!" password="snip!"/>
                <writeSchemaToFile outputFile="db-schema.xml"/>
                <writeDataToFile outputFile="data.xml"/>
        </databaseToDdl>
        </target>
</project>

Changing the following 2 elements like so

<databaseToDdl modelName="MigrateTest" schemapattern="%" databasetype="postgresql">
<writeDataToFile outputFile="data.xml" determineschema="true"/>

made it work (not sure if all 3 changes were necessary, but I'm quite sure setting the schemapattern was).

Btw, I've tried modifying ddlutils code to output things which would help me understand what's going on, but I don't know how I have to set up logging so that I get any kind of output from statements like _log.debug(sql) and the like. Can you give me a hint? Is there any documentation for ddlutils developers (tools to use, environment setup etc.)?

 

> Can not export data if multiple schemas from PostgreSQL
> -------------------------------------------------------
>
>                 Key: DDLUTILS-151
>                 URL: https://issues.apache.org/jira/browse/DDLUTILS-151
>             Project: DdlUtils
>          Issue Type: Bug
>    Affects Versions: 1.0
>         Environment: PostgreSQL 8.1.4 on i486-pc-linux-gnu, compiled by GCC gcc-4.0.gcc-opt (GCC) 4.0.3 (Ubuntu 4.0.3-1ubuntu5)
> Ant tasks
>            Reporter: Laurent ROCHE
>            Assignee: Thomas Dudziak
>             Fix For: 1.2
>
>
> When running an Ant Task, databaseToDdl with writeDataToFile on a PosgreSQL database with more than the public database, DDL-Utils fails !
> The error message is:
>  org.apache.ddlutils.DatabaseOperationException: Error while performing a query
> and adding the option verbosity="DEBUG" does not add more information.
> Cheers,
> L@u

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.