Increasing memory used by java process when calling Runtime.exec()

Hi everyone!
I'm running a servlet Oracle iAS 9i, Jserv. It receives an image posted by a user and does a System.exec() which performs a call to convert (an image processing utility included in ImageMagick).
After a few hours, java process start taking more and more RAM, until it crashes with an error like this:
Memory: 5394008 free of 134217728 total. (I log this myself)
Exception: java.io.IOException: Not enough space
java.lang.UNIXProcess.forkAndExec(), line -2.
java.lang.UNIXProcess.<init>(), line 54.
java.lang.Runtime.execInternal(), line -2.
java.lang.Runtime.exec(), line 553.
ImageProcessor.convert(), line 235.
ImageProcessor.createItemPics(), line 124.
Uploader.doPost(), line 69.
As you can see, this is not an OutOfMemoryError, but something else in connection with O/S.
This is not related to hard disk space, since there is a lot of free space in every filesystems
After restarting the webserver, everything goes back to normal and start increasing RAM again.
Is there anything I can do? Any help will be gratly appreciated... Thanks!!!
Dani.-

Have you had any solutions to this pal?
I am also suffering. I tried closing the processes by:
Runtime runtime = Runtime.getRuntime();
Process proc = runtime.exec("/opt/sta_rpms.sh " + sFileName);
proc.waitFor();
proc.getInputStream().close();
proc.getOutputStream().close();
proc.getErrorStream().close();
proc.destroy();
proc = null;
but still after like a day...Though our codes are not alike, it sounds like the same reason.
Cheers!

