sqlanywhere / node-sqlanywhere

SAP SQL Anywhere Database Client for Node
Apache License 2.0
39 stars 36 forks source link

"USING CLIENT FILE" not supported in sqlanywhere #48

Open swapson opened 2 years ago

swapson commented 2 years ago

Hi,

I am trying upload client file in Sybase IQ, internally the procedure uses "USING CLIENT FILE" for directly loading file from client machine to database. but sqlanywhere is failing due to file permissions issue. 1) Is this feature supported by sqlanywhere nodejs dependecy like java sajdbc.jar dependency ? 2) If yes, could you please help me to configure nodejs sqlanywhere db connection with appropriate file permission?

Error [Error: Code: -500001 Msg: RAISERROR executed: Error - Unable to load #temp_stats table & sql error code = -6 & Error Message = Operation failed on file due to file permissions. File: /mnt/d/workspaceNodeJS/fileuploadTest2/data/file.csv -- (oslib/hos_clientfileio.cxx]

in java same thing is possible using callback 1) sajdbc.jar & supporting DLL or *.so files 2) class T_filetrans_callback implements sap.jdbc4.sqlanywhere.SAValidateFileTransferCallback { T_filetrans_callback() { }

public int callback(String filename, int is_write)
{
    System.out.println( "File transfer granted for file " + filename +                          
                        " with an is_write value of " + is_write );                         
    return( 1 ); // 0 to disallow, non-zero to allow
}

}

// create and register validate file transfer callback con = connect(); T_filetrans_callback filetran_worker = new T_filetrans_callback(); ((sap.jdbc4.sqlanywhere.IConnection)con).setSAValidateFileTransferCallback( filetran_worker );

Java callback details : https://130.214.205.8/index.html#sqla170/en/html/3bd590f46c5f1014a6ebdf8646d9a523.html