You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Jonas Denvall <jo...@mondao.com> on 2002/07/19 13:11:22 UTC

TDK 2.2 b2: id_table created too late

Hey all.
 
I'm having some troubles with the new beta 2 release of TDK 2.2.
 
Following the how-to guide, building fails in the build database step.
It seems like the id_table is created too late - the other schemas are
created earlier, and torque even tries to insert values into id_table
before it is created:
 
insert-sql:
[torque-sql-exec] Our new url -> jdbc:mysql://localhost/newapp
[torque-sql-exec] Executing file:
C:\project\tdk-2.2-b2\webapps\newapp\WEB-INF\s
rc\sql\third-schema.sql
[torque-sql-exec] Executing file:
C:\project\tdk-2.2-b2\webapps\newapp\WEB-INF\s
rc\sql\third-schema-idtable-init.sql
[torque-sql-exec] Failed to execute: insert into ID_TABLE (id_table_id,
table_na
me, next_id, quantity) VALUES (2101, 'RDF3', 1000, 10)
[torque-sql-exec] java.sql.SQLException: General error: Table
'newapp.id_table'
doesn't exist
 
This results in an empty id_table, and at run-time I get:
org.apache.turbine.util.security.DataBackendException: Failed to create
account 't': The table TURBINE_USER does not have a proper entry in the
ID_TABLE
 
I've tried to work around this by setting idMethod="native" in all
-schema.xml, and forcing to use MySQL's autoincrement instead of the
id_table. This works for the RDF schema, but execution still fails while
trying to insert into turbine_user.
 
My question:
How can I control the order of the execution of the -schema.xml files,
so that id_table is created first?
 
Thanx!
 
/Jonas

Re: TDK 2.2 b2: id_table created too late

Posted by Jonas Denvall <jo...@arkatay.com>.
Hi.

Thanx for your input, Frederic.
This bug is really strange, and I can't find a solution.

I've tried several different names on my project and database, but with
no success. The names I have tested include newapp, sumo, sumxp which
Frederic earlier stated as OK names.

It seems like I'm doing something wrong, but I can't see what. I just
extracted the tdk-2.2-b2.tar.gz file, set my database (MySQL) properties
and built the application. It is the same behaviour on Red Hat as on
Windows XP.

Is the newapp application working for other TDK 2.2 b2 users?

Is the patch that Age Mooy is talking about in
http://www.mail-archive.com/turbine-user%40jakarta.apache.org/msg08624.h
tml
included in the TDK 2.2 b2?

Cheers
/Jonas

-----Ursprungligt meddelande-----
Från: Frederic Gedin [mailto:frederic.gedin@Jaluna.COM] 
Skickat: den 19 juli 2002 14:40
Till: Turbine Users List
Ämne: Re: TDK 2.2 b2: id_table created too late


Hi Jonas

Faced with this problem, the only work around I found was to look for a 
different name for my database.  I tried several names, some were 
working well, other not, but I did not find any generic rule which could

give a hint on the bug.

Apparently, this is a known problem (see 
http://www.mail-archive.com/turbine-user%40jakarta.apache.org/msg08624.h
tml)

Frederic

Jonas Denvall wrote:

> Hey all.
>  
> I'm having some troubles with the new beta 2 release of TDK 2.2.
>  
> Following the how-to guide, building fails in the build database step.

> It seems like the id_table is created too late - the other schemas are

