AW: Sybase case insensitive column names
That is correct. The JDBC task doesn't change the names. But if you create the classes (om) it creates the column names with uppercase letters and than there is the problem because you cannot make any queries. Here is an example: Generated XML file (correct): table name=address column name=class javaName=aClass primaryKey=true required=true size=2 type=CHAR/ column name=id primaryKey=true required=true size=30 type=VARCHAR/ column name=position primaryKey=true required=true type=INTEGER/ column name=name1 size=50 type=VARCHAR/ column name=name2 size=50 type=VARCHAR/ column name=name3 size=50 type=VARCHAR/ column name=street size=50 type=VARCHAR/ column name=zipcode size=25 type=VARCHAR/ column name=city size=60 type=VARCHAR/ column name=phone size=40 type=VARCHAR/ column name=phone2 size=40 type=VARCHAR/ column name=country size=200 type=VARCHAR/ column name=state size=200 type=VARCHAR/ column name=fax size=40 type=VARCHAR/ column name=email size=150 type=VARCHAR/ /table Generated constants in the BaseAddressPeer (incorrect): static { CLASS = address.CLASS; ID = address.ID; POSITION = address.POSITION; NAME1 = address.NAME1; NAME2 = address.NAME2; NAME3 = address.NAME3; STREET = address.STREET; ZIPCODE = address.ZIPCODE; CITY = address.CITY; PHONE = address.PHONE; PHONE2 = address.PHONE2; COUNTRY = address.COUNTRY; STATE = address.STATE; FAX = address.FAX; EMAIL = address.EMAIL; I think the uppercase column names or uppercase because it's better to read (?). There is no bug in the Sybase JDBC driver (5.5 and 6.0). I've tested a generated SQL statement on the sybase console (isql) and it fails if the case is not correct, for example: SELECT FROM address WHERE address.CITY=Hamburg failes, but with address.city=... everything is okay. I think this case sensitive behaviour is a Sybase-feature... Maybe I should ask someone on a Sybase JDBC mailinglist howto disable this behaviour. Bye Thoralf -Ursprüngliche Nachricht- Von: Thomas Fischer [mailto:[EMAIL PROTECTED] Gesendet: Samstag, 15. Juli 2006 09:10 An: Apache Torque Users List Betreff: Re: Sybase case insensitive column names Hi, This is strange; the jdbc task should preserve the case of the table and column names (I checked that using mysql; as I do not have a sybase database). The jdbc task uses the DatabaseMetaData from the jdbc driver to get the database; if the database is case sensitive and the DatabaseMetaData does not preserve case it is a bug of the jdbc driver. Thomas On Thu, 13 Jul 2006, Thoralf Rickert wrote: Hi! I've created a schema.xml for an existing Sybase database and I was able to generate the corresponding java classes. If I try to make a query with them I run into a problem. The database uses case sensitive column names but torque generates uppercase column names. For example the following query throws an exception, because the column STATE cannot be found (in the database it's called state). SELECT states.STATE FROM states ORDER BY states.STATE ASC Is there a way to handle this? Is there a sybase specific connection setting or something like that? Thanks Thoralf - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: Sybase case insensitive column names
The column names in the class files should be generated in the same case as they appear in the schema file. If this is not the case, this is a bug. This is Torque 3.2 and you did not change anything there, I assume ? If yes, would you mind to submit a bug report to Jira ? Thomas Thoralf Rickert [EMAIL PROTECTED] schrieb am 17.07.2006 09:19:17: That is correct. The JDBC task doesn't change the names. But if you create the classes (om) it creates the column names with uppercase letters and than there is the problem because you cannot make any queries. Here is an example: Generated XML file (correct): table name=address column name=class javaName=aClass primaryKey=true required=true size=2 type=CHAR/ column name=id primaryKey=true required=true size=30 type=VARCHAR/ column name=position primaryKey=true required=true type=INTEGER/ column name=name1 size=50 type=VARCHAR/ column name=name2 size=50 type=VARCHAR/ column name=name3 size=50 type=VARCHAR/ column name=street size=50 type=VARCHAR/ column name=zipcode size=25 type=VARCHAR/ column name=city size=60 type=VARCHAR/ column name=phone size=40 type=VARCHAR/ column name=phone2 size=40 type=VARCHAR/ column name=country size=200 type=VARCHAR/ column name=state size=200 type=VARCHAR/ column name=fax size=40 type=VARCHAR/ column name=email size=150 type=VARCHAR/ /table Generated constants in the BaseAddressPeer (incorrect): static { CLASS = address.CLASS; ID = address.ID; POSITION = address.POSITION; NAME1 = address.NAME1; NAME2 = address.NAME2; NAME3 = address.NAME3; STREET = address.STREET; ZIPCODE = address.ZIPCODE; CITY = address.CITY; PHONE = address.PHONE; PHONE2 = address.PHONE2; COUNTRY = address.COUNTRY; STATE = address.STATE; FAX = address.FAX; EMAIL = address.EMAIL; I think the uppercase column names or uppercase because it's better to read (?). There is no bug in the Sybase JDBC driver (5.5 and 6. 0). I've tested a generated SQL statement on the sybase console (isql) and it fails if the case is not correct, for example: SELECT FROM address WHERE address.CITY=Hamburg failes, but with address.city=... everything is okay. I think this case sensitive behaviour is a Sybase-feature... Maybe I should ask someone on a Sybase JDBC mailinglist howto disable this behaviour. Bye Thoralf -Ursprüngliche Nachricht- Von: Thomas Fischer [mailto:[EMAIL PROTECTED] Gesendet: Samstag, 15. Juli 2006 09:10 An: Apache Torque Users List Betreff: Re: Sybase case insensitive column names Hi, This is strange; the jdbc task should preserve the case of the table and column names (I checked that using mysql; as I do not have a sybase database). The jdbc task uses the DatabaseMetaData from the jdbc driver to get the database; if the database is case sensitive and the DatabaseMetaData does not preserve case it is a bug of the jdbc driver. Thomas On Thu, 13 Jul 2006, Thoralf Rickert wrote: Hi! I've created a schema.xml for an existing Sybase database and I was able to generate the corresponding java classes. If I try to make a query with them I run into a problem. The database uses case sensitive column names but torque generates uppercase column names. For example the following query throws an exception, because the column STATE cannot be found (in the database it's called state). SELECT states.STATE FROM states ORDER BY states.STATE ASC Is there a way to handle this? Is there a sybase specific connection setting or something like that? Thanks Thoralf - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: Sybase case insensitive column names
Okay, I'll submit a bug report. -Ursprüngliche Nachricht- Von: Thomas Fischer [mailto:[EMAIL PROTECTED] Gesendet: Montag, 17. Juli 2006 10:04 An: Apache Torque Users List Betreff: AW: Sybase case insensitive column names The column names in the class files should be generated in the same case as they appear in the schema file. If this is not the case, this is a bug. This is Torque 3.2 and you did not change anything there, I assume ? If yes, would you mind to submit a bug report to Jira ? Thomas Thoralf Rickert [EMAIL PROTECTED] schrieb am 17.07.2006 09:19:17: That is correct. The JDBC task doesn't change the names. But if you create the classes (om) it creates the column names with uppercase letters and than there is the problem because you cannot make any queries. Here is an example: Generated XML file (correct): table name=address column name=class javaName=aClass primaryKey=true required=true size=2 type=CHAR/ column name=id primaryKey=true required=true size=30 type=VARCHAR/ column name=position primaryKey=true required=true type=INTEGER/ column name=name1 size=50 type=VARCHAR/ column name=name2 size=50 type=VARCHAR/ column name=name3 size=50 type=VARCHAR/ column name=street size=50 type=VARCHAR/ column name=zipcode size=25 type=VARCHAR/ column name=city size=60 type=VARCHAR/ column name=phone size=40 type=VARCHAR/ column name=phone2 size=40 type=VARCHAR/ column name=country size=200 type=VARCHAR/ column name=state size=200 type=VARCHAR/ column name=fax size=40 type=VARCHAR/ column name=email size=150 type=VARCHAR/ /table Generated constants in the BaseAddressPeer (incorrect): static { CLASS = address.CLASS; ID = address.ID; POSITION = address.POSITION; NAME1 = address.NAME1; NAME2 = address.NAME2; NAME3 = address.NAME3; STREET = address.STREET; ZIPCODE = address.ZIPCODE; CITY = address.CITY; PHONE = address.PHONE; PHONE2 = address.PHONE2; COUNTRY = address.COUNTRY; STATE = address.STATE; FAX = address.FAX; EMAIL = address.EMAIL; I think the uppercase column names or uppercase because it's better to read (?). There is no bug in the Sybase JDBC driver (5.5 and 6. 0). I've tested a generated SQL statement on the sybase console (isql) and it fails if the case is not correct, for example: SELECT FROM address WHERE address.CITY=Hamburg failes, but with address.city=... everything is okay. I think this case sensitive behaviour is a Sybase-feature... Maybe I should ask someone on a Sybase JDBC mailinglist howto disable this behaviour. Bye Thoralf -Ursprüngliche Nachricht- Von: Thomas Fischer [mailto:[EMAIL PROTECTED] Gesendet: Samstag, 15. Juli 2006 09:10 An: Apache Torque Users List Betreff: Re: Sybase case insensitive column names Hi, This is strange; the jdbc task should preserve the case of the table and column names (I checked that using mysql; as I do not have a sybase database). The jdbc task uses the DatabaseMetaData from the jdbc driver to get the database; if the database is case sensitive and the DatabaseMetaData does not preserve case it is a bug of the jdbc driver. Thomas On Thu, 13 Jul 2006, Thoralf Rickert wrote: Hi! I've created a schema.xml for an existing Sybase database and I was able to generate the corresponding java classes. If I try to make a query with them I run into a problem. The database uses case sensitive column names but torque generates uppercase column names. For example the following query throws an exception, because the column STATE cannot be found (in the database it's called state). SELECT states.STATE FROM states ORDER BY states.STATE ASC Is there a way to handle this? Is there a sybase specific connection setting or something like that? Thanks Thoralf - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For
RE: IdBroker with sequences in DB2, or perhaps native. How does it work
Hi, IdBroker is no good for that. It uses an extra table and no sequences. In native, Torque uses fixed names for the sequences it uses. See the create-db sql for the names. Maybe you can rename your existing sequence to fit that name ? In the postgesql howto, there is also a paragraph about non-fittibg seqjence names. However, I do not know whether the solution outlined there is good for db2 and whether it still works. Thomas Steve Vanspall [EMAIL PROTECTED] schrieb am 15.07.2006 08:53:38: Hi there, I am going mad here. I have tried a few options for geting torque to use an already existing sequence , in db2, to generate the id's for certain tables. One article suggested setting the defaultIdMethod to native and having a parameter id-method-parameter whose vlaue is the name of the sequence to be used. This doesnt work, all I get is. this warning IDBroker - IDBroker is being used with db '@DB_NAME@', which does not support transactions. IDBroker attempts to use transactions to limit the possibility of duplicate key generation. Without transactions, duplicate key generation is possible if multiple JVMs are used or other means are used to write to the database. follow by the following exception There was no DataSourceFactory configured for the connection @DB_NAME@ So I tried setting the dafultIdMEthod to idbroker. the same thing happened. Do I have to define a class that get the sequence data for me. This is no problem, but I cannot find any decent documentation stating how to do this. What do I implement and how do I tell torque what class isthe id broker?? Any help would be appreciated Steve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IdBroker with sequences in DB2, or perhaps native. How does it work
Ok thanks, so toruqe isn't really the right solution for a pre existing app. I basically was trying to build some tools for a web app that used our own set of persistence objects etc. We made it well before there was anything decent out there. Figured if torque can do it for me for this tools based app, why go through the trouble of separating the cod eI have from the project to make some tools. Oh well thatnks steve Thomas Fischer wrote: Hi, IdBroker is no good for that. It uses an extra table and no sequences. In native, Torque uses fixed names for the sequences it uses. See the create-db sql for the names. Maybe you can rename your existing sequence to fit that name ? In the postgesql howto, there is also a paragraph about non-fittibg seqjence names. However, I do not know whether the solution outlined there is good for db2 and whether it still works. Thomas Steve Vanspall [EMAIL PROTECTED] schrieb am 15.07.2006 08:53:38: Hi there, I am going mad here. I have tried a few options for geting torque to use an already existing sequence , in db2, to generate the id's for certain tables. One article suggested setting the defaultIdMethod to native and having a parameter id-method-parameter whose vlaue is the name of the sequence to be used. This doesnt work, all I get is. this warning IDBroker - IDBroker is being used with db '@DB_NAME@', which does not support transactions. IDBroker attempts to use transactions to limit the possibility of duplicate key generation. Without transactions, duplicate key generation is possible if multiple JVMs are used or other means are used to write to the database. follow by the following exception There was no DataSourceFactory configured for the connection @DB_NAME@ So I tried setting the dafultIdMEthod to idbroker. the same thing happened. Do I have to define a class that get the sequence data for me. This is no problem, but I cannot find any decent documentation stating how to do this. What do I implement and how do I tell torque what class isthe id broker?? Any help would be appreciated Steve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Sybase case insensitive column names
Just a couple of quick comments. According to a quick read of the SQL 99 standard, column names are supposed to be case insensitive unless they are delimited. Sybase is doing non-standard things here (or my interpretation could be wrong 8) ) Also, changing the way Torque has generated column names since day one could possibly break (badly written) application code if someone has hardcoded this expected behaviour into it. Should this be an optional generation flag? -Original Message- From: Thoralf Rickert [mailto:[EMAIL PROTECTED] Sent: Monday, July 17, 2006 4:45 AM To: Apache Torque Users List Subject: AW: Sybase case insensitive column names Okay, I'll submit a bug report. -Ursprüngliche Nachricht- Von: Thomas Fischer [mailto:[EMAIL PROTECTED] Gesendet: Montag, 17. Juli 2006 10:04 An: Apache Torque Users List Betreff: AW: Sybase case insensitive column names The column names in the class files should be generated in the same case as they appear in the schema file. If this is not the case, this is a bug. This is Torque 3.2 and you did not change anything there, I assume ? If yes, would you mind to submit a bug report to Jira ? Thomas Thoralf Rickert [EMAIL PROTECTED] schrieb am 17.07.2006 09:19:17: That is correct. The JDBC task doesn't change the names. But if you create the classes (om) it creates the column names with uppercase letters and than there is the problem because you cannot make any queries. Here is an example: Generated XML file (correct): table name=address column name=class javaName=aClass primaryKey=true required=true size=2 type=CHAR/ column name=id primaryKey=true required=true size=30 type=VARCHAR/ column name=position primaryKey=true required=true type=INTEGER/ column name=name1 size=50 type=VARCHAR/ column name=name2 size=50 type=VARCHAR/ column name=name3 size=50 type=VARCHAR/ column name=street size=50 type=VARCHAR/ column name=zipcode size=25 type=VARCHAR/ column name=city size=60 type=VARCHAR/ column name=phone size=40 type=VARCHAR/ column name=phone2 size=40 type=VARCHAR/ column name=country size=200 type=VARCHAR/ column name=state size=200 type=VARCHAR/ column name=fax size=40 type=VARCHAR/ column name=email size=150 type=VARCHAR/ /table Generated constants in the BaseAddressPeer (incorrect): static { CLASS = address.CLASS; ID = address.ID; POSITION = address.POSITION; NAME1 = address.NAME1; NAME2 = address.NAME2; NAME3 = address.NAME3; STREET = address.STREET; ZIPCODE = address.ZIPCODE; CITY = address.CITY; PHONE = address.PHONE; PHONE2 = address.PHONE2; COUNTRY = address.COUNTRY; STATE = address.STATE; FAX = address.FAX; EMAIL = address.EMAIL; I think the uppercase column names or uppercase because it's better to read (?). There is no bug in the Sybase JDBC driver (5.5 and 6. 0). I've tested a generated SQL statement on the sybase console (isql) and it fails if the case is not correct, for example: SELECT FROM address WHERE address.CITY=Hamburg failes, but with address.city=... everything is okay. I think this case sensitive behaviour is a Sybase-feature... Maybe I should ask someone on a Sybase JDBC mailinglist howto disable this behaviour. Bye Thoralf -Ursprüngliche Nachricht- Von: Thomas Fischer [mailto:[EMAIL PROTECTED] Gesendet: Samstag, 15. Juli 2006 09:10 An: Apache Torque Users List Betreff: Re: Sybase case insensitive column names Hi, This is strange; the jdbc task should preserve the case of the table and column names (I checked that using mysql; as I do not have a sybase database). The jdbc task uses the DatabaseMetaData from the jdbc driver to get the database; if the database is case sensitive and the DatabaseMetaData does not preserve case it is a bug of the jdbc driver. Thomas On Thu, 13 Jul 2006, Thoralf Rickert wrote: Hi! I've created a schema.xml for an existing Sybase database and I was able to generate the corresponding java classes. If I try to make a query with them I run into a problem. The database uses case sensitive column names but torque generates uppercase column names. For example the following query throws an exception, because the column STATE cannot be found (in the database it's called state). SELECT states.STATE FROM states ORDER BY states.STATE ASC Is there a way to