Writing BLOBs form Orcle to a file server
We are trying to use PL/SQL code to write Word Documents stored as blobs in Oracle to a users Temp directory or a server directory. Te blos have been added from a legacy PowerBuilder applicaiton that we're trying to migrate to Oracle's Web Appliation Server.
Any help on this would be appreciated.
Please repost in the Acrobat Scripting forum.
Similar Messages
-
Tectra A10 - writing to file server ends with BSOD
Hi
I have a brand new Tectra A10 that I have used the recovery disk to restore the machine to XP Pro - I have done this process many times before.
I have addred the machine to our Domain but whenever I try to write to our file server (Windows Server 2008) I get the blue screen.
Writing to an old 32 bit Server is fine.
I have made sure that the NIC Card driver is upto date.
Any Ideas
Thanks
LewHi buddy,
I personally believe, that everything is ok with your notebook and its related to server or network this BSOD.
I mean you can write to a 32bit server properly and I believe other network connections work fine so its a problem of the new server.
As Barrie wrote, if you use the notebook in your company ask the local network administrator. Maybe its a known issue. -
HI,
I have a table with following structure
Test_Mail(Attachment BLOB,Attachmentname varchar2(255),FileSize number)
The data in the table is like
Attachment|Attachmentname|FileSize
BLOB|test.txt|1236
I wants to read the data from the BLOB attachment in to new file.
The data in the file is
Ename|JOB|DEPTNO|SALARY
ford|salesman|10|5555
boye|salesman|10|3333
smith|clerk|20|3000
Iam using the following procedure to do the same
create or replace
procedure SAVE_TO_FILE as
vblob blob;
i2 number;
amt number := 10000;
len number;
my_vr raw(10000);
l_output utl_file.file_type;
p_dir varchar2(30) default '/home/test';
p_file varchar2(30) := 'output.txt';
begin
l_output := utl_file.fopen(p_dir, p_file,'w',32767);
for l_cur in (SELECT ATTACHMENT vblob FROM test_email)
loop
len :=DBMS_LOB.GETLENGTH(l_cur.vblob);
vblob := l_cur.vblob ;
dbms_output.put_line('Length of the Column : ' || to_char(len));
i2 := 1;
if len < 10000 then
DBMS_LOB.READ(vblob,len,i2,my_vr);
utl_file.put(l_output,UTL_RAW.CAST_TO_VARCHAR2(my_vr) );
else
DBMS_LOB.READ(vblob,amt,i2,my_vr);
utl_file.put(l_output, UTL_RAW.CAST_TO_VARCHAR2(my_vr) );
end if;
i2 := i2 + amt;
while (i2 < len)
loop
dbms_output.put_line('i2 : ' || to_char(i2));
DBMS_LOB.READ(vblob,amt,i2,my_vr);
utl_file.put(l_output, UTL_RAW.CAST_TO_VARCHAR2(my_vr));
utl_file.fflush(l_output);
i2 := i2 + amt ;
end loop;
utl_file.fclose(l_output);
end loop;
commit;
end SAVE_TO_FILE;
The problem here is it is reading only 19 bytes and output is
Ename|JOB|DEPTNO|SALAR
can any one please help me in sloving this isssue??
Thanks in advance
Balaji tkDuplicate post.
Re: Reading the data from BLOB column -
Hello Everyone,
My program not working when sceduled to run in background, but works fine when run in foreground. Think i need to change some funcution modules as the ones i used are, think, referencing for foreground processing. Can anyone point to some function modules which does the job for me.
I am picking up the files from file server.
REPORT zco11n
NO STANDARD PAGE HEADING
LINE-SIZE 255.
INCLUDE zdeclerations. " Data Declarations part
*---------------Get actual filepath from logical filepath---------------------*
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
* CLIENT = SY-MANDT
logical_filename = 'ZBARCODE_APPLICATION' "logical path
IMPORTING
file_name = pa_file "actual path
EXCEPTIONS
file_not_found = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*---------------Get all the required files from the directory-------------------*
CALL FUNCTION 'TMP_GUI_DIRECTORY_LIST_FILES'
EXPORTING
directory = pa_file "Directory path
filter = '*.CSV'
TABLES
file_table = lt_file "Files in the direcory
dir_table = lt_dir
EXCEPTIONS
cntl_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*-------Get the directory and file name as single path & move to internal table----*
LOOP AT lt_file INTO lw_file.
CONCATENATE pa_file lw_file-pathname INTO lstring.
MOVE lstring TO lw_filename-pathname.
MOVE lw_file-pathname TO lw_filename-filename.
APPEND lw_filename TO lt_filename.
CLEAR lw_filename.
CLEAR lw_file.
ENDLOOP.
START-OF-SELECTION.
LOOP AT lt_filename INTO lw_filename.
file_name = lw_filename-pathname.
*-------Read the contents of the file to an internal table--------------------------*
CALL FUNCTION 'DX_FILE_READ'
EXPORTING
filename = file_name
pc = 'X'
TABLES
data_tab = lt_temp "File contents
EXCEPTIONS
no_file_on_server = 1
no_data_on_server = 2
gui_upload_failed = 3
no_authority = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
*-------------Split and move the contents as required for BDC---------------*
LOOP AT lt_temp INTO lw_temp.
SPLIT lw_temp AT ',' INTO lw_afrud-aufnr lw_afrud-lmnga lw_afrud-budat.
APPEND lw_afrud TO lt_afrud.
ENDLOOP.
************----------Start Of BDC-----------------------***************
LOOP AT lt_afrud INTO lw_afrud.
PERFORM bdc_dynpro USING 'SAPLCORU_S' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'AFRUD-AUFNR'
lw_afrud-aufnr.
PERFORM bdc_field USING 'AFRUD-LMNGA'
'1'.
PERFORM bdc_field USING 'AFRUD-ISDZ'
'00:00:00'.
PERFORM bdc_field USING 'AFRUD-IEDZ'
'00:00:00'.
PERFORM bdc_field USING 'AFRUD-PEDZ'
'00:00:00'.
PERFORM bdc_field USING 'BDC_CURSOR'
'AFRUD-BUDAT'.
PERFORM bdc_field USING 'AFRUD-BUDAT'
lw_afrud-budat.
PERFORM bdc_dynpro USING 'SAPLCORU_S' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BU'.
CALL TRANSACTION 'CO11N' USING lt_bdcdata MODE 'N'
UPDATE 'S' MESSAGES INTO lt_bdcmsgcoll. "#EC CI_CALLTA
ENDLOOP.
*******-----------End of BDC-------------------------------------*******
CLEAR lw_afrud.
REFRESH lt_afrud.
************************File Manipulations*********************
lv_file_name = lw_filename-filename. "Assign the filename to a local variable
CONCATENATE '\CAUVERYSAPBARCODESUCCESS'
lv_file_name INTO lstring_success. "Place holder for BDC Success Files
CONCATENATE '\CAUVERYSAPBARCODEERROR'
lv_file_name INTO lstring_error. "Place holder for BDC Error Files
file_name_source = file_name. "Source file path
file_name_success_dest = lstring_success. "Success file path
file_name_error_dest = lstring_error. "Error file path
*For the files with no data in them, move them to desired(error) folder.
if lt_bdcmsgcoll[] is initial.
CALL METHOD cl_gui_frontend_services=>file_copy
EXPORTING
SOURCE = file_name_source
destination = file_name_error_dest.
endif.
LOOP AT lt_bdcmsgcoll INTO lw_bdcmsgcoll.
IF lw_bdcmsgcoll-msgtyp EQ 'S' AND
lw_bdcmsgcoll-msgnr EQ '110'.
*----------Move the succes files to designated folder---------------*.
CALL METHOD cl_gui_frontend_services=>file_copy
EXPORTING
SOURCE = file_name_source
DESTINATION = file_name_success_dest
overwrite = 'X'
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
wrong_parameter = 3
disk_full = 4
access_denied = 5
file_not_found = 6
destination_exists = 7
unknown_error = 8
path_not_found = 9
disk_write_protect = 10
drive_not_ready = 11
not_supported_by_gui = 12
OTHERS = 13.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ELSE.
*--------Move the error files to designated folder-----------------*.
IF lw_bdcmsgcoll-msgtyp EQ 'E' OR
lt_bdcmsgcoll[] IS INITIAL.
CALL METHOD cl_gui_frontend_services=>file_copy
EXPORTING
SOURCE = file_name_source
DESTINATION = file_name_error_dest
overwrite = 'X'
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
wrong_parameter = 3
disk_full = 4
access_denied = 5
file_not_found = 6
destination_exists = 7
unknown_error = 8
path_not_found = 9
disk_write_protect = 10
drive_not_ready = 11
not_supported_by_gui = 12
OTHERS = 13.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
*----------------Delete file from the directory---------------------------*
CALL METHOD cl_gui_frontend_services=>file_delete
EXPORTING
filename = file_name_source
CHANGING
rc = lv_rc
EXCEPTIONS
file_delete_failed = 1
cntl_error = 2
error_no_gui = 3
file_not_found = 4
access_denied = 5
unknown_error = 6
not_supported_by_gui = 7
wrong_parameter = 8
OTHERS = 9.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
REFRESH lt_bdcmsgcoll.
REFRESH lt_bdcdata.
ENDLOOP.
*& Form bdc_dynpro
* text
* -->PROGRAM text
* -->DYNPRO text
FORM bdc_dynpro USING program dynpro. "#EC *
CLEAR lw_bdcdata.
lw_bdcdata-program = program.
lw_bdcdata-dynpro = dynpro.
lw_bdcdata-dynbegin = 'X'.
APPEND lw_bdcdata TO lt_bdcdata.
ENDFORM. "BDC_DYNPRO
*& Form bdc_field
* text
* -->FNAM text
* -->FVAL text
FORM bdc_field USING fnam fval. "#EC *
IF fval <> space.
CLEAR lw_bdcdata.
lw_bdcdata-fnam = fnam.
lw_bdcdata-fval = fval.
APPEND lw_bdcdata TO lt_bdcdata.
ENDIF.
ENDFORM. "bdc_field
*& Include ZDECLERATIONS
*-----------------------------Types decleration--------------------------*
TYPES: BEGIN OF tw_afrud,
aufnr TYPE aufnr,
lmnga(13) TYPE c,
budat TYPE buchdatum,
END OF tw_afrud,
tt_afrud TYPE STANDARD TABLE OF tw_afrud.
TYPES: BEGIN OF tw_temp,
rec(7000) TYPE c,
END OF tw_temp,
tt_temp TYPE STANDARD TABLE OF tw_temp.
TYPES: BEGIN OF tw_errorlog,
aufnr TYPE aufnr,
message TYPE string,
END OF tw_errorlog,
tt_errorlog TYPE STANDARD TABLE OF tw_errorlog.
TYPES: BEGIN OF tw_file,
pathname TYPE sdok_filnm,
END OF tw_file,
tt_file TYPE STANDARD TABLE OF tw_file.
TYPES: BEGIN OF tw_dir,
pathname1 TYPE sdok_filnm,
END OF tw_dir,
tt_dir TYPE STANDARD TABLE OF tw_dir.
TYPES: BEGIN OF tw_filename,
filename TYPE rlgrap-filename,
pathname TYPE localfile,
END OF tw_filename,
tt_filename TYPE STANDARD TABLE OF tw_filename.
*-------------Variable decleration---------------------------------------*
DATA: pa_file TYPE rlgrap-filename.
DATA: lstring TYPE string,
lstring_success TYPE string,
lstring_error TYPE string,
file_name TYPE dxfile-filename,
lv_rc TYPE i,
file_name_source TYPE string,
file_name_error_dest TYPE string,
file_name_success_dest TYPE string,
lv_file_name TYPE rlgrap-filename.
*---------------Internal tables & Work area's ------------------------------*
DATA : lw_afrud TYPE tw_afrud,
lt_afrud TYPE tt_afrud,
lw_temp TYPE tw_temp,
lt_temp TYPE tt_temp,
lw_file TYPE tw_file,
lt_file TYPE tt_file,
lw_dir TYPE tw_dir, "#EC *
lt_dir TYPE tt_dir,
lw_filename TYPE tw_filename,
lt_filename TYPE tt_filename,
lw_bdcdata TYPE bdcdata,
lt_bdcdata TYPE STANDARD TABLE OF bdcdata,
lw_bdcmsgcoll TYPE bdcmsgcoll,
lt_bdcmsgcoll TYPE STANDARD TABLE OF bdcmsgcoll.
RegardsThe methods of the class
cl_gui_frontend_services
cannot be used in background since they refer to the presentation server. You have to upload the files to the application server to run the program in the background. You can use transaction CG3Z or the function module
ARCHIVFILE_CLIENT_TO_SERVER
to upload the files.
Manoj -
Create a new web application, how shall I update the file server.xml
Hi,
I will create a new web application, i.e named newApp. Then I create a file structure as follows:
- <server-root>/newApp
- <server-root>/newApp/WEB-INF
- <server-root>/newApp/WEB-INF/classes
Then I must tell the server that I have created a new web application. Then I must update my file server.xml, How shall I do this and where in the file shall I type in the new information?
I use windows XP Pro, and Tomcat 4.1.27.
My server.xml file looks like below:
<!-- Example Server Configuration File -->
<!-- Note that component elements are nested corresponding to their
parent-child relationships with each other -->
<!-- A "Server" is a singleton element that represents the entire JVM,
which may contain one or more "Service" instances. The Server
listens for a shutdown command on the indicated port.
Note: A "Server" is not itself a "Container", so you may not
define subcomponents such as "Valves" or "Loggers" at this level.
-->
<Server port="8005" shutdown="SHUTDOWN" debug="0">
<!-- Comment these entries out to disable JMX MBeans support -->
<!-- You may also configure custom components (e.g. Valves/Realms) by
including your own mbean-descriptor file(s), and setting the
"descriptors" attribute to point to a ';' seperated list of paths
(in the ClassLoader sense) of files to add to the default list.
e.g. descriptors="/com/myfirm/mypackage/mbean-descriptor.xml"
-->
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
debug="0"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
debug="0"/>
<!-- Global JNDI resources -->
<GlobalNamingResources>
<!-- Test entry for demonstration purposes -->
<Environment name="simpleValue" type="java.lang.Integer" value="30"/>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users -->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved">
</Resource>
<ResourceParams name="UserDatabase">
<parameter>
<name>factory</name>
<value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
</parameter>
<parameter>
<name>pathname</name>
<value>conf/tomcat-users.xml</value>
</parameter>
</ResourceParams>
</GlobalNamingResources>
<!-- A "Service" is a collection of one or more "Connectors" that share
a single "Container" (and therefore the web applications visible
within that Container). Normally, that Container is an "Engine",
but this is not required.
Note: A "Service" is not itself a "Container", so you may not
define subcomponents such as "Valves" or "Loggers" at this level.
-->
<!-- Define the Tomcat Stand-Alone Service -->
<Service name="Tomcat-Standalone">
<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Each Connector passes requests on to the
associated "Container" (normally an Engine) for processing.
By default, a non-SSL HTTP/1.1 Connector is established on port 8080.
You can also enable an SSL HTTP/1.1 Connector on port 8443 by
following the instructions below and uncommenting the second Connector
entry. SSL support requires the following steps (see the SSL Config
HOWTO in the Tomcat 4.0 documentation bundle for more detailed
instructions):
* Download and install JSSE 1.0.2 or later, and put the JAR files
into "$JAVA_HOME/jre/lib/ext".
* Execute:
%JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows)
$JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA (Unix)
with a password value of "changeit" for both the certificate and
the keystore itself.
By default, DNS lookups are enabled when a web application calls
request.getRemoteHost(). This can have an adverse impact on
performance, so you can disable it by setting the
"enableLookups" attribute to "false". When DNS lookups are disabled,
request.getRemoteHost() will return the String version of the
IP address of the remote client.
-->
<!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 -->
<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
port="8080" minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="8443"
acceptCount="100" debug="0" connectionTimeout="20000"
useURIValidationHack="false" disableUploadTimeout="true" />
<!-- Note : To disable connection timeouts, set connectionTimeout value
to -1 -->
<!-- Define a SSL Coyote HTTP/1.1 Connector on port 8443 -->
<!--
<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
port="8443" minProcessors="5" maxProcessors="75"
enableLookups="true"
acceptCount="100" debug="0" scheme="https" secure="true"
useURIValidationHack="false" disableUploadTimeout="true">
<Factory className="org.apache.coyote.tomcat4.CoyoteServerSocketFactory"
clientAuth="false" protocol="TLS" />
</Connector>
-->
<!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
port="8009" minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="8443"
acceptCount="10" debug="0" connectionTimeout="0"
useURIValidationHack="false"
protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>
<!-- Define an AJP 1.3 Connector on port 8009 -->
<!--
<Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
port="8009" minProcessors="5" maxProcessors="75"
acceptCount="10" debug="0"/>
-->
<!-- Define a Proxied HTTP/1.1 Connector on port 8082 -->
<!-- See proxy documentation for more information about using this. -->
<!--
<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
port="8082" minProcessors="5" maxProcessors="75"
enableLookups="true"
acceptCount="100" debug="0" connectionTimeout="20000"
proxyPort="80" useURIValidationHack="false"
disableUploadTimeout="true" />
-->
<!-- Define a non-SSL legacy HTTP/1.1 Test Connector on port 8083 -->
<!--
<Connector className="org.apache.catalina.connector.http.HttpConnector"
port="8083" minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="8443"
acceptCount="10" debug="0" />
-->
<!-- Define a non-SSL HTTP/1.0 Test Connector on port 8084 -->
<!--
<Connector className="org.apache.catalina.connector.http10.HttpConnector"
port="8084" minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="8443"
acceptCount="10" debug="0" />
-->
<!-- An Engine represents the entry point (within Catalina) that processes
every request. The Engine implementation for Tomcat stand alone
analyzes the HTTP headers included with the request, and passes them
on to the appropriate Host (virtual host). -->
<!-- You should set jvmRoute to support load-balancing via JK/JK2 ie :
<Engine name="Standalone" defaultHost="localhost" debug="0" jmvRoute="jvm1">
-->
<!-- Define the top level container in our container hierarchy -->
<Engine name="Standalone" defaultHost="localhost" debug="0">
<!-- The request dumper valve dumps useful debugging information about
the request headers and cookies that were received, and the response
headers and cookies that were sent, for all requests received by
this instance of Tomcat. If you care only about requests to a
particular virtual host, or a particular application, nest this
element inside the corresponding <Host> or <Context> entry instead.
For a similar mechanism that is portable to all Servlet 2.3
containers, check out the "RequestDumperFilter" Filter in the
example application (the source for this filter may be found in
"$CATALINA_HOME/webapps/examples/WEB-INF/classes/filters").
Request dumping is disabled by default. Uncomment the following
element to enable it. -->
<!--
<Valve className="org.apache.catalina.valves.RequestDumperValve"/>
-->
<!-- Global logger unless overridden at lower levels -->
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="catalina_log." suffix=".txt"
timestamp="true"/>
<!-- Because this Realm is here, an instance will be shared globally -->
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
debug="0" resourceName="UserDatabase"/>
<!-- Comment out the old realm but leave here for now in case we
need to go back quickly -->
<!--
<Realm className="org.apache.catalina.realm.MemoryRealm" />
-->
<!-- Replace the above Realm with one of the following to get a Realm
stored in a database and accessed via JDBC -->
<!--
<Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
driverName="org.gjt.mm.mysql.Driver"
connectionURL="jdbc:mysql://localhost/authority"
connectionName="test" connectionPassword="test"
userTable="users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name" />
-->
<!--
<Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
driverName="oracle.jdbc.driver.OracleDriver"
connectionURL="jdbc:oracle:thin:@ntserver:1521:ORCL"
connectionName="scott" connectionPassword="tiger"
userTable="users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name" />
-->
<!--
<Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
driverName="sun.jdbc.odbc.JdbcOdbcDriver"
connectionURL="jdbc:odbc:CATALINA"
userTable="users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name" />
-->
<!-- Define the default virtual host -->
<Host name="localhost" debug="0" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<!-- Normally, users must authenticate themselves to each web app
individually. Uncomment the following entry if you would like
a user to be authenticated the first time they encounter a
resource protected by a security constraint, and then have that
user identity maintained across all web applications contained
in this virtual host. -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn"
debug="0"/>
-->
<!-- Access log processes all requests for this virtual host. By
default, log files are created in the "logs" directory relative to
$CATALINA_HOME. If you wish, you can specify a different
directory with the "directory" attribute. Specify either a relative
(to $CATALINA_HOME) or absolute path to the desired directory.
-->
<!--
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="localhost_access_log." suffix=".txt"
pattern="common" resolveHosts="false"/>
-->
<!-- Logger shared by all Contexts related to this virtual host. By
default (when using FileLogger), log files are created in the "logs"
directory relative to $CATALINA_HOME. If you wish, you can specify
a different directory with the "directory" attribute. Specify either a
relative (to $CATALINA_HOME) or absolute path to the desired
directory.-->
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="localhost_log." suffix=".txt"
timestamp="true"/>
<!-- Define properties for each web application. This is only needed
if you want to set non-default properties, or have web application
document roots in places other than the virtual host's appBase
directory. -->
<DefaultContext reloadable="true"/>
<!-- Tomcat Root Context -->
<Context path="" docBase="ROOT" debug="0"/>
<!-- Tomcat Examples Context -->
<Context path="/examples" docBase="examples" debug="0"
reloadable="true" crossContext="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="localhost_examples_log." suffix=".txt"
timestamp="true"/>
<Ejb name="ejb/EmplRecord" type="Entity"
home="com.wombat.empl.EmployeeRecordHome"
remote="com.wombat.empl.EmployeeRecord"/>
<!-- If you wanted the examples app to be able to edit the
user database, you would uncomment the following entry.
Of course, you would want to enable security on the
application as well, so this is not done by default!
The database object could be accessed like this:
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
UserDatabase database =
(UserDatabase) envCtx.lookup("userDatabase");
-->
<!--
<ResourceLink name="userDatabase" global="UserDatabase"
type="org.apache.catalina.UserDatabase"/>
-->
<!-- PersistentManager: Uncomment the section below to test Persistent
Sessions.
saveOnRestart: If true, all active sessions will be saved
to the Store when Catalina is shutdown, regardless of
other settings. All Sessions found in the Store will be
loaded on startup. Sessions past their expiration are
ignored in both cases.
maxActiveSessions: If 0 or greater, having too many active
sessions will result in some being swapped out. minIdleSwap
limits this. -1 or 0 means unlimited sessions are allowed.
If it is not possible to swap sessions new sessions will
be rejected.
This avoids thrashing when the site is highly active.
minIdleSwap: Sessions must be idle for at least this long
(in seconds) before they will be swapped out due to
activity.
0 means sessions will almost always be swapped out after
use - this will be noticeably slow for your users.
maxIdleSwap: Sessions will be swapped out if idle for this
long (in seconds). If minIdleSwap is higher, then it will
override this. This isn't exact: it is checked periodically.
-1 means sessions won't be swapped out for this reason,
although they may be swapped out for maxActiveSessions.
If set to >= 0, guarantees that all sessions found in the
Store will be loaded on startup.
maxIdleBackup: Sessions will be backed up (saved to the Store,
but left in active memory) if idle for this long (in seconds),
and all sessions found in the Store will be loaded on startup.
If set to -1 sessions will not be backed up, 0 means they
should be backed up shortly after being used.
To clear sessions from the Store, set maxActiveSessions, maxIdleSwap,
and minIdleBackup all to -1, saveOnRestart to false, then restart
Catalina.
-->
<!--
<Manager className="org.apache.catalina.session.PersistentManager"
debug="0"
saveOnRestart="true"
maxActiveSessions="-1"
minIdleSwap="-1"
maxIdleSwap="-1"
maxIdleBackup="-1">
<Store className="org.apache.catalina.session.FileStore"/>
</Manager>
-->
<Environment name="maxExemptions" type="java.lang.Integer"
value="15"/>
<Parameter name="context.param.name" value="context.param.value"
override="false"/>
<Resource name="jdbc/EmployeeAppDb" auth="SERVLET"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/EmployeeAppDb">
<parameter><name>username</name><value>sa</value></parameter>
<parameter><name>password</name><value></value></parameter>
<parameter><name>driverClassName</name>
<value>org.hsql.jdbcDriver</value></parameter>
<parameter><name>url</name>
<value>jdbc:HypersonicSQL:database</value></parameter>
</ResourceParams>
<Resource name="mail/Session" auth="Container"
type="javax.mail.Session"/>
<ResourceParams name="mail/Session">
<parameter>
<name>mail.smtp.host</name>
<value>localhost</value>
</parameter>
</ResourceParams>
<ResourceLink name="linkToGlobalResource"
global="simpleValue"
type="java.lang.Integer"/>
</Context>
</Host>
</Engine>
</Service>
</Server>To use servlets u have indeed to update your web.xml...Well I'm not sure this is relevant to your case anyway.
You have to add a <servlet> element to this file.
Something like this:
<servlet>
<servlet-name>blabla</servlet-name>
<servlet-class>blablapackage.Blablaclass</servlet-class>
<init-param>...</init-param>
</servlet>
Now this may not solve your problem. Make sure you refer to your servlets using their full qualified names.btw, just to be sure, what is your definition of "servlet"? (i mean: any java class or only javax.servlet.Servlet) -
Problem with ArrayLists and writing and reading from a .dat file (I think)
I'm brand new to this forum, but I'm sure hoping someone can help me with a problem I'm having with ArrayLists. This program was originally created with an array of objects that were displayed on a GUI with jtextFields, then cycling thru them via jButtons: First, Next, Previous, Last. Now I need to add the ability to modify, delete and add records. Both iterations of this program needed to write to and read from a .dat file.
It worked just like it was suppose to when I used just the array, but now I need to use a "dynamic array" that will grow or shrink as needed: i.e. an ArrayList.
When I aded the ArrayList I had the ArrayList use toArray() to fill my original array so I could continue to use all the methods I'd created for using with my array. Now I'm getting a nullPointerException every time I try to run my program, which means somewhere I'm NOT filling my array ???? But, I'm writing just fine to my .dat file, which is confusing me to no end!
It's a long program, and I apologize for the length, but here it is. There are also 2 class files, a parent and 1 child below Inventory6. This was written in NetBeans IDE 5.5.1.
Thank you in advance for any help anyone can give me!
LabyBC
package my.Inventory6;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.DecimalFormat;
import javax.swing.JOptionPane;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import java.io.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.lang.IllegalStateException;
import java.util.NoSuchElementException;
import java.util.ArrayList;
import java.text.NumberFormat;
// Class Inventory6
public class Inventory6 extends javax.swing.JFrame {
private static InventoryPlusColor[] inventory;
private static ArrayList inList;
// create a tool that insure the specified format for a double number, when displayed
private DecimalFormat doubleFormat = new DecimalFormat( "0.00" );
private DecimalFormat singleFormat = new DecimalFormat( "0");
// the index within the array of products of the current displayed product
private int currentProductIndex;
/** Creates new form Inventory6 */
public Inventory6() {
initComponents();
currentProductIndex = 0;
} // end Inventory6()
private static InventoryPlusColor[] getInventory() {
ArrayList<InventoryPlusColor> inList = new ArrayList<InventoryPlusColor>();
inList.add(new InventoryPlusColor(1, "Couch", 3, 1250.00, "Blue"));
inList.add(new InventoryPlusColor(2, "Recliner", 10, 525.00, "Green"));
inList.add(new InventoryPlusColor(3, "Chair", 6, 125.00, "Mahogany"));
inList.add(new InventoryPlusColor(4, "Pedestal Table", 2, 4598.00, "Oak"));
inList.add(new InventoryPlusColor(5, "Sleeper Sofa", 4, 850.00, "Yellow"));
inList.add(new InventoryPlusColor(6, "Rocking Chair", 2, 459.00, "Tweed"));
inList.add(new InventoryPlusColor(7, "Couch", 4, 990.00, "Red"));
inList.add(new InventoryPlusColor(8, "Chair", 12, 54.00, "Pine"));
inList.add(new InventoryPlusColor(9, "Ottoman", 3, 110.00, "Black"));
inList.add(new InventoryPlusColor(10, "Chest of Drawers", 5, 598.00, "White"));
for (int j = 0; j < inList.size(); j++)
System.out.println(inList);
InventoryPlusColor[] inventory = (InventoryPlusColor[]) inList.toArray
(new InventoryPlusColor[inList.size()]);
return inventory;
} // end getInventory() method
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
IDNumberLbl = new javax.swing.JLabel();
IDNumberField = new javax.swing.JTextField();
prodNameLbl = new javax.swing.JLabel();
prodNameField = new javax.swing.JTextField();
colorLbl = new javax.swing.JLabel();
colorField = new javax.swing.JTextField();
unitsInStockLbl = new javax.swing.JLabel();
unitsInStockField = new javax.swing.JTextField();
unitPriceLbl = new javax.swing.JLabel();
unitPriceField = new javax.swing.JTextField();
invenValueLbl = new javax.swing.JLabel();
invenValueField = new javax.swing.JTextField();
restockingFeeLbl = new javax.swing.JLabel();
restockingFeeField = new javax.swing.JTextField();
jbtFirst = new javax.swing.JButton();
jbtNext = new javax.swing.JButton();
jbtPrevious = new javax.swing.JButton();
jbtLast = new javax.swing.JButton();
jbtAdd = new javax.swing.JButton();
jbtDelete = new javax.swing.JButton();
jbtModify = new javax.swing.JButton();
jbtSave = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
searchIDNumLbl = new javax.swing.JLabel();
searchIDNumbField = new javax.swing.JTextField();
jbtSearch = new javax.swing.JButton();
searchResults = new javax.swing.JLabel();
jbtExit = new javax.swing.JButton();
jbtExitwoSave = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Inventory Program"));
IDNumberLbl.setText("ID Number");
IDNumberField.setEditable(false);
prodNameLbl.setText("Product Name");
prodNameField.setEditable(false);
colorLbl.setText("Product Color");
colorField.setEditable(false);
colorField.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
colorFieldActionPerformed(evt);
unitsInStockLbl.setText("Units In Stock");
unitsInStockField.setEditable(false);
unitPriceLbl.setText("Unit Price $");
unitPriceField.setEditable(false);
invenValueLbl.setText("Inventory Value $");
invenValueField.setEditable(false);
restockingFeeLbl.setText("5% Restocking Fee $");
restockingFeeField.setEditable(false);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(unitPriceLbl)
.addComponent(unitsInStockLbl)
.addComponent(colorLbl)
.addComponent(prodNameLbl)
.addComponent(IDNumberLbl)
.addComponent(restockingFeeLbl)
.addComponent(invenValueLbl))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(IDNumberField, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 176, Short.MAX_VALUE)
.addComponent(prodNameField, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 176, Short.MAX_VALUE)
.addComponent(colorField, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 176, Short.MAX_VALUE)
.addComponent(unitsInStockField, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 176, Short.MAX_VALUE)
.addComponent(unitPriceField, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 176, Short.MAX_VALUE)
.addComponent(restockingFeeField, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 176, Short.MAX_VALUE)
.addComponent(invenValueField, javax.swing.GroupLayout.DEFAULT_SIZE, 176, Short.MAX_VALUE))
.addContainerGap())
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(IDNumberLbl)
.addComponent(IDNumberField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(prodNameLbl)
.addComponent(prodNameField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(colorField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(colorLbl))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(unitsInStockField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(unitsInStockLbl))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(unitPriceField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(unitPriceLbl))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(restockingFeeField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(restockingFeeLbl))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 10, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(invenValueField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(invenValueLbl))
.addContainerGap())
jbtFirst.setText("First");
jbtFirst.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtFirstActionPerformed(evt);
jbtNext.setText("Next");
jbtNext.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtNextActionPerformed(evt);
jbtPrevious.setText("Previous");
jbtPrevious.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtPreviousActionPerformed(evt);
jbtLast.setText("Last");
jbtLast.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtLastActionPerformed(evt);
jbtAdd.setText("Add");
jbtAdd.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtAddActionPerformed(evt);
jbtDelete.setText("Delete");
jbtModify.setText("Modify");
jbtModify.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtModifyActionPerformed(evt);
jbtSave.setText("Save");
jbtSave.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtSaveActionPerformed(evt);
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Search by:"));
searchIDNumLbl.setText("Item Number:");
jbtSearch.setText("Search");
searchResults.setFont(new java.awt.Font("Tahoma", 1, 12));
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(searchIDNumLbl)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(259, 259, 259)
.addComponent(searchResults, javax.swing.GroupLayout.PREFERRED_SIZE, 213, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jbtSearch, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(searchIDNumbField, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(searchIDNumLbl)
.addComponent(searchIDNumbField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(32, 32, 32)
.addComponent(searchResults, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jbtSearch)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
jbtExit.setText("Save and Exit");
jbtExit.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtExitActionPerformed(evt);
jbtExitwoSave.setText("Exit");
jbtExitwoSave.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtExitwoSaveActionPerformed(evt);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 248, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 44, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jbtExitwoSave, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jbtExit)))
.addGroup(layout.createSequentialGroup()
.addComponent(jbtFirst)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jbtNext)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jbtPrevious)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jbtLast))
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(12, 12, 12)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jbtAdd)
.addComponent(jbtDelete)
.addComponent(jbtModify)
.addComponent(jbtSave))))
.addContainerGap())
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jbtFirst, jbtLast, jbtNext, jbtPrevious});
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jbtAdd, jbtDelete, jbtModify, jbtSave});
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(21, 21, 21)
.addComponent(jbtAdd)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jbtDelete)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jbtModify)
.addGap(39, 39, 39)
.addComponent(jbtSave))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jbtFirst)
.addComponent(jbtNext)
.addComponent(jbtPrevious)
.addComponent(jbtLast))
.addGap(15, 15, 15)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addComponent(jbtExit)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jbtExitwoSave)))
.addContainerGap())
pack();
}// </editor-fold>
private void jbtExitwoSaveActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
private void jbtSaveActionPerformed(java.awt.event.ActionEvent evt) {
String prodNameMod, colorMod;
double unitsInStockMod, unitPriceMod;
int idNumMod;
idNumMod = Integer.parseInt(IDNumberField.getText());
prodNameMod = prodNameField.getText();
unitsInStockMod = Double.parseDouble(unitsInStockField.getText());
unitPriceMod = Double.parseDouble(unitPriceField.getText());
colorMod = colorField.getText();
if(currentProductIndex == inventory.length) {
inList.add(new InventoryPlusColor(idNumMod, prodNameMod,
unitsInStockMod, unitPriceMod, colorMod));
InventoryPlusColor[] inventory = (InventoryPlusColor[]) inList.toArray
(new InventoryPlusColor[inList.size()]);
} else {
inventory[currentProductIndex].setIDNumber(idNumMod);
inventory[currentProductIndex].setProdName(prodNameMod);
inventory[currentProductIndex].setUnitsInStock(unitsInStockMod);
inventory[currentProductIndex].setUnitPrice(unitPriceMod);
inventory[currentProductIndex].setColor(colorMod);
displayProduct(inventory[currentProductIndex]);
private static void writeInventory(InventoryPlusColor i,
DataOutputStream out) {
try {
out.writeInt(i.getIDNumber());
out.writeUTF(i.getProdName());
out.writeDouble(i.getUnitsInStock());
out.writeDouble(i.getUnitPrice());
out.writeUTF(i.getColor());
} catch (IOException e) {
JOptionPane.showMessageDialog(null, "I/O Exception writing data",
"", JOptionPane.ERROR_MESSAGE);
System.exit(0);
} //end writeInventory()
private static DataOutputStream openOutputStream(String name) {
DataOutputStream out = null;
try {
File file = new File(name);
out =
new DataOutputStream(
new BufferedOutputStream(
new FileOutputStream(file)));
} catch (IOException e) {
JOptionPane.showMessageDialog(null, "I/O Error", "", JOptionPane.ERROR_MESSAGE);
System.exit(0);
return out;
} // end openOutputStream()
private static void closeFile(DataOutputStream out) {
try {
out.close();
} catch (IOException e) {
JOptionPane.showMessageDialog(null, "I/O Exception closing file",
"", JOptionPane.ERROR_MESSAGE);
System.exit(0);
} // end closeFile()
private static DataInputStream getStream(String name) {
DataInputStream in = null;
try {
File file = new File(name);
in = new DataInputStream(
new BufferedInputStream(
new FileInputStream(file)));
} catch (FileNotFoundException e) {
JOptionPane.showMessageDialog(null, "The file doesn't exist",
"", JOptionPane.ERROR_MESSAGE);
System.exit(0);
} catch (IOException e) {
JOptionPane.showMessageDialog(null, "I/O Error creating file",
"", JOptionPane.ERROR_MESSAGE);
System.exit(0);
return in;
private static void closeInputFile(DataInputStream in) {
try {
in.close();
} catch (IOException e) {
JOptionPane.showMessageDialog(null, "I/O Exception closing file",
"", JOptionPane.ERROR_MESSAGE);
System.exit(0);
} // end closeInputFile()
private double entireInventory() {
// a temporary double variable that the method will return ...
// after each product's inventory is added to it
double entireInventory = 0;
// loop to control number of products
for (int index = 0; index < inventory.length; index++) {
// add each inventory to the entire inventory
entireInventory += inventory[index].setInventoryValue();
} // end loop to control number of products
return entireInventory;
} // end method entireInventory
private void jbtLastActionPerformed(java.awt.event.ActionEvent evt) {
currentProductIndex = inventory.length-1; // move to the last product
// display the information for the last product
displayProduct(inventory[currentProductIndex]);
private void jbtPreviousActionPerformed(java.awt.event.ActionEvent evt) {
if (currentProductIndex != 0) // it's not the first product displayed
currentProductIndex -- ; // move to the previous product (decrement the current index)
} else // the first product is displayed
currentProductIndex = inventory.length-1; // move to the last product
// after the current product index is set, display the information for that product
displayProduct(inventory[currentProductIndex]);
private void jbtNextActionPerformed(java.awt.event.ActionEvent evt) {
if (currentProductIndex != inventory.length-1) // it's not the last product displayed
currentProductIndex ++ ; // move to the next product (increment the current index)
} else // the last product is displayed
currentProductIndex = 0; // move to the first product
// after the current product index is set, display the information for that product
displayProduct(inventory[currentProductIndex]);
private void jbtFirstActionPerformed(java.awt.event.ActionEvent evt) {
currentProductIndex = 0;
// display the information for the first product
displayProduct(inventory[currentProductIndex]);
private void colorFieldActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
private void jbtModifyActionPerformed(java.awt.event.ActionEvent evt) {
prodNameField.setEditable(true);
prodNameField.setFocusable(true);
unitsInStockField.setEditable(true);
unitPriceField.setEditable(true);
private void jbtAddActionPerformed(java.awt.event.ActionEvent evt) {
IDNumberField.setText("");
IDNumberField.setEditable(true);
prodNameField.setText("");
prodNameField.setEditable(true);
colorField.setText("");
colorField.setEditable(true);
unitsInStockField.setText("");
unitsInStockField.setEditable(true);
unitPriceField.setText("");
unitPriceField.setEditable(true);
restockingFeeField.setText("");
invenValueField.setText("");
currentProductIndex = inventory.length;
private void jbtExitActionPerformed(java.awt.event.ActionEvent evt) {
DataOutputStream out = openOutputStream("inventory.dat");
for (InventoryPlusColor i : inventory)
writeInventory(i, out);
closeFile(out);
System.exit(0);
private static InventoryPlusColor readProduct(DataInputStream in) {
int idNum = 0;
String prodName = "";
double inStock = 0.0;
double pricBalusC -- The line that gives me my NullPointerException is when I call the "DisplayProduct()" method. Its a dumb question, but with NetBeans how do I find out which reference could be null? I'm not very familiar with how NetBeans works with finding out how to debug. Any help you can give me would be greatly appreciated.The IDE is com-plete-ly irrelevant. It's all about the source code.
Do you understand anyway when and why a NullPointerException is been thrown? It is a subclass of RuntimeException and those kind of exceptions are very trival and generally indicate an design/logic/thinking fault in your code.
SomeObject someObject = null; // The someObject reference is null.
someObject.doSomething(); // Invoking a reference which is null would throw NPE. -
File Server Resource Manager 2012 - Fails to generate storage report - Event ID: 8242 and 602
Installed file server resource manager roll on new 2012 file server. When I attempt to run a dup report on the local volume, I received an error message: "the report generation task failed with the following errors: Error generating report
job with task name". "
Event ID 8242 and 602 are logged in the event viewer.
Log Name: Application
Source: SRMSVC
Date: 6/24/2013 11:11:03 AM
Event ID: 8242
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: xxxxxxxxxxxxxxxxx
Description:
Reporting or classification consumer '' has failed.
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="SRMSVC" />
<EventID Qualifiers="32772">8242</EventID>
<Level>2</Level>
<Task>0</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2013-06-24T16:11:03.000000000Z" />
<EventRecordID>1276</EventRecordID>
<Channel>Application</Channel>
<Computer>xxxxxxxxxx</Computer>
<Security />
</System>
<EventData>
<Data>
</Data>
<Data>
Error-specific details:
Error: (0x80131501) Unknown error</Data>
<Binary>2D20436F64653A20434E534D4D4F444330303030303234332D2043616C6C3A20434E534D4D4F444330303030303231322D205049443A202030303030333036302D205449443A202030303030333734382D20434D443A2020433A5C57696E646F77735C73797374656D33325C73726D686F73742E657865202D20557365723A204E616D653A204E5420415554484F524954595C53595354454D2C205349443A532D312D352D313820</Binary>
</EventData>
</Event>
Log Name: Application
Source: SRMREPORTS
Date: 6/24/2013 11:11:03 AM
Event ID: 602
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: xxxxxxxxxxxxxxxxxxxx
Description:
Error generating report job with the task name ''.
Context:
- Exception encountered = System error.
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="SRMREPORTS" />
<EventID Qualifiers="0">602</EventID>
<Level>2</Level>
<Task>0</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2013-06-24T16:11:03.000000000Z" />
<EventRecordID>1277</EventRecordID>
<Channel>Application</Channel>
<Computer>xxxxxx</Computer>
<Security />
</System>
<EventData>
<Data>Error generating report job with the task name ''.
Context:
- Exception encountered = System error.
</Data>
</EventData>
</Event>
When I click on schedule a new report task, I get an error "Class not registered".
nadaHi,
When we schedule a new job, we add a scheduled task to the c:\windows\tasks folder.
The scheduled task will contain the following command line
"c:\WINDOWS\system32\storrept.exe reports generate /scheduled /Task:"FSRM_Report_Task{GUID.......}"
There is also a folder on the system drive
C:\StorageReports\Scheduled
We Also store information in the system volume information folder in the following files:
c:\system Volume Information\SRM\Settings\ReportSettings.xml (we use .old and .alt extentions}
c:\system Volume Information\SRM\reports\reportX.xml (where X = an incrementing number set, in writing to these files, we also use .old and .alt extentions}
When experiencing issues relating to scheduled report jobs, you will want to examine these files and check for NTFS permissions issues on these locations also.
Make sure you check the volume that you will be running the report on.
TechNet Subscriber Support in forum |If you have any feedback on our support, please contact [email protected] -
Hi. I’ve set up a web form that uses html and javascript. This particular form lets you upload files. I also have another page that lets you play videos. I was wondering if anyone knows how to make the inner html of for example the upload file form field equal the file that is played by the video player on the other page.
Basically on youtube when you upload a video it automatically makes another page with the video file you uploaded assigned to the video player on that page. I want to know how to go about doing that. So people can upload videos and then be able to watch them instantly without me manually having to create the page an assigning the right file to the page.
Even just knowing how to create a different page each time the form is submitted would be helpful. Thanks.This is more complex than you realize and JavaScript alone can't do it. You'll need a server-side script like PHP to authenticate and sanitize file uploads to prevent malicious scripts or malware from ever getting to your server. Then, your script will have to process the uploaded file by saving it to a folder or database, give it a unique ID and then redirect users to a new page that pulls the file into an HTML5 or similar player. How good are you with server-side programming?
Nancy O. -
Sending XML file from SAP to Windows Based file server with FTP function
Hi Gurus,
We are using SAP BW 3.0B version.
I need to convert data in ODS to XML format and send this XML file to remote server which is not a SAP application server, it is just a Window Based file server with FTP function..
By writing some ABAP code I have converted ODS data into XML format (which gets saved in my local system)
(Is that I need to put this file in Application Server to send it to the other servers? )
Now the thing is how I can send this file to that Windows Based file server.
plz suggest me.... what can be done......
Thanks in Advance
Madhusudhan
Edited by: Madhusudhan Raju on Dec 3, 2009 4:25 AMI dont think the above code support windows OS. Because I always execute this script via UNIX.
I think you can try this option, go to command prompt, goto the destination path where you have an XML file using cd....
ftp (destination servername), specify the username and password.
afterthat, use the command put and filename.
check whether the file had reached destination successfully or not.
For automation purpose, you can use the following script like
ftp: -s: test.txt (servername)
In test.txt,
UserName
Password
bin
cd /files
put file.xml
bye
Also, you can check in SM69, there will be some SAP external commands to automate the file transfer.
Thanks
Sat
http://support.microsoft.com/?kbid=96269 -
Run HTTP File Server on Mac OSX Lion Server?
Hello!
I have a Mac Mini running Mac OS X Lion Server.
I would like to be able to host a Web Server that runs within the built in Apache server that allows the transfer of files from Client to Mac Mini HD and vice versa using authentication from Open Directory.
My inspiration is HTTP File Server, or HFS (no, not the Disk Format). This, however, is a Windows Program. It allows a HTTP platform to upload and download files from the HD of the machine it is running from. It comes as a nifty .exe that has everything you need. I'd like something similar but to run on the Mac Server.
Note, the upload and download cannot be done over FTP. It must be using HTTP like HFS does.
At the very least, I'd like a HTTP (Port 80) Web Server that runs within Apache that allows upload and download to the HD.
And at best, authentication using the built in Open Directory credentials. And to make even more secure, HTTPS or SSL.
So it's like iCloud or iWork.com but using my own disk space and credentials.
Predicted End Product:
User visits https://192.168.x.x or https://MyDNSName.dns.com
Greeted with Home Screen (.html or .php)
Clicks login
Has a nice login window to use (probably have to be .php to keep simple)
Logs in using same credentials as they would to logon to Mac Mini locally
Greeted with view of their files in their Directory, e.g.: /Library/Server/Web/HFS/User1 or /Library/Server/Web/HFS/User2, etc
Can choose to download present files
Or upload. Click Upload
Upload window appears. Selects file on Client machine.
Over HTTP, file is uploaded to Host Machine to /Library/Server/Web/HFS/User1
What I'd like to know is what is the easiest way of going about this? Some kind of CMS like Wordpress or software like HFS?
Many thanks,
ClarkI'm a little confused here... what's the requirement for HTTP based transfers vs. traditional file sharing protocols such as AFP?
Secondly, how does 'HFS' differ from any other HTTP form-based uploader? Any web CGI or scripting system such as PHP or Perl could easily present an upload form.
Have you considered WebDAV, which is designed as s file transfer protocol over HTTP?
It integrates at the Finder level, meaning you can copy files by simply dragging and dropping file (and folder) icons in the desktop, just like on a local drive. It's part of the standard Mac OS X Apache installation, too. -
Writing a stored procedure to import SQL Server table data into a Oracle table
Hello,
As a new DBA I have been tasked with writing a stored procedure to import SQL Server table data into an Oracle table. I have been given many suggestions on how to do it from SQL Server but I I just need to write a stored procedure to run it from the Oracle side. Suggestions/guidance on where to start would be greatly appreciated! Thank you!
I started to write it based on what I have but I know this is not correct :/
# Here is the select statement for the data source in SQL Server...
SELECT COMPANY
,CUSTOMER
,TRANS_TYPE
,INVOICE
,TRANS_DATE
,STATUS
,TRAN_AMT
,CREDIT_AMT
,APPLD_AMT
,ADJ_AMT
,TRANS_USER1
,PROCESS_LEVEL
,DESCRIPTION
,DUE_DATE
,OUR_DATE
,OUR_TIME
,PROCESS_FLAG
,ERROR_DESCRIPTION
FROM data_source_table_name
#It loads data into the table in Oracle....
Insert into oracle_destination_table_name (
COMPANY,
CUSTOMER,
TRANS_TYPE,
INVOICE,
TRANS_DATE,
STATUS,
TRANS_AMT,
CREDIT_AMT,
APPLD_AMT,
ADJ_AMT,
TRANS_USER1,
PROCESS_LEVEL,
DESCRIPTION,
DUE_DATE,
OUR_DATE,
OUR_TIME,
PROCESS_FLAG,
ERROR_DESCRIPTION)
END;CREATE TABLE statements would have been better as MS-SQL and Oracle don't have the same data types.
OUR_DATE, OUR_TIME will (most likely) be ONE column in Oracle.
DATABASE LINK
Personally, I'd just load the data over a database link:
insert into oracle_destination_table_name ( <column list> )
select ... <transform data here>
from data_source_table@mssql_db_link
As far as creating the database link from Oracle to MS-SQL ... that is for somebody else to answer.
(most likely you'll need to use an ODBC driver)
EXTERNAL TABLE
If the data from MS-SQL is in a CSV file, just use and external table.
same concept:
insert into oracle_destination_table_name ( <column list> )
select ... <transform data here>
from data_source_external_table
MK -
Files Created by external computer are read only on file server!
Not an indesign question but have searched and searched but can't find an answer, hoping someone in here has had same problem and know if it can be fixed.
Systems:
MacPro running snow lepoard as the file server
iMac reading and writing files to the Macpro given access to shared files.
Problem:
When the iMac saves any file types or creates directories everything the iMac makes on the Macpro system is read only to the Macpro user.
Only solution so far has been to give the iMac user an admin account on the MacPro then everything they create is not read only.
This works but its not the best of ideas to have them accessing system files and what have you.
Is there a way of making the iMac create files that are not read only without getting the server version of osx or giving them admin rights to the Macpro.
Any idea or suggestions would be great
Thank youProblem Solved!
It all came down to Ownership not shareing or perrmissions.
For anyone that might need to know:
in the get info dialog select the "Ignore ownership on this volume"
tonyharmer:
You where right the people over in the apple forums where very helpful -
OK, this is kind of a bizarre question and I suspect it has something to do with my having Master Collection installed on my machine and a file typing issue. But I can't confirm for sure . . . so if anyone has any ideas to point me in the right direction, I'd really appreciate it.
I'm running Windows 7 Professional (32 bit) with Master Collection CS5 installed.
I'm a real estate agent and our MLS has forms for us to fill out when writing an offer to purchase for someone. When we create a profile for our buyer, we fill out their basic information in a web form (Name, Address, Property Address, Purchase Price, etc. etc.). Then we select (again through another web form) the forms we want to populate with the appropriate information. Once we hit submit, we're given the option to open each form individually and then fill in other parts of the forms, etc. The page that controls that is a Cold Fusion page i.e. pagename.cfm followed by arguments that tell it what form to open and where to find the intormation to fill in. When I've filled in the form and go to save it, on any machine that doesn't have Dreamweaver, etc. installed it saves those forms as a PDF file. On my machine however, with everything installed, it wants to save them as CFM files. Now I know they're actually PDF files and if I forget to rename it during the initial save, I can go in and change the extension and it opens in Acrobat just fine. But I'd like to NOT have to remember to rename them everytime I save a form.
So again, I think it's a file typing/extension issue . . . but I'm not sure where to start looking. And I've never messed with that stuff in Windows 7 either.
Any help would be GREATLY appreciated.
Thanks in advance for any replies.
JohnCame here to complain about this maddening feature. Why it doesn't save the PDF out to a separate instance of the document is beyond me. PLENTY of us want to save the PDF without the layers, and want the PSD separate.
"Oh good, I've completed this document.... let me just save it out as a PDF for client delivery and... Now all the work is gone."
Genius, Adobe, genius. But it's cool--we'll just keep paying out the nose on a subscription basis with no fix for small errors like this. -
Manual Exporting of BLOB specific table to text file
Hi,
Our application is having 60000 record in a BLOB specific table.
My requirement is to export the entire table data to text files .
When I tried converting BLOB to sting and writing to file, it took almost 3 mins for 100 records, if so, will take so much of time in exporting data from BLOB specific table.
I am using the following logic,
byte[] bdata = blob.getBytes(1, (int)blob.length());
String data1 = new String(bdata);
buffer.append(data1);
Can anyone please tell me how can I speed up the operation.>
Our application is having 60000 record in a BLOB specific table.
My requirement is to export the entire table data to text files .
>
Welcome to the forum!
If you are looking for a pure Java solution you should post this question in the JDBC forum.
https://forums.oracle.com/forums/category.jspa?categoryID=288
Unless your BLOB data is located inline you are going to use Oracle to read 60,000 files, one at a time, and then use Java to write 60,000 files one at a time.
That will be a very slow process.
Also - your Java code is only going to read the LOB locator and inline BLOB data since you are not getting and processing the actual stream.
See 'Reading and Writing BLOB, CLOB and NCLOB Data' in the JDBC Dev Guide for details
http://docs.oracle.com/cd/B28359_01/java.111/b31224/oralob.htm#sthref756 -
HREF Link to file server does not work
This is more of a question for IIS 6 but since I couldn't find a forum for IIS I thought I would post here. I am migrating our Intranet site from an ancient Site Server machine to a rebuilt Windows 2003/IIS 6 machine. The Intranet uses ASP and
I have everything working and all pages display correctly in IE8 and IE9. However, we have several pages that contain links to documents on a separate Windows 2008 file server. These links work fine on the old server but on the new server nothing
happens when I click the links. The links are formatted as follows:
<a href="file:\\server2\openshare\dept\_Open_Read_Only\docs\schedule.xls" target="_blank">Schedule<o:p></o:p></a></p>
I have seen references about adding more slashes and have tested various forms like this:
<a href="file://///server2\openshare\dept\_Open_Read_Only\docs\schedule.xls" target="_blank">Schedule<o:p></o:p></a></p>
and
<a href="file:///\\server2\openshare\dept\_Open_Read_Only\docs\schedule.xls" target="_blank">Schedule<o:p></o:p></a></p>
but no change. Nothing happens when I click the link. Note that the links are in HTML files and not imbedded in any ASP or VB code. Does anyone have any thoughts on this?
Thanks,
JoeHi,
Thanks for your sharing, it can benefit others.
Regards.
Jeremy Wu
TechNet Community Support
Maybe you are looking for
-
Use of BAT file - How do you completely delete 150 phones and their associate DNs?
How do you completely delete 150 phones and their associate DNs? All the phones are in the same device pool. I prefer BAT way. Version of the CUCM: 8.6.2 Type of phones: 7962 phones - associated with the same device pool. Additinal questions: Is ther
-
Form ARXTWMAI.fmb is not openning in client machine
Hi All, I am using EBS version 12.1.3 and oracle form builder 10g. When I am trying to open a form(ARXTWMAI.fmb) in the oracle form builder(client machine) has stopped working and leads to close the form builder I loaded all the dependent forms(.fmb)
-
Hi, I have simple database contains key/value records. The program is a multi-thread application that iterate over records. Each worker thread read a record and after some calculations, replace it. The records are completely independent from each oth
-
Help need for stacked chart in apex 4.1
I have formed the query for stacked chart (3D or 2D) in APex Ver 4.0.2.00.09 and i have also set the legend display .... Chart is build sucessfully. What i expect is when i place the mouse on the each stack in the chart it should say the legend type
-
Every time i want to work witch mail clicking the application (the stamp) it starts with representing every mail in my folders in separate windows, by the time this is done (taking up to 15 minits, the applications does not react anymore. Other apps