> created earlier, and torque even tries to insert values into id_table 
> before it is created:
>  
> insert-sql:
> [torque-sql-exec] Our new url -> jdbc:mysql://localhost/newapp 
> [torque-sql-exec] Executing file: 
> C:\project\tdk-2.2-b2\webapps\newapp\WEB-INF\s
> rc\sql\third-schema.sql
> [torque-sql-exec] Executing file: 
> C:\project\tdk-2.2-b2\webapps\newapp\WEB-INF\s
> rc\sql\third-schema-idtable-init.sql
> [torque-sql-exec] Failed to execute: insert into ID_TABLE 
> (id_table_id, table_na me, next_id, quantity) VALUES (2101, 'RDF3', 
> 1000, 10) [torque-sql-exec] java.sql.SQLException: General error: 
> Table 'newapp.id_table'
> doesn't exist
>  
> This results in an empty id_table, and at run-time I get:
> org.apache.turbine.util.security.DataBackendException: Failed to 
> create account 't': The table TURBINE_USER does not have a proper 
> entry in the ID_TABLE
>  
> I've tried to work around this by setting idMethod="native" in all 
> -schema.xml, and forcing to use MySQL's autoincrement instead of the 
> id_table. This works for the RDF schema, but execution still fails 
> while trying to insert into turbine_user.
>  
> My question:
> How can I control the order of the execution of the -schema.xml files,

> so that id_table is created first?
>  
> Thanx!
>  
> /Jonas
> 
> 



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: TDK 2.2 b2: id_table created too late

Posted by Frederic Gedin <fr...@Jaluna.COM>.
Hi Jonas

Faced with this problem, the only work around I found was to look for a 
different name for my database.  I tried several names, some were 
working well, other not, but I did not find any generic rule which could 
give a hint on the bug.

