Users - this week's development summary

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Users - this week's development summary

Si Chen-2
Reply | Threaded
Open this post in threaded view
|

Users - MySQL Problem

Andrew Sykes
Hi,

I'm trying to get OFBiz running with MySQL, there seems to be problems
with the SQL syntax, but perhaps it's some problem with the default
syntax in entityengine.xml

Does anyone recognise this...

20745[       DatabaseUtil.java:356:WARN ] Entity [FacilityGroupMember]
has no table in the database
20749[       DatabaseUtil.java:364:ERROR] Could not create table
[FACILITY_GROUP_MEMBER]: SQL Exception while executing the following:
CREATE TABLE FACILITY_GROUP_MEMBER (FACILITY_ID VARCHAR(20) COLLATE
latin1_general_cs NOT NULL, FACILITY_GROUP_ID VARCHAR(20) COLLATE
latin1_general_cs NOT NULL, FROM_DATE DATETIME NOT NULL, THRU_DATE
DATETIME, SEQUENCE_NUM DECIMAL(18,0), LAST_UPDATED_STAMP DATETIME,
LAST_UPDATED_TX_STAMP DATETIME, CREATED_STAMP DATETIME, CREATED_TX_STAMP
DATETIME, CONSTRAINT PK_FACILITY_GROUP_MEMBER PRIMARY KEY (FACILITY_ID,
FACILITY_GROUP_ID, FROM_DATE)) TYPE InnoDB COLLATE latin1_general_cs
Error was: java.sql.SQLException: You have an error in your SQL syntax.
Check the manual that corresponds to your MySQL server version for the
right syntax to use near 'COLLATE latin1_general_cs NOT NULL,
FACILITY_GROUP_ID VARCHAR(2

There's plenty more, i.e. one for each entity.
--
Kind Regards
Andrew Sykes <[hidden email]>
Sykes Development Ltd
http://www.sykesdevelopment.com

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - MySQL Problem

Vinay Agarwal
I am using MySQL 5 and all I changed was these few lines in entityengine.xml

    <delegator name="default" entity-model-reader="main"
entity-group-reader="main" entity-eca-reader="main"
distributed-cache-clear-enabled="false">
        <group-map group-name="org.ofbiz" datasource-name="localmysql"/>
        <group-map group-name="org.ofbiz.odbc"
datasource-name="localmysql"/>
    </delegator>
    <delegator name="default-no-eca" entity-model-reader="main"
entity-group-reader="main" entity-eca-reader="main"
entity-eca-enabled="false" distributed-cache-clear-enabled="false">
        <group-map group-name="org.ofbiz" datasource-name="localmysql"/>
        <group-map group-name="org.ofbiz.odbc"
datasource-name="localmysql"/>
    </delegator>

Regards,
Vinay Agarwal
-----Original Message-----
From: [hidden email] [mailto:[hidden email]]
On Behalf Of Andrew Sykes
Sent: Saturday, March 11, 2006 7:09 AM
To: OFBiz Users / Usage Discussion
Subject: [OFBiz] Users - MySQL Problem

Hi,

I'm trying to get OFBiz running with MySQL, there seems to be problems
with the SQL syntax, but perhaps it's some problem with the default
syntax in entityengine.xml

Does anyone recognise this...

20745[       DatabaseUtil.java:356:WARN ] Entity [FacilityGroupMember]
has no table in the database
20749[       DatabaseUtil.java:364:ERROR] Could not create table
[FACILITY_GROUP_MEMBER]: SQL Exception while executing the following:
CREATE TABLE FACILITY_GROUP_MEMBER (FACILITY_ID VARCHAR(20) COLLATE
latin1_general_cs NOT NULL, FACILITY_GROUP_ID VARCHAR(20) COLLATE
latin1_general_cs NOT NULL, FROM_DATE DATETIME NOT NULL, THRU_DATE
DATETIME, SEQUENCE_NUM DECIMAL(18,0), LAST_UPDATED_STAMP DATETIME,
LAST_UPDATED_TX_STAMP DATETIME, CREATED_STAMP DATETIME, CREATED_TX_STAMP
DATETIME, CONSTRAINT PK_FACILITY_GROUP_MEMBER PRIMARY KEY (FACILITY_ID,
FACILITY_GROUP_ID, FROM_DATE)) TYPE InnoDB COLLATE latin1_general_cs
Error was: java.sql.SQLException: You have an error in your SQL syntax.
Check the manual that corresponds to your MySQL server version for the
right syntax to use near 'COLLATE latin1_general_cs NOT NULL,
FACILITY_GROUP_ID VARCHAR(2

There's plenty more, i.e. one for each entity.
--
Kind Regards
Andrew Sykes <[hidden email]>
Sykes Development Ltd
http://www.sykesdevelopment.com

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - MySQL Problem

Andrew Sykes
Vinay,

I'm using 4.1, perhaps I should just upgrade :-)

Thanks

On Sat, 2006-03-11 at 08:01 -0800, Vinay Agarwal wrote:

> I am using MySQL 5 and all I changed was these few lines in entityengine.xml
>
>     <delegator name="default" entity-model-reader="main"
> entity-group-reader="main" entity-eca-reader="main"
> distributed-cache-clear-enabled="false">
>         <group-map group-name="org.ofbiz" datasource-name="localmysql"/>
>         <group-map group-name="org.ofbiz.odbc"
> datasource-name="localmysql"/>
>     </delegator>
>     <delegator name="default-no-eca" entity-model-reader="main"
> entity-group-reader="main" entity-eca-reader="main"
> entity-eca-enabled="false" distributed-cache-clear-enabled="false">
>         <group-map group-name="org.ofbiz" datasource-name="localmysql"/>
>         <group-map group-name="org.ofbiz.odbc"
> datasource-name="localmysql"/>
>     </delegator>
>
> Regards,
> Vinay Agarwal
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]]
> On Behalf Of Andrew Sykes
> Sent: Saturday, March 11, 2006 7:09 AM
> To: OFBiz Users / Usage Discussion
> Subject: [OFBiz] Users - MySQL Problem
>
> Hi,
>
> I'm trying to get OFBiz running with MySQL, there seems to be problems
> with the SQL syntax, but perhaps it's some problem with the default
> syntax in entityengine.xml
>
> Does anyone recognise this...
>
> 20745[       DatabaseUtil.java:356:WARN ] Entity [FacilityGroupMember]
> has no table in the database
> 20749[       DatabaseUtil.java:364:ERROR] Could not create table
> [FACILITY_GROUP_MEMBER]: SQL Exception while executing the following:
> CREATE TABLE FACILITY_GROUP_MEMBER (FACILITY_ID VARCHAR(20) COLLATE
> latin1_general_cs NOT NULL, FACILITY_GROUP_ID VARCHAR(20) COLLATE
> latin1_general_cs NOT NULL, FROM_DATE DATETIME NOT NULL, THRU_DATE
> DATETIME, SEQUENCE_NUM DECIMAL(18,0), LAST_UPDATED_STAMP DATETIME,
> LAST_UPDATED_TX_STAMP DATETIME, CREATED_STAMP DATETIME, CREATED_TX_STAMP
> DATETIME, CONSTRAINT PK_FACILITY_GROUP_MEMBER PRIMARY KEY (FACILITY_ID,
> FACILITY_GROUP_ID, FROM_DATE)) TYPE InnoDB COLLATE latin1_general_cs
> Error was: java.sql.SQLException: You have an error in your SQL syntax.
> Check the manual that corresponds to your MySQL server version for the
> right syntax to use near 'COLLATE latin1_general_cs NOT NULL,
> FACILITY_GROUP_ID VARCHAR(2
>
> There's plenty more, i.e. one for each entity.
--
Kind Regards
Andrew Sykes <[hidden email]>
Sykes Development Ltd
http://www.sykesdevelopment.com

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - MySQL Problem

David E. Jones
In reply to this post by Andrew Sykes

This happens because the MySQL JDBC driver doesn't fully implement  
the spec. When we ask for a list of all columns in the database in  
the way that we are we get back an empty result set. We are using the  
feature in the JDBC API to get them all at once, but it appears that  
MySQL only supports getting them one at a time, which is _very_ slow  
when you have hundreds of tables to check...

So, this is a non-critical error. You can disable the create missing  
on startup to avoid these errors, and then just remember to run the  
check/update in WebTools when entities change.

==================
Okay, I just looked at the DatabaseUtil file and added some stuff to  
try passing a wild card (%) instead of null to get all columns and  
all pks. Could you try that out for me on your setup and see if it  
works with MySQL?

-David


On Mar 11, 2006, at 8:09 AM, Andrew Sykes wrote:

> Hi,
>
> I'm trying to get OFBiz running with MySQL, there seems to be problems
> with the SQL syntax, but perhaps it's some problem with the default
> syntax in entityengine.xml
>
> Does anyone recognise this...
>
> 20745[       DatabaseUtil.java:356:WARN ] Entity [FacilityGroupMember]
> has no table in the database
> 20749[       DatabaseUtil.java:364:ERROR] Could not create table
> [FACILITY_GROUP_MEMBER]: SQL Exception while executing the following:
> CREATE TABLE FACILITY_GROUP_MEMBER (FACILITY_ID VARCHAR(20) COLLATE
> latin1_general_cs NOT NULL, FACILITY_GROUP_ID VARCHAR(20) COLLATE
> latin1_general_cs NOT NULL, FROM_DATE DATETIME NOT NULL, THRU_DATE
> DATETIME, SEQUENCE_NUM DECIMAL(18,0), LAST_UPDATED_STAMP DATETIME,
> LAST_UPDATED_TX_STAMP DATETIME, CREATED_STAMP DATETIME,  
> CREATED_TX_STAMP
> DATETIME, CONSTRAINT PK_FACILITY_GROUP_MEMBER PRIMARY KEY  
> (FACILITY_ID,
> FACILITY_GROUP_ID, FROM_DATE)) TYPE InnoDB COLLATE latin1_general_cs
> Error was: java.sql.SQLException: You have an error in your SQL  
> syntax.
> Check the manual that corresponds to your MySQL server version for the
> right syntax to use near 'COLLATE latin1_general_cs NOT NULL,
> FACILITY_GROUP_ID VARCHAR(2
>
> There's plenty more, i.e. one for each entity.
> --
> Kind Regards
> Andrew Sykes <[hidden email]>
> Sykes Development Ltd
> http://www.sykesdevelopment.com
>
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/users

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users

smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Users - MySQL Problem

Andrew Sykes
David,

I've tried inserting "%" into various method calls...

[line 868] tableSet = dbData.getTables(null, lookupSchemaName, "%",
types);
[line 1015] ResultSet rsCols = dbData.getColumns(null, lookupSchemaName,
"%", null);
[line 1060] ResultSet rsPks = dbData.getPrimaryKeys(null,
lookupSchemaName, "%");
[line 1197] ResultSet rsCols = dbData.getImportedKeys(null,
lookupSchemaName, "%");

This doesn't seem to make any difference. I'm actually not really sure
why you think that would make a difference, the SQL error seems to be
around the 'collate' statement.

Perhaps I've misinterpreted your suggestion?

Also, I'm not sure how I'd go about using webtools to get around this
given that I have no schema and can't therefor log in. This seems quite
a critical problem.



On Sat, 2006-03-11 at 09:18 -0700, David E. Jones wrote:

> This happens because the MySQL JDBC driver doesn't fully implement  
> the spec. When we ask for a list of all columns in the database in  
> the way that we are we get back an empty result set. We are using the  
> feature in the JDBC API to get them all at once, but it appears that  
> MySQL only supports getting them one at a time, which is _very_ slow  
> when you have hundreds of tables to check...
>
> So, this is a non-critical error. You can disable the create missing  
> on startup to avoid these errors, and then just remember to run the  
> check/update in WebTools when entities change.
>
> ==================
> Okay, I just looked at the DatabaseUtil file and added some stuff to  
> try passing a wild card (%) instead of null to get all columns and  
> all pks. Could you try that out for me on your setup and see if it  
> works with MySQL?
>
> -David
>
>
> On Mar 11, 2006, at 8:09 AM, Andrew Sykes wrote:
>
> > Hi,
> >
> > I'm trying to get OFBiz running with MySQL, there seems to be problems
> > with the SQL syntax, but perhaps it's some problem with the default
> > syntax in entityengine.xml
> >
> > Does anyone recognise this...
> >
> > 20745[       DatabaseUtil.java:356:WARN ] Entity [FacilityGroupMember]
> > has no table in the database
> > 20749[       DatabaseUtil.java:364:ERROR] Could not create table
> > [FACILITY_GROUP_MEMBER]: SQL Exception while executing the following:
> > CREATE TABLE FACILITY_GROUP_MEMBER (FACILITY_ID VARCHAR(20) COLLATE
> > latin1_general_cs NOT NULL, FACILITY_GROUP_ID VARCHAR(20) COLLATE
> > latin1_general_cs NOT NULL, FROM_DATE DATETIME NOT NULL, THRU_DATE
> > DATETIME, SEQUENCE_NUM DECIMAL(18,0), LAST_UPDATED_STAMP DATETIME,
> > LAST_UPDATED_TX_STAMP DATETIME, CREATED_STAMP DATETIME,  
> > CREATED_TX_STAMP
> > DATETIME, CONSTRAINT PK_FACILITY_GROUP_MEMBER PRIMARY KEY  
> > (FACILITY_ID,
> > FACILITY_GROUP_ID, FROM_DATE)) TYPE InnoDB COLLATE latin1_general_cs
> > Error was: java.sql.SQLException: You have an error in your SQL  
> > syntax.
> > Check the manual that corresponds to your MySQL server version for the
> > right syntax to use near 'COLLATE latin1_general_cs NOT NULL,
> > FACILITY_GROUP_ID VARCHAR(2
> >
> > There's plenty more, i.e. one for each entity.
> > --
> > Kind Regards
> > Andrew Sykes <[hidden email]>
> > Sykes Development Ltd
> > http://www.sykesdevelopment.com
> >
> >
> > _______________________________________________
> > Users mailing list
> > [hidden email]
> > http://lists.ofbiz.org/mailman/listinfo/users
>
>  _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/users
--
Kind Regards
Andrew Sykes <[hidden email]>
Sykes Development Ltd
http://www.sykesdevelopment.com

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - MySQL Problem

BJ Freeman
Not a mysql expert. read somewhere COLLATE started in version 5.

Andrew Sykes sent the following on 3/11/06 9:23 AM:

> David,
>
> I've tried inserting "%" into various method calls...
>
> [line 868] tableSet = dbData.getTables(null, lookupSchemaName, "%",
> types);
> [line 1015] ResultSet rsCols = dbData.getColumns(null, lookupSchemaName,
> "%", null);
> [line 1060] ResultSet rsPks = dbData.getPrimaryKeys(null,
> lookupSchemaName, "%");
> [line 1197] ResultSet rsCols = dbData.getImportedKeys(null,
> lookupSchemaName, "%");
>
> This doesn't seem to make any difference. I'm actually not really sure
> why you think that would make a difference, the SQL error seems to be
> around the 'collate' statement.
>
> Perhaps I've misinterpreted your suggestion?
>
> Also, I'm not sure how I'd go about using webtools to get around this
> given that I have no schema and can't therefor log in. This seems quite
> a critical problem.
>
>
>
> On Sat, 2006-03-11 at 09:18 -0700, David E. Jones wrote:
>
>>This happens because the MySQL JDBC driver doesn't fully implement  
>>the spec. When we ask for a list of all columns in the database in  
>>the way that we are we get back an empty result set. We are using the  
>>feature in the JDBC API to get them all at once, but it appears that  
>>MySQL only supports getting them one at a time, which is _very_ slow  
>>when you have hundreds of tables to check...
>>
>>So, this is a non-critical error. You can disable the create missing  
>>on startup to avoid these errors, and then just remember to run the  
>>check/update in WebTools when entities change.
>>
>>==================
>>Okay, I just looked at the DatabaseUtil file and added some stuff to  
>>try passing a wild card (%) instead of null to get all columns and  
>>all pks. Could you try that out for me on your setup and see if it  
>>works with MySQL?
>>
>>-David
>>
>>
>>On Mar 11, 2006, at 8:09 AM, Andrew Sykes wrote:
>>
>>
>>>Hi,
>>>
>>>I'm trying to get OFBiz running with MySQL, there seems to be problems
>>>with the SQL syntax, but perhaps it's some problem with the default
>>>syntax in entityengine.xml
>>>
>>>Does anyone recognise this...
>>>
>>>20745[       DatabaseUtil.java:356:WARN ] Entity [FacilityGroupMember]
>>>has no table in the database
>>>20749[       DatabaseUtil.java:364:ERROR] Could not create table
>>>[FACILITY_GROUP_MEMBER]: SQL Exception while executing the following:
>>>CREATE TABLE FACILITY_GROUP_MEMBER (FACILITY_ID VARCHAR(20) COLLATE
>>>latin1_general_cs NOT NULL, FACILITY_GROUP_ID VARCHAR(20) COLLATE
>>>latin1_general_cs NOT NULL, FROM_DATE DATETIME NOT NULL, THRU_DATE
>>>DATETIME, SEQUENCE_NUM DECIMAL(18,0), LAST_UPDATED_STAMP DATETIME,
>>>LAST_UPDATED_TX_STAMP DATETIME, CREATED_STAMP DATETIME,  
>>>CREATED_TX_STAMP
>>>DATETIME, CONSTRAINT PK_FACILITY_GROUP_MEMBER PRIMARY KEY  
>>>(FACILITY_ID,
>>>FACILITY_GROUP_ID, FROM_DATE)) TYPE InnoDB COLLATE latin1_general_cs
>>>Error was: java.sql.SQLException: You have an error in your SQL  
>>>syntax.
>>>Check the manual that corresponds to your MySQL server version for the
>>>right syntax to use near 'COLLATE latin1_general_cs NOT NULL,
>>>FACILITY_GROUP_ID VARCHAR(2
>>>
>>>There's plenty more, i.e. one for each entity.
>>>--
>>>Kind Regards
>>>Andrew Sykes <[hidden email]>
>>>Sykes Development Ltd
>>>http://www.sykesdevelopment.com
>>>
>>>
>>>_______________________________________________
>>>Users mailing list
>>>[hidden email]
>>>http://lists.ofbiz.org/mailman/listinfo/users
>>
>> _______________________________________________
>>Users mailing list
>>[hidden email]
>>http://lists.ofbiz.org/mailman/listinfo/users
 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - MySQL Problem

David E. Jones
In reply to this post by Andrew Sykes

Oops, I should have read the error better. You may have to turn off  
the collate by just removing it from the datasource element in the  
entityengine.xml file.

BTW, which version of 4.1 are you using? The earlier revisions even  
in the 4.1 series had issues that kept them from working with OFBiz.  
I know it works with 4.1.11 and probably later ones too.

-David


On Mar 11, 2006, at 10:23 AM, Andrew Sykes wrote:

> David,
>
> I've tried inserting "%" into various method calls...
>
> [line 868] tableSet = dbData.getTables(null, lookupSchemaName, "%",
> types);
> [line 1015] ResultSet rsCols = dbData.getColumns(null,  
> lookupSchemaName,
> "%", null);
> [line 1060] ResultSet rsPks = dbData.getPrimaryKeys(null,
> lookupSchemaName, "%");
> [line 1197] ResultSet rsCols = dbData.getImportedKeys(null,
> lookupSchemaName, "%");
>
> This doesn't seem to make any difference. I'm actually not really sure
> why you think that would make a difference, the SQL error seems to be
> around the 'collate' statement.
>
> Perhaps I've misinterpreted your suggestion?
>
> Also, I'm not sure how I'd go about using webtools to get around this
> given that I have no schema and can't therefor log in. This seems  
> quite
> a critical problem.
>
>
>
> On Sat, 2006-03-11 at 09:18 -0700, David E. Jones wrote:
>> This happens because the MySQL JDBC driver doesn't fully implement
>> the spec. When we ask for a list of all columns in the database in
>> the way that we are we get back an empty result set. We are using the
>> feature in the JDBC API to get them all at once, but it appears that
>> MySQL only supports getting them one at a time, which is _very_ slow
>> when you have hundreds of tables to check...
>>
>> So, this is a non-critical error. You can disable the create missing
>> on startup to avoid these errors, and then just remember to run the
>> check/update in WebTools when entities change.
>>
>> ==================
>> Okay, I just looked at the DatabaseUtil file and added some stuff to
>> try passing a wild card (%) instead of null to get all columns and
>> all pks. Could you try that out for me on your setup and see if it
>> works with MySQL?
>>
>> -David
>>
>>
>> On Mar 11, 2006, at 8:09 AM, Andrew Sykes wrote:
>>
>>> Hi,
>>>
>>> I'm trying to get OFBiz running with MySQL, there seems to be  
>>> problems
>>> with the SQL syntax, but perhaps it's some problem with the default
>>> syntax in entityengine.xml
>>>
>>> Does anyone recognise this...
>>>
>>> 20745[       DatabaseUtil.java:356:WARN ] Entity  
>>> [FacilityGroupMember]
>>> has no table in the database
>>> 20749[       DatabaseUtil.java:364:ERROR] Could not create table
>>> [FACILITY_GROUP_MEMBER]: SQL Exception while executing the  
>>> following:
>>> CREATE TABLE FACILITY_GROUP_MEMBER (FACILITY_ID VARCHAR(20) COLLATE
>>> latin1_general_cs NOT NULL, FACILITY_GROUP_ID VARCHAR(20) COLLATE
>>> latin1_general_cs NOT NULL, FROM_DATE DATETIME NOT NULL, THRU_DATE
>>> DATETIME, SEQUENCE_NUM DECIMAL(18,0), LAST_UPDATED_STAMP DATETIME,
>>> LAST_UPDATED_TX_STAMP DATETIME, CREATED_STAMP DATETIME,
>>> CREATED_TX_STAMP
>>> DATETIME, CONSTRAINT PK_FACILITY_GROUP_MEMBER PRIMARY KEY
>>> (FACILITY_ID,
>>> FACILITY_GROUP_ID, FROM_DATE)) TYPE InnoDB COLLATE latin1_general_cs
>>> Error was: java.sql.SQLException: You have an error in your SQL
>>> syntax.
>>> Check the manual that corresponds to your MySQL server version  
>>> for the
>>> right syntax to use near 'COLLATE latin1_general_cs NOT NULL,
>>> FACILITY_GROUP_ID VARCHAR(2
>>>
>>> There's plenty more, i.e. one for each entity.
>>> --
>>> Kind Regards
>>> Andrew Sykes <[hidden email]>
>>> Sykes Development Ltd
>>> http://www.sykesdevelopment.com
>>>
>>>
>>> _______________________________________________
>>> Users mailing list
>>> [hidden email]
>>> http://lists.ofbiz.org/mailman/listinfo/users
>>
>>  _______________________________________________
>> Users mailing list
>> [hidden email]
>> http://lists.ofbiz.org/mailman/listinfo/users
> --
> Kind Regards
> Andrew Sykes <[hidden email]>
> Sykes Development Ltd
> http://www.sykesdevelopment.com
>
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/users

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users

smime.p7s (3K) Download Attachment