I moved my development server to a new Win 7 machine. Everything works on the new machine, except I am having trouble with a sql statement that executes, but produces no result.
dim sqlpath as c = "[PathAlias.ADB_Path]" + "\\" + "QBexport" + "\\"
sqlpath = filename_decode(sqlpath)
sqlpath = stuff(sqlpath,1,2,"")
sqlpath = stritran(sqlpath,"\\","/")
sqlpath = " '" + sqlpath + "QBexport" + timestamp + ".iif'"
sql = <<%sql%
SET @qbinsert = CONCAT ('QBexport',:A,'.iif');
SET @t3 = :B;
SET @user = :C;
SET @compID = :D;
SET @sqlpath = :E;
SET @sql_text =
CONCAT ("SELECT * FROM `qb_table2` into outfile", @sqlpath,"
FIELDS ENCLOSED BY \'\"\'
TERMINATED BY \'\t\'
ESCAPED BY \'\n\';");
PREPARE s1 FROM @sql_text;
EXECUTE s1;
DROP PREPARE s1;
INSERT INTO qbdownload (fileUploadChar, fileNameShort, CreateTime, UploadedBy, Company_FK) values (@qbinsert, @qbinsert, @t3, @user, @compID)
%sql%
args.add("A",timestamp)
args.add("B",t3)
args.add("C",userName)
args.add("D",comp_ID)
args.add("E",sqlpath)
flag = cn.execute(sql,args)
This should do two things. First, create a file in a folder on the development server. Second, insert a record into the qbdownload table.
The flag returns true, but it accomplishes neither task.
I still have my old development machine, also Win 7, up and running, and it works fine there.
I have tried various versions of this, and have discovered that if I eliminate the code for the into outfile, it will successfully execute the insert.
I cannot get it to produce a file using into outfile.
I think it is a security/permissions issue. I believe I need to grant write access (to folders) to localhost. But I have looked and looked and have not found the solution.
dim sqlpath as c = "[PathAlias.ADB_Path]" + "\\" + "QBexport" + "\\"
sqlpath = filename_decode(sqlpath)
sqlpath = stuff(sqlpath,1,2,"")
sqlpath = stritran(sqlpath,"\\","/")
sqlpath = " '" + sqlpath + "QBexport" + timestamp + ".iif'"
sql = <<%sql%
SET @qbinsert = CONCAT ('QBexport',:A,'.iif');
SET @t3 = :B;
SET @user = :C;
SET @compID = :D;
SET @sqlpath = :E;
SET @sql_text =
CONCAT ("SELECT * FROM `qb_table2` into outfile", @sqlpath,"
FIELDS ENCLOSED BY \'\"\'
TERMINATED BY \'\t\'
ESCAPED BY \'\n\';");
PREPARE s1 FROM @sql_text;
EXECUTE s1;
DROP PREPARE s1;
INSERT INTO qbdownload (fileUploadChar, fileNameShort, CreateTime, UploadedBy, Company_FK) values (@qbinsert, @qbinsert, @t3, @user, @compID)
%sql%
args.add("A",timestamp)
args.add("B",t3)
args.add("C",userName)
args.add("D",comp_ID)
args.add("E",sqlpath)
flag = cn.execute(sql,args)
This should do two things. First, create a file in a folder on the development server. Second, insert a record into the qbdownload table.
The flag returns true, but it accomplishes neither task.
I still have my old development machine, also Win 7, up and running, and it works fine there.
I have tried various versions of this, and have discovered that if I eliminate the code for the into outfile, it will successfully execute the insert.
I cannot get it to produce a file using into outfile.
I think it is a security/permissions issue. I believe I need to grant write access (to folders) to localhost. But I have looked and looked and have not found the solution.
Comment