Similar Messages

  • Is there  a way to access total memory used by java instance?

    is there a way to access total memory used by java instance?
    i'm familiar with
    runtime.getTotalMemory() and runtime.getFreeMemory();
    and i understrnad that it is a measure of the amount of memory available for the heap used to allocate objects and the amount of memory not being used by the object heap --
    but is there a way to (from java get the value that you get when you go to the windows taskmanager and look at javavm.exe
    stephen

    i'm using java 1.4 if that helps

  • Undeploying a Web application using a Java method or call

    Hi, I have an application running on weblogic that I want to undeploy using a Java method or call.
    Is there any way to do that with a weblogic specific API or something like?
    Thank you!

    Hi Carolina,
    Please ignore My previous response…I have found the reason why the “start()”was not functioning properly…. The application takes some time to get distributed …Before that “start()” should not be invoked…so Please put some Thread.sleep() there….
    Target deployTargets[]=new Target[1];
    deployTargets[0]=targets[0];
    ProgressObject processStatus=deployManager.distribute(deployTargets, new File(applicationLocation), null,options);
    DeploymentStatus deploymentStatus=processStatus.getDeploymentStatus() ;
    System.out.println(“UnDeploymentStayus.getMessage(): “+deploymentStatus.getMessage() );
    <font color=red>
    ////////////////////////HERE WE NEED To SLEEP Sothat APPLICATION GETS DISTRIBUTED SUCCESSFULLY////////
    Thread.sleep(5000);
    /////////////////////////////////////////////////////////////</font>
    TargetModuleID[] targetModuleIDs=deployManager.getAvailableModules(ModuleType.WAR, deployTargets);
    System.out.println(“\n\t targetModuleIDs [] = “+targetModuleIDs);
    for (int j=0;j<targetModuleIDs.length;j++)
    System.out.println("\n\t "+targetModuleIDs[j]);
    deployManager.start(targetModuleIDs);
    deployManager.start(targetModuleIDs);
    Thanks
    Jay SenSharma
    Edited by: Jay SenSharma on Jan 26, 2010 10:00 PM

  • Tidal abends with error message: Jvm call Runtime.exec() returned null

    just wandering if this error "Jvm call Runtime.exec() returned null  Command[chmod 777] launch failed." is a tidal error and not a job command error returned from the OS server.
    thanks,
    warren

    I'm having the same problem...
    Have you been able to solve your problem yet?

  • Memory used by unknown processes

    Hey all,
    I have a serious problem on my 2008 model macbook running snow leopard 10.6.8 with 4GB of memory
    Used memory continuosly grows even though no work is being done (i.e. no application opened).
    It gets to a point where free memory goes almost to zero and only then system apparently frees some of it.
    Using free memory app I can free memory manually but still after freeing, free memory continue to decline.
    What really bothers me is that the sum of all memory used by processes (from both activity monitor and ps command) does not sum up to total used memory.
    Can some "invisible" process be using my memory? or ps/activity monitor outputs are not correct?

    Not exactly sure what you mean.
    Here's output from top (the header):
    Processes: 74 total, 3 running, 1 stuck, 70 sleeping, 535 threads                                                        13:40:42
    Load Avg: 0.36, 0.22, 0.35  CPU usage: 8.33% user, 41.66% sys, 50.0% idle    SharedLibs: 5888K resident, 8800K data, 0B linkedit.
    MemRegions: 13884 total, 1746M resident, 28M private, 380M shared.
    PhysMem: 590M wired, 2219M active, 1025M inactive, 3834M used, 261M free.
    VM: 178G vsize, 1043M framework vsize, 738071(0) pageins, 235(0) pageouts. Networks: packets: 660846/677M in, 332007/37M out.
    Disks: 327320/5791M read, 154559/5840M written.
    And here's the sum of RSS from ps:
    # ps -axm -o "rss,comm"|grep -v COMM|awk 'BEGIN{a=0}{a+=$1}END{print a}'
    2537976
    As you can see, top reports 3834MB as used, while sum of RSS from ps shows ~2.5GB

  • How to use the current connection when calling db procedure ?

    dear all,
    Am using Jdevleoper 11.1.1.3 ,
    I have a java class that call a database procedure , now everything is going fine with me but a bit slow bcoz am openning a new connection I think it would be definitely faster if am using the current connection
    so how can i re-write my code so i can use the current connection istead of defining a new connection to the DB :
    public void DeleteApp (int PAppNo){
    String username,password,thinConn;
    username = "ACC";
    password = "ACC";
    thinConn = "jdbc:oracle:thin:@..."
    try {
    DriverManager.registerDriver(new OracleDriver());
    Connection conn = DriverManager.getConnection(thinConn, username, password);
    CallableStatement cs = conn.prepareCall(" { call myprocedure(?,?,?) } ");
    cs.setInt(1,PAppNo);
    Thanks for all,
    Lama

    Delta,
    You shound NOT be doing JDBC calls from your UI project. You should put the code as a service method in your application module, expose the service method to the client, and then call it through the binding layer from your UI http://download.oracle.com/docs/cd/E14571_01/web.1111/b31974/bcservices.htm#sm0212
    thx John & timo but u always post the same reply at the same time for my questionsTimo and I have been around long enough that we recognize the questions that have been posted 9,461,293,811 times before and know the stock answers, and know where in the documentation the answers are given. As you appear to be new to ADF, I'd strongly recommend reading the Fusion Developer's Guide (skim it once and then read in detail the parts that interest you). As I've said before, so many of the basic (and not-so-basic) concepts are covered in there. Once you've skimmed it in enough detail, then the next time you have a problem, you might not know the answer, but you'll remember, "ah, I think I read something about that before, let me check..."
    John

  • How Can I increase memory used by director?

    Hi
    I have a tool, written in director, that imports all
    imagefiles from a
    folder and its subfolders into director cast
    It worked since years without any problem
    But now I have following problem - if the amount of files is
    big enough,
    director is out of memory, can not create any new member more
    I do it like this
    repeat with i=1 to cFileList
    cFile=cFileList
    mem = new(#image, myCast)
    mem.importFileInto(cFile, [#trimWhiteSpace:FALSE,
    #remapImageToStage:FALSE])
    mem.name=cFile
    end repeat
    At some moment command
    mem = new(#image, myCast)
    fails, it can happen on 500-th file in the list, or an 570-th
    or on some
    other point. So the problem is not in some definite file, but
    in memory. How
    can I avoid this problem? Can I purge the memory, used by the
    program till
    that moment or is there any other way do to it?
    Any help will be appreciated

    Look up save castlib. put this in your loop and and maybe try
    i mod 10 so it
    only saves every 10 times. This should pull the images from
    ram to disk, and
    sort of purge the memory for you.
    Timm
    "Jorg Mann" <[email protected]> wrote in message
    news:emof0k$cqh$[email protected]..
    > Hi
    >
    > I have a tool, written in director, that imports all
    imagefiles from a
    > folder and its subfolders into director cast
    > It worked since years without any problem
    > But now I have following problem - if the amount of
    files is big enough,
    > director is out of memory, can not create any new member
    more
    >
    > I do it like this
    >
    > repeat with i=1 to cFileList
    > cFile=cFileList
    > mem = new(#image, myCast)
    > mem.importFileInto(cFile, [#trimWhiteSpace:FALSE,
    > #remapImageToStage:FALSE])
    > mem.name=cFile
    > end repeat
    >
    > At some moment command
    > mem = new(#image, myCast)
    > fails, it can happen on 500-th file in the list, or an
    570-th or on some
    > other point. So the problem is not in some definite
    file, but in memory.
    > How
    > can I avoid this problem? Can I purge the memory, used
    by the program till
    > that moment or is there any other way do to it?
    >
    > Any help will be appreciated
    >
    >

  • Environment of process created by Runtime.exec()

    Can anyone describe the interactions of the process environment created by Runtime.exec()?
    For example, if Runtime.exec() is used as follows:
    Runtime.exec("cmd /K somebatfile");
    Is the environment preserved throughout the execution of somebatfile?
    Rather, if the classpath, working directory, etc. is changed within "somebatfile" are those changes still preserved by the cmd shell if it is executed this way from Runtime?

    That is the way I thought things worked. Thanx.
    However, when I start my command script inside of a shell (with "cmd /K") I get a "file not found" error. The command generating the error is a java call loading a executable jar which uses jni to open sockets and I have no Idea what else. (I know about the sockets because of the failed socket messages that are generated after the file not found error). The source code for the launched application is not available.
    If you can provide some other insight I would appreciate it.

  • Core generated by java process when using TT jdbc connector

    Hi everyone,
    First I have been looking for similar issues in this forum and nothing I have found is conslussive regarding the problem I am about to tell you.
    I have a java DB client running in a Solaris 8 machine and since about a month we have had our process killed because java was receiving a SIGSEGV signal.
    It is very strange and I do not seem to be able to understand what is going on. Let me give you more data about the problem I am having.
    Machine
    $ uname -a
         SunOS 5.8 Generic_117350-21 sun4u sparc SUNW,Sun-Fire-V240
    JAVA VERSION
    $ java -version
         java version "1.5.0_11"
         Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
         Java HotSpot(TM) Server VM (build 1.5.0_11-b03, mixed mode)
    $ which java
         /usr/jdk/jdk1.5.0_11/bin/java
    TIMESTEN VERSION
    $ pwd
    /opt/TimesTen/
    $ head README.TXT
         Release Notes For TimesTen 5.1.34
         =================================
         This document provides late-breaking information as well as
         information that is not yet part of the formal documentation.
         To install TimesTen, run setup.exe (for Windows) or setup.sh
         (for all other operating systems) from the installation media.
         For installation information, please see the TimesTen Installation
    Please, find enclosed this piece of hs_err file dumped by the JVM after it crashed just in case it is useful:
    # An unexpected error has been detected by HotSpot Virtual Machine:
    # SIGSEGV (0xb) at pc=0xf81b053c, pid=2719, tid=215
    # Java VM: Java HotSpot(TM) Server VM (1.5.0_11-b03 mixed mode)
    # Problematic frame:
    # C [libttclient.so+0x1053c]
    --------------- T H R E A D ---------------
    Current thread (0x002a89d0): JavaThread "Thread-203" [_thread_in_native, id=215]
    siginfo:si_signo=11, si_errno=0, si_code=1, si_addr=0x05000008
    Registers:
    O0=0x00c87d78 O1=0x009b6b88 O2=0x009b6b88 O3=0xf8415ce0
    O4=0xf84bb438 O5=0x006662b4 O6=0xc6980780 O7=0xf81d23c0
    G1=0x000a5000 G2=0x05000000 G3=0x00000000 G4=0x00008000
    G5=0x00009638 G6=0x00000000 G7=0xc6981d98 Y=0x00000000
    PC=0xf81b053c nPC=0xf81b0540
    Top of Stack: (sp=0xc6980780)
    0xc6980780: 00000000 00000000 00000000 00000000
    0xc6980790: 00000000 00000000 00000000 00000000
    0xc69807a0: 009b6b78 00000001 009b6b78 009b6b88
    0xc69807b0: 000aa274 fe42d024 c69807e0 f81a5cc4
    0xc69807c0: 002a8a8c 00000066 00000001 fe3d8000
    0xc69807d0: d44714b8 002ee0c0 00000000 00000002
    0xc69807e0: f81b0520 00000002 00000000 fe42186c
    0xc69807f0: fe3d8000 00008800 00000274 fe43106c
    Instructions: (pc=0xf81b053c)
    0xf81b052c: 80 a2 20 00 22 48 00 08 c4 06 a0 0c c4 02 20 00
    0xf81b053c: e0 00 a0 08 9f c4 00 00 92 10 20 01 c4 06 a0 0c
    Stack: [0xc6902000,0xc6981d98), sp=0xc6980780, free space=505k
    Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
    C [libttclient.so+0x1053c]
    C [libttclient.so+0x5ccc] SQLFreeEnv+0xac
    C [libttJdbcCS.so+0x8544] Java_com_timesten_jdbc_JdbcOdbcClient_freeEnv+0x38
    j com.timesten.jdbc.JdbcOdbcClient.freeEnv(I[B)V+424123328
    j com.timesten.jdbc.JdbcOdbcClient.freeEnv(I[B)V+0
    j com.timesten.jdbc.JdbcOdbc.SQLFreeEnv(I)V+40
    v ~C2IAdapter
    J com.timesten.jdbc.JdbcOdbcConnection.close()V
    v ~I2CAdapter
    j org.apache.commons.dbcp.PoolingConnection.close()V+51
    j org.apache.commons.dbcp.DelegatingConnection.close()V+8
    j org.apache.commons.dbcp.PoolableConnection.reallyClose()V+1
    j org.apache.commons.dbcp.PoolableConnectionFactory.destroyObject(Ljava/lang/Object;)V+11
    j org.apache.commons.pool.impl.GenericObjectPool.returnObject(Ljava/lang/Object;)V+149
    j org.apache.commons.dbcp.PoolableConnection.close()V+22
    j org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.close()V+8

    Well, it looks like something in the Java layer is passing a bad handle to the TimesTen client ODBC driver SQLFreeEnv() function. Given the implementation of the TT JDBC driver this is quite possibly a bug in the JDBC driver though it is also possible that it is due to some invalid value passed in from a higher layer.
    If the situation is easily and consistently reproducible then seeing the code that causes the problem would be very useful. If not then this wil be hard to debug. I'd suggest that you open an SR with support but of course 5.1 is now well outside its support window so...
    Chris

  • SQL Workbench/J Increase Memory Using -Xmx?

    If I'm on the wrong forum, apologies.
    Very recently, I have to use SQL Workbench/J which I am not too familiar with, it has a habit of running out of memory when I run queries.
    Apparently I can edit the workbench.settings file in the .sqlworkbench directory and increase the allocated memory by adding a line with -Xmx1024
    Does anyone know the exact syntax?

    Just in case anyone is interested, I created a .bat file with one line, like this:
    java -Xmx1024m -jar c:\<the directory where you put the sqlworkbench.jar>
    Put it on the desktop and click on it, the java VM will allocate more memory.
    It worked for me, I can run bigger queries now.

  • BEx Web: Java Error when calling query from Query Designer

    When designing a query in the designer and executing it via the portal,
    I get the following error:
    com.sap.ip.bi.base.application.variableprocessor.IVariableProcessor.synchronizeStateVariables()V
    The complete exception is:
    com.sap.ip.bi.webapplications.runtime.controller.MessageException: Error while calling the method "processDialogCommand"     at com.sap.ip.bi.webapplications.runtime.impl.Page.processRequest(Page.java:2366)     at com.sap.ip.bi.webapplications.runtime.controller.impl.Controller.doProcessRequest(Controller.java:841)     at com.sap.ip.bi.webapplications.runtime.controller.impl.Controller.processRequest(Controller.java:775)     at com.sap.ip.bi.webapplications.runtime.jsp.portal.services.BIRuntimeService.handleRequest(BIRuntimeService.java:412)     at com.sap.ip.bi.webapplications.runtime.jsp.portal.components.LauncherComponent.doContent(LauncherComponent.java:21)     at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)     at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)     at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)     at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)     at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)     at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:215)     at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:645)     at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)     at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)     at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)     at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:753)     at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:240)     at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:522)     at java.security.AccessController.doPrivileged(Native Method)     at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:405)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)     at com.sap.engine.services.servlets_jsp.server.servlet.InvokerServlet.service(InvokerServlet.java:156)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)     at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)     at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)     at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:387)     at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:365)     at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:944)     at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:266)     at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)     at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:160)     at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)     at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)     at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)     at java.security.AccessController.doPrivileged(Native Method)     at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)     at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)Caused by: com.sap.ip.bi.base.exception.BIBaseRuntimeException: Error while calling the method "processDialogCommand"     at com.sap.ip.bi.util.MethodInvoker.callMethod(MethodInvoker.java:116)     at com.sap.ip.bi.webapplications.runtime.command.CommandProcessorHelper.processCommand(CommandProcessorHelper.java:439)     at com.sap.ip.bi.webapplications.runtime.command.CommandProcessorHelper.processCommand(CommandProcessorHelper.java:325)     at com.sap.ip.bi.webapplications.runtime.base.CommunicationProcessor.processCommand(CommunicationProcessor.java:144)     at com.sap.ip.bi.webapplications.runtime.impl.Page.processCommandSuper(Page.java:1451)     at com.sap.ip.bi.webapplications.runtime.impl.Page.processCommandInternal(Page.java:1439)     at com.sap.ip.bi.webapplications.runtime.impl.Page.processCommandSequence(Page.java:2022)     at com.sap.ip.bi.webapplications.runtime.impl.Page.displayVariableScreen(Page.java:1845)     at com.sap.ip.bi.webapplications.runtime.impl.Page.processCommandSequence(Page.java:2069)     at com.sap.ip.bi.webapplications.runtime.impl.Page.doProcessRequest(Page.java:2755)     at com.sap.ip.bi.webapplications.runtime.impl.Page.processRequest(Page.java:2288)     ... 36 moreCaused by: java.lang.NoSuchMethodError: com.sap.ip.bi.base.application.variableprocessor.IVariableProcessor.synchronizeStateVariables()V     at com.sap.ip.bi.webapplications.ui.dialogs.variablescreen.DlgVariable.doUiDialogInit(DlgVariable.java:259)     at com.sap.ip.bi.webapplications.ui.dialogs.framework.UiDialog.doInit(UiDialog.java:164)     at com.sap.ip.bi.webapplications.runtime.base.PageObject.init(PageObject.java:244)     at com.sap.ip.bi.webapplications.runtime.base.Dialog.init(Dialog.java:72)     at com.sap.ip.bi.webapplications.runtime.base.Dialog.processCommand(Dialog.java:168)     at com.sap.ip.bi.webapplications.runtime.base.CommunicationProcessor.processDialogCommand(CommunicationProcessor.java:99)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)     at java.lang.reflect.Method.invoke(Method.java:324)     at com.sap.ip.bi.util.MethodInvoker.callMethod(MethodInvoker.java:101)     ... 46 more
    The HP LEvel on the Java Stack is 10, on Te ABAP Stack it is 11.
    Any ideas?
    Thanks in advance, Thom

    Did you check these posts:
    Unable to publish in IE with BEx Query Designer
    Web Analyzer Execute failed- System received an expired SSO ticket
    null

  • Re-use acrodist.exe process when printing to Adobe PDF printer

    We're using BarTender to print to Adobe PDF printer and it is creating an acrodist.exe process for each print job. Is there an Adobe setting or something BarTender could do differently to re-use an existing acrodist.exe process instead of creating a new one. We've noticed that Notepad will re-use an existing acrodist.exe process.
    Thanks,
    Paul

    Well, after restarting my machine the print queue was cleared of all the dead jobs, but when attempting to print to PDF it hung up again, and then did the same as before - all subsequent jobs tried to save as the filename of the first job in the queue. Very annoying!

  • Errors in a Java class when calling other methods

    I am giving the code i have given the full class name . and now it is giving the following error :
    Cannot reference a non-static method connectDB() in a static context.
    I am also giving the code. Please do help me on this. i am a beginner in java.
    import java.sql.*;
    import java.util.*;
    import DButil.*;
    public class StudentManager {
    /** Creates a new instance of StudentManager */
    public StudentManager() {
    Connection conn = null;
    Statement cs = null;
    public Vector getStudent(){
    try{
    dbutil.connectDB();
    String Query = "Select St_Record, St_L_Name, St_F_Name, St_Major, St_Email_Address, St_SSN, Date, St_Company, St_Designation";
    cs = conn.createStatement();
    java.sql.ResultSet rs = cs.executeQuery(Query);
    Vector Studentvector = new Vector();
    while(rs.next()){
    Studentinfo Student = new Studentinfo();
    Student.setSt_Record(rs.getInt("St_Record"));
    Student.setSt_L_Name(rs.getString("St_L_Name"));
    Student.setSt_F_Name(rs.getString("St_F_Name"));
    Student.setSt_Major(rs.getString("St_Major"));
    Student.setSt_Email_Address(rs.getString("St_Email_Address"));
    Student.setSt_Company(rs.getString("St_Company"));
    Student.setSt_Designation(rs.getString("St_Designation"));
    Student.setDate(rs.getInt("Date"));
    Studentvector.add(Student);
    if( cs != null)
    cs.close();
    if( conn != null && !conn.isClosed())
    conn.close();
    return Studentvector;
    }catch(Exception ignore){
    return null;
    }finally {
    dbutil.closeDB();
    import java.sql.*;
    import java.util.*;
    public class dbutil {
    /** Creates a new instance of dbutil */
    public dbutil() {
    Connection conn;
    public void connectDB(){
    conn = ConnectionManager.getConnection();
    public void closeDB(){
    try{
    if(conn != null && !conn.isClosed())
    conn.close();
    }catch(Exception excep){
    The main error is occuring at the following lines connectDB() and closeDB() in the class student manager. The class dbutil is in an another package.with an another file called connectionManager which establishes the connection with DB. The dbutil has the openconnection and close connection methods. I have not yet written the insert statements in StudentManager. PLease do Help me

    You're doing quite a few things that will cause errors, I'm afraid. I'll see if I can help you.
    The error you're asking about is caused by the following line:
    dbutil.connectDB();
    Now first of all please always ensure that your class names begin with capital letters and your instances of classes with lowercase letters. That's what everybody does, so it makes your code much easier to follow.
    So re-write the couple of lines at the beginning of your dbutil class like this:
    public class Dbutil {
    /** Creates a new instance of Dbutil */
    public Dbutil() {
    Now you need to create an instance of dbutil before you can call connectDB() like this:
    Dbutil dbutil = new Dbutil();
    now you can call the method connectDB():
    dbutil.connectDB();
    The problem was that if you don't create an instance first then java assumes that you are calling a static method, because you don't need an instance of a class to call a static method. If it was static, the method code would have been:
    public static void connectDB(){
    You have a fine example of a static method call in your code:
    ConnectionManager.getConnection();
    If it wasn't a static method your code would have to look like this:
    ConnectionManager connectionManager = new ConnectionManager();
    connectionManager.getConnection();
    See the difference? I also know that ConnectionManager.getConnection() is a call to a static method because it begins with a capital letter.
    Anyway - now on to other things:
    You have got two different Connection objects called conn. One is in StudentManager and the other is in Dbutils, and for the moment they have nothing to do with each other.
    You call dbUtil.connectDb() and so if your connectDb method is working properly you have a live connection called conn in your dbUtil object. But the connection called conn in StudentManager is still null.
    If your connection in the dbUtil object is working then you could just add a line after the call to connectDb() in StudentManager so that the StudentManager.conn object references the dbUtil.conn object like this:
    dbutil.connectDB();
    conn = dbUtil.conn;

  • Insert using Spatial Index fails when called from PHP

    I have a stored procedure that inserts into a table with a spatial index on one of its fields.
    When I run the procedure from SQL Server Management Studio it runs just fine.
    When I run it from PHP, it returns the error: "INSERT failed because the following SET options have incorrect settings: 'CONCAT_NULL_YIELDS_NULL, ANSI_WARNINGS, ANSI_PADDING'. Verify that SET options are correct for use with indexed views and/or indexes
    on computed columns and/or filtered indexes and/or query notifications and/or XML data type methods and/or spatial index operations"
    From within Management Studio, I have tried many different combinations of settings, until I wound up with the list I have in the procedure below.
    Within Managment Studio the error changes based on the options I have set, but PHP always replies with: 'CONCAT_NULL_YIELDS_NULL, ANSI_WARNINGS, ANSI_PADDING'
    I have configured PHP to use the same SQL user as management studio, and I have tried both mssql_query and mssql_execute with bound parameters.
    The spatial index is on the field post.location If I remove the spatial index it works, but I need the spatial index.
    CREATE PROCEDURE insert_post ( @subject AS VARCHAR(250), @body AS VARCHAR(2000), @latitude AS FLOAT, @longitude AS FLOAT ) AS BEGIN
    SET NOCOUNT ON
    SET ANSI_WARNINGS ON
    SET ANSI_PADDING ON
    SET CONCAT_NULL_YIELDS_NULL ON
    SET NUMERIC_ROUNDABORT OFF
    DECLARE @location AS geography = geography::Point(@latitude, @longitude, 4326)
    INSERT INTO post
        subject,
        body,
        location
    ) VALUES (
        @subject,
        @body,
        @location
    END

    Hi Charles
    Your issue looks like it have two basic sources: (1) The connection string properties, (2) The table structure and the data which you try to insert.
    (1) The connection string properties can be specified in various ways.
    You can set most of them during the connection, depending on the provider which you are using. We did not get from you any information about the PHP code, so we have no information regarding this part.
    The connection properties can be changed after the connection was made, which is basically what you have try to do. But we don't know what properties
    are differents (since you .. the PHP code..) but you can check those properties dynamically, insert them to a table and then compare. To check all the properties you can use this post:
    http://ariely.info/Blog/tabid/83/EntryId/153/SQL-Server-Get-Connection-Properties.aspx
    (2) We need to understand your
    table structure and compare it to yours query. Please post your DDL+DML (queries to create the table and to insert some sample data), and the full SP code
    as it is now.
    [Personal Site]  [Blog]  [Facebook]

  • Calling runtime.exec in menu(swing)

    Hi all,
    I want to pop up a command (NT) window from a menu in java swing.
    1. However I am able to call from the menu, but was Not able to get the batch file (either .bat or .exe) to run in another window
    2. and all the output from the batch file did not printout to screen.
    any help?
    JMenuItem menuItem = null;
    startAction = new AbstractAction("Start") {
    public void actionPerformed(ActionEvent e) {
    displayResult("Starting Application...", e);
    Process JobProcess = null;
    try {
    // JobProcess = Runtime.getRuntime().exec("cmd.exe /c test.bat");
    //JobProcess = Runtime.getRuntime().exec("cmd /K start cmd /K test.bat");
    //JobProcess = Runtime.getRuntime().exec("cmd.exe /c test.bat"); //works
    JobProcess = Runtime.getRuntime().exec("test.bat"); // works
    JobProcess.waitFor();
    int i = JobProcess.exitValue();
    catch (Exception ex) {
    textArea.append(ex.getMessage());
    in the test.bat :
    echo "this is test" > test.txt
    thanks
    andrew

    I don't believe you can ues redirection (>) when executing a command. Your program must handle the output itself. Add code something like:
    String line;
    BufferedReader output = new BufferedReader( new InputStreamReader( JobProcess.getInputStream() ) );
    while ( (line = output.readLine()) != null )
              System.out.println( line );
    output.close();Note: the variable JobProcess should be renamed to jobProcess. The Java convention is to use uppercase for class names.

Maybe you are looking for

  • Table to find spool details

    hello Gurus! I have to list which Invoice has been printed out and which one has been mailed and to whom . could you please sugggest me how to proceed with this, i mean which table is it that could store theese spool details, all suggestion would be

  • Get rid of the GPT-table and OSX

    I have run out of patience with the limitations of the GPT layout of my Macbook's hard disk. I would like to go back to Linux-only and get rid of OSX. My current layout is the following sda1: GPT layout table (afaik) sda2: OSX sda3: Arch / (also grub

  • Remove border in list box

    Hi, Is there any way to remove the frame around the active row of list box in  CVI 5? J Attachments: lstbxctl.gif ‏3 KB

  • Procedures in dataTriggers?

    I seem to recall reading this somewhere, but can't find an answer anymore. Is it possible to call a procedure within a package used in a dataTrigger? or can I only call a function? Thanks.

  • Slow and unresponsive after iOS4 update

    While the new features are nice, the slow down is not. My 3G now seems slow and unresponsive in all Apps and generally. Not very happy with that to be honest, don't see why it should be slower.