Apparently, this is a known problem (see 
http://www.mail-archive.com/turbine-user%40jakarta.apache.org/msg08624.html)

Frederic

Jonas Denvall wrote:

> Hey all.
>  
> I'm having some troubles with the new beta 2 release of TDK 2.2.
>  
> Following the how-to guide, building fails in the build database step.
> It seems like the id_table is created too late - the other schemas are
> created earlier, and torque even tries to insert values into id_table
> before it is created:
>  
> insert-sql:
> [torque-sql-exec] Our new url -> jdbc:mysql://localhost/newapp
> [torque-sql-exec] Executing file:
> C:\project\tdk-2.2-b2\webapps\newapp\WEB-INF\s
> rc\sql\third-schema.sql
> [torque-sql-exec] Executing file:
> C:\project\tdk-2.2-b2\webapps\newapp\WEB-INF\s
> rc\sql\third-schema-idtable-init.sql
> [torque-sql-exec] Failed to execute: insert into ID_TABLE (id_table_id,
> table_na
> me, next_id, quantity) VALUES (2101, 'RDF3', 1000, 10)
> [torque-sql-exec] java.sql.SQLException: General error: Table
> 'newapp.id_table'
> doesn't exist
>  
> This results in an empty id_table, and at run-time I get:
> org.apache.turbine.util.security.DataBackendException: Failed to create
> account 't': The table TURBINE_USER does not have a proper entry in the
> ID_TABLE
>  
> I've tried to work around this by setting idMethod="native" in all
> -schema.xml, and forcing to use MySQL's autoincrement instead of the
> id_table. This works for the RDF schema, but execution still fails while
> trying to insert into turbine_user.
>  
> My question:
> How can I control the order of the execution of the -schema.xml files,
> so that id_table is created first?
>  
> Thanx!
>  
> /Jonas
> 
> 



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: TDK 2.2 b2: id_table created too late

Posted by Wei He <we...@ldeo.columbia.edu>.
Frist of all, great work, guys.  I have been waiting for a  release for a
long time.

Now back to your problem, I had the same problem trying to run insert entry
after getting everything installed.  In my case, I used mysql.  There is no
entries in the id table of the newapp
database at all.  Rerun

ant -f build.xml insert-sql-files appears to be ok until the point that the
id-table-schema.sql gets
executed again, which is in fact of the last sql file to be executed in my
case. It wiped out
all the previous wntries in the id_table.

I traced back to the source code TorqueSQLExec.java in package
org.apache.torque.task.  Apparently, a Map/Iterator combination is used in
controlling how the generated .sql files gets executed.  The order is
completely defined by how the iterator gets the object.

To solve the problem, the default database (check sqldd.map file in
WEB-INF/src/sql directory) should gets executed first, then everything else.
Now what you can do it to manually edit the
generated file, just simply remove the line says default

#Sqlfile -> Database map
#Fri Jul 19 23:50:15 EDT 2002
third-schema-idtable-init.sql=third
turbine-schema.sql=newapp
second-schema-idtable-init.sql=second
newapp-schema.sql=newapp
third-schema.sql=third
id-table-schema.sql=default                    <-----------------remove this
line
turbine-schema-idtable-init.sql=newapp
newapp-schema-idtable-init.sql=newapp
second-schema.sql=second
turbine-security.sql=newapp

And then run ant insert-sql-files again will do the trick.  For your
reference, here is
the extracted code from TorqueSQLExec.java of Torque-3.0-b3-src.tar.gz
source
package.

.......
        Map databases = new HashMap();

        Iterator eachFileName = map.keySet().iterator();
        while (eachFileName.hasNext())
        {
            String sqlfile = (String) eachFileName.next();
            String database = map.getProperty(sqlfile);

            List files = (List) databases.get(database);

            if (files == null)
            {
                files = new ArrayList();
                databases.put(database, files);
            }

            // We want to make sure that the base schemas
            // are inserted first.
            if (sqlfile.indexOf("schema.sql") != -1)
            {
                files.add(0, sqlfile);
            }
            else
            {
                files.add(sqlfile);
            }
        }

     Iterator eachDatabase = databases.keySet().iterator();
        while (eachDatabase.hasNext())
        {
            String db = (String) eachDatabase.next();
            List transactions = new ArrayList();
            eachFileName = ((List) databases.get(db)).iterator();
            while (eachFileName.hasNext())
            {
                String fileName = (String) eachFileName.next();
                File file = new File(srcDir, fileName);

                if (file.exists())
                {
                    Transaction transaction = new Transaction();
                    transaction.setSrc(file);
                    transactions.add(transaction);
                }
                else
                {
                    super.log("File '" + fileName + "' in sqldbmap does not
exist, so skipping it.");
                }
            }

            insertDatabaseSqlFiles(url, db, transactions);
        }

......

Wei He, Ph.D.
Voice: 845-365-8879
Fax:    845-359-1631

----- Original Message -----
From: "Jonas Denvall" <jo...@mondao.com>
To: <tu...@jakarta.apache.org>
Sent: Friday, July 19, 2002 7:11 AM
Subject: TDK 2.2 b2: id_table created too late


> Hey all.
>
> I'm having some troubles with the new beta 2 release of TDK 2.2.
>
> Following the how-to guide, building fails in the build database step.
> It seems like the id_table is created too late - the other schemas are
> created earlier, and torque even tries to insert values into id_table
> before it is created:
>
> insert-sql:
> [torque-sql-exec] Our new url -> jdbc:mysql://localhost/newapp
> [torque-sql-exec] Executing file:
> C:\project\tdk-2.2-b2\webapps\newapp\WEB-INF\s
> rc\sql\third-schema.sql
> [torque-sql-exec] Executing file:
> C:\project\tdk-2.2-b2\webapps\newapp\WEB-INF\s
> rc\sql\third-schema-idtable-init.sql
> [torque-sql-exec] Failed to execute: insert into ID_TABLE (id_table_id,
> table_na
> me, next_id, quantity) VALUES (2101, 'RDF3', 1000, 10)
> [torque-sql-exec] java.sql.SQLException: General error: Table
> 'newapp.id_table'
> doesn't exist
>
> This results in an empty id_table, and at run-time I get:
> org.apache.turbine.util.security.DataBackendException: Failed to create
> account 't': The table TURBINE_USER does not have a proper entry in the
> ID_TABLE
>
> I've tried to work around this by setting idMethod="native" in all
> -schema.xml, and forcing to use MySQL's autoincrement instead of the
> id_table. This works for the RDF schema, but execution still fails while
> trying to insert into turbine_user.
>
> My question:
> How can I control the order of the execution of the -schema.xml files,
> so that id_table is created first?
>
> Thanx!
>
> /Jonas
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>