[
https://issues.apache.org/jira/browse/OODT-521?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13484457#comment-13484457
]
Cameron Goodale commented on OODT-521:
--------------------------------------
UPDATE: So I went into the etc/filemgr.properties and edited the following
line:
{code}
- org.apache.oodt.cas.filemgr.catalog.datasource.quoteFields=false
+ org.apache.oodt.cas.filemgr.catalog.datasource.quoteFields=true
{code}
Now I see this Error Message (which is a step in the right direction):
{code}
INFO: Cataloging Product: [MOD09GA.A2012297.h09v04.005.NRT.hdf]
Oct 25, 2012 1:20:22 PM org.apache.oodt.cas.filemgr.catalog.DataSourceCatalog
addProduct
FINE: addProduct: Executing: INSERT INTO products (product_name,
product_structure, product_transfer_status, product_type_id) VALUES
('MOD09GA.A2012297.h09v04.005.NRT.hdf', 'Flat', 'RECEIVED',
'urn:snow:MOD09GANRT')
org.postgresql.util.PSQLException: ERROR: invalid input syntax for integer:
"urn:snow:MOD09GANRT"
at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2157)
at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1886)
at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:555)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:403)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:395)
at
org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:261)
at
org.apache.oodt.cas.filemgr.catalog.DataSourceCatalog.addProduct(DataSourceCatalog.java:255)
...
...
{code}
Notice how the product_type_id is now single quoted and output as a string in
the SQL statement.
The next step is to set the product_type_id column as text instead of int and
we should be back in business.
> ExpImpCatalog Tool doesn't wrap product_type_id in single quotes
> ----------------------------------------------------------------
>
> Key: OODT-521
> URL: https://issues.apache.org/jira/browse/OODT-521
> Project: OODT
> Issue Type: Bug
> Components: file manager
> Affects Versions: 0.4
> Environment: centOS
> Reporter: Cameron Goodale
> Assignee: Cameron Goodale
> Priority: Minor
> Fix For: 0.5
>
>
> When using the ExpImpCatalog tool to migrate from a Lucene based catalog into
> a PostgreSQL catalog I encountered the following error:
> {code}
> INFO: Cataloging Product: [MOD09GA.A2012297.h09v04.005.NRT.hdf]
> Oct 25, 2012 10:48:16 AM
> org.apache.oodt.cas.filemgr.catalog.DataSourceCatalog addProduct
> FINE: addProduct: Executing: INSERT INTO products (product_name,
> product_structure, product_transfer_status, product_type_id) VALUES
> ('MOD09GA.A2012297.h09v04.005.NRT.hdf', 'Flat', 'RECEIVED',
> urn:snow:MOD09GANRT)
> org.postgresql.util.PSQLException: ERROR: syntax error at or near ":"
> Position: 168
> at
> org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2157)
> at
> org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1886)
> at
> org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
> at
> org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:555)
> at
> org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:403)
> {code}
> So I looked into the source code at:
> https://svn.apache.org/repos/asf/oodt/trunk/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/DataSourceCatalog.java
> And on line 243:
> {code:title=DataSourceCatalog.java|borderStyle=solid}
> addProductSql = "INSERT INTO products (product_name,
> product_structure, product_transfer_status, product_type_id) "
> + "VALUES ('"
> + product.getProductName()
> + "', '"
> + product.getProductStructure()
> + "', '"
> + product.getTransferStatus()
> + "', "
> + productTypeIdStr
> + ")";
> {code}
> The other values are wrapped in single quotes. I think if I also wrap the
> last element in single quotes this Error should be resolved.
> I will test this against my current migration task and post a patch.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira