How to save Java byte Array in Oracle
Hi All,
I'm using Java and need to save byte Array in Database. Initially the column is varchar2 type. is it possible to save in this type or need to modify the column type to CLOB.
please clarify me.
thanks in advance.
regards
pavan.
You might want to use a BLOB instead
because CLOB & varchar2 are strings unless you encode your byte array
CLOB & varchar2 datatypes won`t record 0x00 if you have any in your array
it will be considered as the string terminator
Similar Messages
-
How to Read Java Byte Array back into SAP xstring Table?
Hi Guys,
I have a situation whereby a user can upload a document in a WebDynpro Java Application. This needs to be saved. I am trying to see if I can make the location of this file that is being saved to be on our SAP AS. I have written a SAP RFC that is imported into the Java Application for use.
The RFC is expecting a table of type TBL1024 which is basically a table of xstring values. The Java proxy interprets this SAP table as a byte array. This is my problem... I cannot seem to "break" up the Byte array into lines of 1024 lengt and send it back to SAP. All that is happening currently is that the byte array creates a singe line in the TBL1024 that consists of only the first 1024 bytes in the array... This means that only the first 1024 bytes of my document is being saved - making it corrupt.
Please advise,
Kind regards,
ChristiaanLoop it...
File file = new File("java.pdf");
FileInputStream fis = new FileInputStream(file);
byte[] buf = new byte[1024];
try {
for (int readNum; (readNum = fis.read(buf)) != -1;) {
// Here populate the RFC table
} catch (IOException ex) { -
How to save a Byte array on to the desktop?
Hi All,
I am taking Byte array once clicked and that is being printed
in an swfloader in the same page. I want the same to be saved as a
image over my desktop. If anyone can help me with this regard that
would be really greatful.
Thanking you in advance.Hi,
Please refer to the following article.
https://msdn.microsoft.com/en-us/library/office/ms454491(v=office.14).aspx
SPFolder currentFolder = oLib.RootFolder;
currentFolder.SubFolders.Add("foldername");
Please don't forget to mark it as answered, if your problem resolved or helpful. -
How to create java stored procedure from oracle(Dastageer)
how to create java stored procedure from oracle-please help me to create the procedure.
Hi,
This forum is exclusively for discussions related to Sun Java Studio Creator. Please post your question in the appropriate forum.
Thanks,
RK. -
JDO : how to map a byte array field correctly
Could someone please provide an example on how to correctly map a byte array field in a PCClass.
The field should be mapped to a BLOB field in my Dictionary project.
The checker keeps throwing errors during the enhancement process. Tried all sorts of combinations of xml in my jdo and map file (using the dtd) but I still haven't found the solution. The compilation works fine though, it is only the checker that complains.You're already in a PDF open in Acrobat (not the free Adobe Reader) and you've made a new PDF? Which you want to save to disk and reopen?
-
How to open a byte array of pdf into acrobat reader dynamically..
hi,
my java program is connecting to a url and downloading various file(.pdf,.xml format) into hard-disk. now the requirement is if user select "Preview" button, then file is downloaded and opened with appropriate application(acrobat reader for .pdf file) but not saved anywhere in hard-disk ...
any idea, any hint any help is welcomed..
thanks in advance..hi friends,
i got the solution. i am using one external api of adobe acrobat, through which i am able to stream pdf document in form of byte array into acrobat viewer,without writing data in any file.
so my work is done.. :) -
How we build Java Database Connectivity for Oracle 8i Database
Can any one send me a sample code for Java Database Connectivity for Oracle 8i Database
it will be a grat help
Thanks & Regards
RasikaYou don't need a DSN if you use Oracle's JDBC driver.
You didn't read ANY of the previous replies. What makes you think this one willk help? Or any instruction, for that matter?
Sounds like you just want someone to give it to you. OK, I'll bite, but you have to figure out the rest:
import java.sql.*;
import java.util.*;
* Command line app that allows a user to connect with a database and
* execute any valid SQL against it
public class DataConnection
public static final String DEFAULT_DRIVER = "sun.jdbc.odbc.JdbcOdbcDriver";
public static final String DEFAULT_URL = "jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:\\Edu\\Java\\Forum\\DataConnection.mdb";
public static final String DEFAULT_USERNAME = "admin";
public static final String DEFAULT_PASSWORD = "";
public static final String DEFAULT_DRIVER = "com.mysql.jdbc.Driver";
public static final String DEFAULT_URL = "jdbc:mysql://localhost:3306/hibernate";
public static final String DEFAULT_USERNAME = "admin";
public static final String DEFAULT_PASSWORD = "";
/** Database connection */
private Connection connection;
* Driver for the DataConnection
* @param command line arguments
* <ol start='0'>
* <li>SQL query string</li>
* <li>JDBC driver class</li>
* <li>database URL</li>
* <li>username</li>
* <li>password</li>
* </ol>
public static void main(String [] args)
DataConnection db = null;
try
if (args.length > 0)
String sql = args[0];
String driver = ((args.length > 1) ? args[1] : DEFAULT_DRIVER);
String url = ((args.length > 2) ? args[2] : DEFAULT_URL);
String username = ((args.length > 3) ? args[3] : DEFAULT_USERNAME);
String password = ((args.length > 4) ? args[4] : DEFAULT_PASSWORD);
System.out.println("sql : " + sql);
System.out.println("driver : " + driver);
System.out.println("url : " + url);
System.out.println("username: " + username);
System.out.println("password: " + password);
db = new DataConnection(driver, url, username, password);
System.out.println("Connection established");
Object result = db.executeSQL(sql);
System.out.println(result);
else
System.out.println("Usage: db.DataConnection <sql> <driver> <url> <username> <password>");
catch (SQLException e)
System.err.println("SQL error: " + e.getErrorCode());
System.err.println("SQL state: " + e.getSQLState());
e.printStackTrace(System.err);
catch (Exception e)
e.printStackTrace(System.err);
finally
if (db != null)
db.close();
db = null;
* Create a DataConnection
* @throws SQLException if the database connection fails
* @throws ClassNotFoundException if the driver class can't be loaded
public DataConnection() throws SQLException,ClassNotFoundException
this(DEFAULT_DRIVER, DEFAULT_URL, DEFAULT_USERNAME, DEFAULT_PASSWORD);
* Create a DataConnection
* @throws SQLException if the database connection fails
* @throws ClassNotFoundException if the driver class can't be loaded
public DataConnection(final String driver,
final String url,
final String username,
final String password)
throws SQLException,ClassNotFoundException
Class.forName(driver);
this.connection = DriverManager.getConnection(url, username, password);
* Get Driver properties
* @param database URL
* @return list of driver properties
* @throws SQLException if the query fails
public List getDriverProperties(final String url)
throws SQLException
List driverProperties = new ArrayList();
Driver driver = DriverManager.getDriver(url);
if (driver != null)
DriverPropertyInfo[] info = driver.getPropertyInfo(url, null);
if (info != null)
driverProperties = Arrays.asList(info);
return driverProperties;
* Clean up the connection
public void close()
close(this.connection);
* Execute ANY SQL statement
* @param SQL statement to execute
* @returns list of row values if a ResultSet is returned,
* OR an altered row count object if not
* @throws SQLException if the query fails
public Object executeSQL(final String sql) throws SQLException
Object returnValue;
Statement statement = null;
ResultSet rs = null;
try
statement = this.connection.createStatement();
boolean hasResultSet = statement.execute(sql);
if (hasResultSet)
rs = statement.getResultSet();
ResultSetMetaData meta = rs.getMetaData();
int numColumns = meta.getColumnCount();
List rows = new ArrayList();
while (rs.next())
Map thisRow = new LinkedHashMap();
for (int i = 1; i <= numColumns; ++i)
String columnName = meta.getColumnName(i);
Object value = rs.getObject(columnName);
thisRow.put(columnName, value);
rows.add(thisRow);
returnValue = rows;
else
int updateCount = statement.getUpdateCount();
returnValue = new Integer(updateCount);
finally
close(rs);
close(statement);
return returnValue;
* Close a database connection
* @param connection to close
public static final void close(Connection connection)
try
if (connection != null)
connection.close();
connection = null;
catch (SQLException e)
e.printStackTrace();
* Close a statement
* @param statement to close
public static final void close(Statement statement)
try
if (statement != null)
statement.close();
statement = null;
catch (SQLException e)
e.printStackTrace();
* Close a result set
* @param rs to close
public static final void close(ResultSet rs)
try
if (rs != null)
rs.close();
rs = null;
catch (SQLException e)
e.printStackTrace();
* Close a database connection and statement
* @param connection to close
* @param statement to close
public static final void close(Connection connection, Statement statement)
close(statement);
close(connection);
* Close a database connection, statement, and result set
* @param connection to close
* @param statement to close
* @param rs to close
public static final void close(Connection connection,
Statement statement,
ResultSet rs)
close(rs);
close(statement);
close(connection);
}% -
How can i store bytes array in MS ACCESS???
Hi,
i m making small project using Ms Access as a dataBase.
In which i am encripting some confidential data say ACCOUNT_NAME and storing it into MS Access in encripted form........
The problem is encripted data is in bytes array n how can i store it into MS access ??? is there any data type similar to BLOB in Ms Access ??
please help me................
i had searched net for this but till now not found any useful info :(You can try:
binay type (JET3 255 bytes,JET4 510) Types.BINARY
ole type (0~1 G) Types.LONVARBINARY
You can use Text (JET3 255 bytes�CJET4 510bytes) Types.VARCHAR if you use base64 encoding for
ACCOUNT_NAME column. -
How to save a 4D Array in a File and load it later on?
Hello,
I am trying to save a 4D Array (Array[4000] [3] [20] [5]) of UINT in a File. I can do it through "write in binary File". But then I can´t load it. I know I can transform my Array down to 1D Array of 1.200.000 Elements (4000*3*20*5) of UINT. When I load it, I have to transform it back (with a lot of "for-looping") back to 4D. But is there an easier way of doing that?
I was not able to find a solution in this forum - I am sorry if I made a new thread if there is already a solution in this forum.
Best regards
LabVIEW 2011
Solved!
Go to Solution.As Lynn said, there should be no extra code required.
When writing, make sure that "prepend size" is true (true is default) and when reading, wire an empty 4D array of the correct representation to the "data type" input.
(I also assume that your LabVIEW version is not extremely ancient)
LabVIEW Champion . Do more with less code and in less time . -
So, I search the binary matlab file format('*.mat').
Title:
Moving Data Between MATLAB® and LabVIEW
Problem:
How can I share data between LabVIEW and the MATLAB environment?
Solution:
MATLAB users can move data between the
MATLAB environment and LabVIEW, you have several options. Prior to
LabVIEW 5.1, the only way to transfer data between these two
environments was to use the Save and Load functions. Those are discussed herein.
Beginning
in LabVIEW 8.0, MathScipt was introduced. MathScript is an integrated
part of LabVIEW that you can use to combine intuitive graphical
dataflow programming with math-oriented textual programming. See the
attached links below for more information on MathScript.
Beginning
in LabVIEW 5.1, the MATLAB script node was introduced into the LabVIEW
programming environment. The MATLAB script node makes ActiveX calls to
the MATLAB software from within LabVIEW. This requires that both MATLAB
be installed on the same machine and that a valid license is obtained.
More information on the MATLAB script node can be found in the attached
KB's.
For all versions of LabVIEW, this data transfer can be
performed by saving the data in a file using the MATLAB software and
reading it directly from LabVIEW, or vice versa. In the MATLAB
environment, the command "save" allows you to save the data in
binary format (*.mat) or ASCII format. You also have an option of
saving it in ASCII format using a tab delimiter between data points and
the command "load" allows you to read in the data.
ASCII Format
Complete the following steps to import or export data between LabVIEW and the MATLAB environment using an ASCII file format.
From the MATLAB environment to LabVIEW
To save a vector or a matrix X in tab-delimited ASCII format, enter the following in the command window or m-script file in the MATLAB environment:
>>SAVE filename X -ascii -double -tabs
This creates a file named filename containing data X in tab-delimited ASCII format.
Import the file into LabVIEW using the Read From Spreadsheet File VI located on the Functions»File I/O palette.
From LabVIEW to the MATLAB environment
To export a matrix X from LabVIEW to the MATLAB environment, first save the data in ASCII format in LabVIEW using the Write To Spreadsheet File VI on the Functions » File I/O palette.
Enter the following in the command window of the MATLAB environment, or in the m-script file:
>> LOAD filename
This reads the data into the MATLAB environment.
Binary Format
Complete the following steps to import or export data between LabVIEW and the MATLAB environment.
From the MATLAB environment to LabVIEW
As mentioned above, LabVIEW does not save multiple variables to one
data with extra manipulation, and will not be discussed here.
Therefore, the only way of sending the data from the MATLAB environment
to LabVIEW without tampering with the MAT binary file structure is
using the ASCII format. Also, please bear in mind that you need to have
one file for one variable.
From LabVIEW to the MATLAB environment
Because
the MATLAB software saves data in its own binary format, the "MAT"
file, binary LabVIEW data must be converted to this format prior to
transferring the data. The attached examples can be used to save
LabVIEW data in the MATLAB software format. The convenience of the .MAT
file format is that more than one variable can be saved in the same
file. The example shows saving seven variables to .MAT format; the
example can be modified for any number of variables.
Once this data is saved from LabVIEW, it can be read into the MATLAB environment, using the following command:
>>LOAD filename
The Who
command can then be used to display all the seven variable names, and
you can display the content of them by entering the variable names at
the command prompt as usual.
MATLAB® is a
registered trademark of The MathWorks, Inc. Other product and company
names listed are trademarks and trade names of their respective
companies.
| Michael K | Project Manager | LabVIEW R&D | National Instruments | -
How to insert java.util.Date to Oracle by OraclePrepaidStatement
Hi all,
I am trying to insert the date data to oracle a lot. But all of them works wrong???
Here's a code:
package main;
import oracle.jdbc.driver.*;
import oracledb.OraCon;
import java.text.SimpleDateFormat;
public class inmain {
* @param args
public static void main(String[] args)
OraCon conn = new OraCon();
conn.alloc();
String sql = "insert into test(c_Date, c_Float, c_Int, c_String) values (?,?,?,?)";
java.text.SimpleDateFormat MMddyyyyHHmmss = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
try
OraclePreparedStatement ps = (OraclePreparedStatement)conn.oraconnection.prepareStatement(sql);
String date = "12/12/2006 17:33:01";
java.util.Date ud = MMddyyyyHHmmss.parse(date);
java.sql.Date dd = new java.sql.Date(ud.getTime());
float ff = Integer.parseInt("1");
ps.setDate(1, dd);
ps.setFloat(2, ff);
ps.setInt(3, 4);
ps.setString(4, "This is test");
ps.executeUpdate();
catch(Exception e)
e.printStackTrace();
}Then I select from the table.
select to_char(test.C_DATE, 'yyyy-MM-dd HH24:mi:ss')
from test
Its result is:
2006-12-12 00:00:00
I wanna to show 2006-12-12 17:33:01.
How?Dear NiallMcG,
Thank you very much, It now works fine.
package main;
import oracle.jdbc.driver.*;
import oracledb.OraCon;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
public class inmain {
* @param args
public static void main(String[] args)
OraCon conn = new OraCon();
conn.alloc();
String sql = "insert into test(c_Date, c_Float, c_Int, c_String) values (?,?,?,?)";
java.text.SimpleDateFormat MMddyyyyHHmmss = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
try
OraclePreparedStatement ps = (OraclePreparedStatement)conn.oraconnection.prepareStatement(sql);
String date = "12/12/2006 17:33:01";
java.util.Date ud = MMddyyyyHHmmss.parse(date);
float ff = Integer.parseInt("1");
Timestamp ts = new java.sql.Timestamp(ud.getTime());
ps.setTimestamp(1,ts);
ps.setFloat(2, ff);
ps.setInt(3, 4);
ps.setString(4, "This is test");
ps.executeUpdate();
catch(Exception e)
e.printStackTrace();
conn.release();
} -
How to configure hw disk array for ORACLE VM SERVER 2.1.1?
ORACLE VM SERVER 2.1.1 ON DISK SATA ARRAY R0. AFTER A INSTALLATION ORACLE VM SERVER DON;T LOAD
No reason to shout, buddy... Turn CAPS LOCK off, please.
Some more information might come in handy also. Like what kind of hardware you're using.
Otherwise it's going to be a shot in the dark.
In the meantime: try some GRUB-parameters to boot from the right device. That's all I can think of right now. -
How to save pdf file(path) in oracle db
Hi all,
we are using forms 10g. the requirement is user can upload the pdf file from the forms. the pdf file should store in the server folder and the path can store in the db table field. when ever the user wish to download that pdf based up on the unique pdf name that should be open or save on client machine.
can anybody help me how to do this
Thank youHi Amatu Allah,
thank you for your reply
i have the code based upon the webutil functions but it is not working can u pls help me
Here---B8 is Block name
if :toolbar.li_mode in('M') then
if :b8.pdf_loc1 is not null then
declare
l_success boolean;
BEGIN
mesg(1);
l_success := webutil_file_transfer.Client_To_DB_with_progress
(:b8.pdf_loc1-------------------------------------------------------------------------------------source file location,
't002pod_pdf', ---------------------------------------------------------------------------------table name
'pdf',-----------------------------------------------------------------------------------------------column name
'doc_no = :b8.doc_no',---------------------------------------------------------------------doc_no is field
'Upload to Database in progress',
'Please wait',
false,
null
if l_success
then
message('File uploaded successfully into the Database');
else
message('File upload to Database failed');
end if;
exception
when others
then
message('File upload failed: '||sqlerrm);
END;
else
mesg('Plese Select The File name');
go_item('B8.pdf_open');
end if;
end if;
---------------------------------------------------------------------WEBUTIL FUNCTION BODY------------------------------------------------------------------------
FUNCTION Client_To_DB_With_Progress
( clientFile in VARCHAR2,
tableName in VARCHAR2,
columnName in VARCHAR2,
whereClause in VARCHAR2,
progressTitle in VARCHAR2,
progressSubTitle in VARCHAR2,
asynchronous in BOOLEAN default FALSE,
callbackTrigger in VARCHAR2 default NULL) return BOOLEAN is
BEGIN
return UploadInt
( clientFile,
tableName,
columnName,
whereClause,
true,
true,
progressTitle,
progressSubTitle,
asynchronous,
callbackTrigger);
END Client_To_DB_With_Progress;
-- Internal implementations ----
FUNCTION UploadInt ( clientFile in VARCHAR2,
spec1 in VARCHAR2,
spec2 in VARCHAR2,
spec3 in VARCHAR2,
toDB in BOOLEAN,
withProgress in BOOLEAN,
progressTitle in VARCHAR2,
progressSubTitle in VARCHAR2,
asynchronous in BOOLEAN default FALSE,
callbackTrigger in VARCHAR2 default NULL) return BOOLEAN is
clientFileSize PLS_INTEGER := 0;
clientFileChunks PLS_INTEGER := 0;
clientFileInfo VARCHAR2(1000 char);
result BOOLEAN := FALSE;
dataBuffer VARCHAR2(32767);
ignore VARCHAR2(2);
jobj ORA_JAVA.JOBJECT;
lastErrorCode PLS_INTEGER;
lastErrorArgs VARCHAR2(1000);
encodedFile ORA_JAVA.JOBJECT;
ftemp TEXT_IO.FILE_TYPE;
tempFileName VARCHAR2(512);
bool_ignore boolean;
BEGIN
mesg('inside function--2');
-- Client file cannot be null
if clientFile is null then
raise CLIENT_FILE_NULL;
end if;
-- AS file cannot be null. AppsServerFileWriter also handles this. Better to handle here.
if NOT toDB AND spec1 is null then
raise AS_FILE_NULL;
end if;
-- Make sure the client file to be uploaded exists and readable
-- If we don't raise exception here, we end up creating an empty file on DB or AS
if NOT webutil_file.file_is_readable(clientFile)
OR webutil_file.file_is_directory (clientFile) then
raise FILE_NOT_FOUND;
end if;
-- First check to see if a transfer is not currently happening
if In_Progress then
raise AGENT_BUSY;
end if;
-- reset the target
m_toDB := toDB;
-- Set up the file info
clientFileInfo := clientFile||'|0|'||
WEBUTIL_UTIL.BoolToStr(asynchronous,'A|','S|')||
WEBUTIL_UTIL.BoolToStr(withProgress,'Y|','N|')||
progressTitle||'|'||
progressSubTitle;
WebUtil_Core.setProperty(WebUtil_Core.WUT_PACKAGE,'WUT_FILE_INFO', clientFileInfo);
mesg('clietfileinfo: '||clientFileInfo);
-- get the size and chunk info of the client side file
clientFileInfo := WebUtil_Core.getProperty(WebUtil_Core.WUT_PACKAGE,'WUT_FILE_INFO');
clientFileSize := DelimStr.getNumber(clientFileInfo,1,true,'|');
mesg('size: '||clientFileSize);
if clientFileSize = 0 then
raise CLIENT_FILE_EMPTY;
-- no need to close AS file since it is not yet opened.
end if;
clientFileChunks := DelimStr.getNumber(clientFileInfo,2,true,'|');
-- Set up the Open command
if toDB then
if not m_DBEnabled then
raise TRANSFER_FORBIDDEN;
end if;
if not WebUtil_DB_Local.openblob(spec1, spec2, spec3,'W', m_maxTransferSize) then
WebUtil_core.Error(WebUtil_Core.WUT_PACKAGE,WebUtil_DB_Local.getLastError,
'WEBUTIL_FILE_TRANSFER.uploadInt');
raise READWRITE_ERROR;
end if;
else
if not WebUtil_Core.checkJava then
raise NO_JAVA;
end if;
if not checkASACL(spec1,m_writeACL) then
raise TRANSFER_FORBIDDEN;
end if;
jobj := JAVA_APPSERV_WRITER.NEW;
if not JAVA_APPSERV_WRITER.openFile(jobj,spec1) then
lastErrorCode := JAVA_APPSERV_WRITER.getLastError(jobj);
lastErrorArgs := JAVA_APPSERV_WRITER.getLastErrorArgs(jobj) ;
WebUtil_core.Error(Webutil_Core.WUT_PACKAGE,lastErrorCode,
'WEBUTIL_FILE_TRANSFER.uploadInt',lastErrorArgs);
raise READWRITE_ERROR;
end if;
end if;
-- Is this Async? if So we do nothing more here just set the callback and kick it off
if asynchronous then
-- set callbackTrigger even if it is null. we will take care
-- before calling
WebUtil_Core.SetCallbackTrigger(-1,callbackTrigger);
ignore := WebUtil_Core.getProperty(WebUtil_Core.WUT_PACKAGE,'WUT_TRANSFER');
m_chunks := clientFileChunks;
m_fileSize := clientFileSize;
m_uploadSucceeded := NULL;
if not toDB then
m_persistObj := ORA_JAVA.NEW_GLOBAL_REF(jobj);
end if;
result := true;
else
if NOT toDB then
encodedFile := JAVA_FILE.createTempFile('WUAS','.enc');
tempFileName := JAVA_FILE.getPath(encodedFile);
end if;
-- loop through each chunk
for i in 1..clientFileChunks LOOP
dataBuffer := WebUtil_Core.getProperty(WebUtil_Core.WUT_PACKAGE,'WUT_TRANSFER',false);
if (WebUtil_Core.isError) or (dataBuffer is null) then
raise AGENT_BUSY;
end if;
-- Write to the correct place
if toDB then
WebUtil_DB_Local.WriteData(dataBuffer);
else
ftemp := TEXT_IO.FOPEN(tempFileName, 'W');
TEXT_IO.PUT(ftemp, dataBuffer);
TEXT_IO.FCLOSE(ftemp);
-- if not JAVA_APPSERV_WRITER.WriteData(jobj,dataBuffer) then
if not JAVA_APPSERV_WRITER.decodeBASE64File(jobj,tempFileName) then
lastErrorCode := JAVA_APPSERV_WRITER.getLastError(jobj);
lastErrorArgs := JAVA_APPSERV_WRITER.getLastErrorArgs(jobj) ;
WebUtil_core.Error(Webutil_Core.WUT_PACKAGE,lastErrorCode,
'WEBUTIL_FILE_TRANSFER.UploadInt',lastErrorArgs);
raise READWRITE_ERROR;
end if;
end if;
end LOOP;
if toDB then
if WebUtil_DB_Local.CloseBlob(clientFileSize) then
result := true;
else
WebUtil_core.Error(Webutil_Core.WUT_PACKAGE,WebUtil_DB_Local.getLastError,
'WEBUTIL_FILE_TRANSFER.UploadInt');
end if; -- close
else
bool_ignore := JAVA_FILE.DELETE_(encodedFile);
if JAVA_APPSERV_WRITER.CloseFile(jobj,clientFileSize) then
result := true;
else
lastErrorCode := JAVA_APPSERV_WRITER.getLastError(jobj);
lastErrorArgs := JAVA_APPSERV_WRITER.getLastErrorArgs(jobj) ;
WebUtil_core.Error(Webutil_Core.WUT_PACKAGE,lastErrorCode,
'WEBUTIL_FILE_TRANSFER.UploadInt',lastErrorArgs);
raise READWRITE_ERROR;
end if;
end if;
end if; -- async
return result;
EXCEPTION
when CLIENT_FILE_EMPTY then
WebUtil_Core.Error(Webutil_Core.WUT_PACKAGE,133,'WEBUTIL_FILE_TRANSFER.UploadInt', clientFile);
return false;
when CLIENT_FILE_NULL then
WebUtil_Core.Error(Webutil_Core.WUT_PACKAGE,130,'WEBUTIL_FILE_TRANSFER.UploadInt');
return false;
when AS_FILE_NULL then
WebUtil_Core.Error(Webutil_Core.WUT_PACKAGE,117,'WEBUTIL_FILE_TRANSFER.UploadInt');
return false;
when FILE_NOT_FOUND then
WebUtil_Core.Error(Webutil_Core.WUT_PACKAGE,129,'WEBUTIL_FILE_TRANSFER.UploadInt', clientFile);
return false;
when TRANSFER_FORBIDDEN then
WebUtil_Core.Error(Webutil_Core.WUT_PACKAGE,121,'WEBUTIL_FILE_TRANSFER.UploadInt');
return false;
when AGENT_BUSY then
WebUtil_Core.Error(Webutil_Core.WUT_PACKAGE,116,'WEBUTIL_FILE_TRANSFER.UploadInt');
return false;
when READWRITE_ERROR then
return false;
when NO_JAVA then
return false;
when WebUtil_Core.BEAN_NOT_REGISTERED then
WebUtil_Core.ErrorAlert(WebUtil_Core.getImplClass(WebUtil_Core.WUT_PACKAGE)
||' bean not found. WEBUTIL_FILE_TRANSFER.UploadInt will not work');
RAISE FORM_TRIGGER_FAILURE;
when WebUtil_Core.PROPERTY_ERROR then
RAISE FORM_TRIGGER_FAILURE;
END UploadInt; -
How to save data (DBL array) in a excel file
Ok, I am new into Labview. This question may seem easy for you guys, but for me, it is quite a challenge. I have current coming out of a loop. When the program stop, I would like to be able to save it as well as the time when it has been taking and the average current in a excel file. When my labview code stops, how do I do to get a pop up window which ask me where and what name to save it to? How do I get so that on the top of each column, it says : current (Amp) Time (ms) Average Current (amp)?
thank you very much,Hello,
We love to see people catch the LabVIEW spirit and anything we can do to help
you through the initial learning process is our pleasure.
As KC suggested saving the file as a .csv is a good idea,
you can also save it as a txt file and open it with Excel specifying a delimiter
for the columns.
There is a really good example you can find in the LabVIEW
example finder if you search for the keyword ‘file’, the example is called “Write
to Text File.vi”. They use a Get date/time String to record the time when data
is acquired.
I have attached a simple Write to File picture of a VI that
takes a random number and writes it to a file. When I run the VI, a popup asks
me what I want to call the file. The first part writes the heathers on the
columns and inside of the for loop I save the data. Underneath the block diagram
is a picture of the output file when I specify the number of samples to be five.
If you want your file to be on a very specific format, you
can create a template file, read it in LabVIEW, and then add your data to it
and save it to a new file.
Hope this can get you started with your program.
There are a lot of good tutorials online on how to
get started using LabVIEW. Here is the link to a three hour
introduction course:
http://zone.ni.com/devzone/learningcenter.nsf/03f7c60f17aad210862567a90054a26c/60c2782788a811c986256cd50001a0a6?OpenDocument&node=200067_us
We are also comming out with LabVIEW 8 in November and we have a program called LabVIEW Standard Service Program
(SSP) that allows you to get automatic upgrades and updates. Please let
me know if you are interested in knowing more about it.
Good luck,
Tica Taveras
Applications Engineer
National Instruments
Attachments:
SaveData.bmp 1475 KB -
How to save multi dimensional array to spreadsheet in labview
In a attached file i m trying to save two different 2d array string to a same spreadsheet file as column1 and column2, i thought of using indexing concept but, it is not working with 2d arrays. so could you please correct my program
Solved!
Go to Solution.
Attachments:
Impedance.vi 64 KBYour biggest mistake is wiring a False to the Append To File input. This would oviously delete all old data. Using two Write to Spreadsheet functions is silly and instead of connecting the data from the table, just take the numerics you get and pass them to the write function as a 1D array.
Message Edited by Dennis Knutson on 10-01-2009 01:27 PM
Attachments:
Write to Spreadsheet.PNG 15 KB
Maybe you are looking for
-
Apple Mobile Device Service fails to start
The last update failed on my window 7 pc, resulting in me having to try it manually download and install, this also failed eventually it told me to delete and reinstall, this fails due to the apple mobile device service failing to start, and asking m
-
Issues in creating sales order
I have created a new "sales document type" and assigned to particular sales area, but when I am creating an order user that "sales document type ", In the initial screen I have select "ZDIS" as sales order 1000/10/10 as sales area after entering this
-
KKA2 values into internal table
Hi, I would like to create a report which accepts multiple WBS elements and display with all records which comes at KKA2. KKA2 accept sinlge record, but whatever the values displaying at KKA2, i want in my Z report. Please let me know how can I fetch
-
How do I stop adobe updates downloading as Simulink files in Matlab in order to update the program?
-
Setting bind variables in dependant LoV's : How?
Hi I'm trying to create an LoV dependant upon the value selected in a previous Lov. I have created an LoV with a bind variable which executes correctly when run independantly of a form When I attach the loV to a form I get prompted to :- "Set the bin