Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

Java Application error


  • Please log in to reply

#1
radhikag

radhikag

    New Member

  • Member
  • Pip
  • 2 posts
My java application inserts a record into Table A. There is a trigger on this table which in turn calls a COBOL program.
My java application waits till the trigger compltes its job and as a result it hangs my application.
Please give me a solution wherein I do my table insert and my java application control gets back immediately.

Thank
Radhika
  • 0

Advertisements


#2
DragonMaster Jay

DragonMaster Jay

    Member

  • Banned
  • PipPipPip
  • 826 posts
Is Java up to date with the latest version?

Older versions have vulnerabilities.

Edited by DragonMaster Jay, 04 June 2009 - 11:05 AM.

  • 0

#3
DragonMaster Jay

DragonMaster Jay

    Member

  • Banned
  • PipPipPip
  • 826 posts
Oh and welcome :) to Geeks to Go!
  • 0

#4
radhikag

radhikag

    New Member

  • Topic Starter
  • Member
  • Pip
  • 2 posts
This is on Java 1.4 and my database is DB2.
  • 0

#5
DragonMaster Jay

DragonMaster Jay

    Member

  • Banned
  • PipPipPip
  • 826 posts
Please see this page for Update 1.4.2 http://java.sun.com/...1.4.2/index.jsp (Read the red box only)

Verify Java: http://java.com/en/d...?...t=jre&try=1

Get latest update.
  • 0

#6
stettybet0

stettybet0

    Trusted Tech

  • Technician
  • 2,579 posts
Updating Java will not help with the user's problem in the slightest. It isn't a bad idea in general, as newer versions bring new features and better security, but I'd recommend that the user gets the latest version of Java, which is Java 6 Update 14 (1.6.0_14).

radhikag, we may be able to better help you if you could provide us with a bit more information. Why do you want your Java application to get control instead of the COBOL program? What does the COBOL program do? Any other information you could provide would also be helpful.

Edited by stettybet0, 05 June 2009 - 02:15 PM.

  • 0

#7
DragonMaster Jay

DragonMaster Jay

    Member

  • Banned
  • PipPipPip
  • 826 posts
I have fixed Java app issues by upgrading Java before. It should work. :)
  • 0

#8
stettybet0

stettybet0

    Trusted Tech

  • Technician
  • 2,579 posts
Have you read what the user stated his/her problem was? Explain to me how simply updating Java would remedy his/her issue.

I mean, it would be nice if code magically wrote itself when you updated Java, but it doesn't.
  • 0

#9
diabillic

diabillic

    Member 1K

  • Member
  • PipPipPipPip
  • 1,370 posts

Have you read what the user stated his/her problem was? Explain to me how simply updating Java would remedy his/her issue.

I mean, it would be nice if code magically wrote itself when you updated Java, but it doesn't.


I agree, the error lies within the coding of the app. As I am no programmer of any sort, I will try to research a bit to see if I can provide a solution.
  • 0

#10
DragonMaster Jay

DragonMaster Jay

    Member

  • Banned
  • PipPipPip
  • 826 posts
I studied Java for quite a while. COBOL is an older programming language, so a switch to newer methods would eliminate the bug. I gathered some example info from the DB of examples I have:


Is this familiar (just an example on doing tables from here):
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
import javax.swing.event.*;
 
public class GinTable extends JFrame{
	Container container;
	JTable table;
	JScrollPane scrollPane;
	JButton button;
 
	public GinTable () {
		super ("GinTable");
		container = this.getContentPane ();
 
		String [] columnTitles = {
			"Player name", "Game 1 Score"};
		Object[][] dataEntries =	{
									{"Lynne", new Integer (1),new Integer(2)},
									{"Dan", new Integer (1),new Integer(2)}, 
									{"push button for total:",null}
									};
 
 
		TableModel model = new EditableTableModel (columnTitles, dataEntries);
		table = new JTable(model);
		table.createDefaultColumnsFromModel();
 
		JButton button = new JButton("Calculate Score");
		button.setPreferredSize(new Dimension(100,25));
 
		GridLayout grid = new GridLayout(0,1, 10,10);
		container.setLayout(grid);
 
		container.add(new JScrollPane(table));
 
 
		container.add(button);
		button.addActionListener(new ButtonL ());
		addWindowListener (new WindowEventHandler ());
		setDefaultCloseOperation (WindowConstants.DISPOSE_ON_CLOSE);
		setBackground (Color.white);
		setSize(350, 300);
		show();
 
	} //end of constructor method
 
	class WindowEventHandler extends WindowAdapter { // inner class for window events
 
		public void windowClosing (WindowEvent evt) {
			System.exit (0);
 
		}//End of sytem exit methdo
 
 
 
	} //end of WindowEventHandler inner class
 
 
	class ButtonL implements ActionListener // inner class for button
	{
		public void actionPerformed (ActionEvent e) {
			//example: add the scores
			int total=0;
			int tableLength = table.getRowCount();
			for (int i=0;i<tableLength-1;i++) {
				//use the getValueAt() method:
				total+=((Integer)(table.getValueAt(i,1))).intValue();
			}		
			//This is how to use the setValueAt() method, where
			//"new Integer(total)" is the wrapper, 
			//"tableLength" is the row # and 1 is the column #:
			table.setValueAt(new Integer(total),tableLength-1,1);
			//IMPORTANT: now tell the JTable to update its view:
			((AbstractTableModel)( table.getModel())).fireTableChanged(null); 
			// what code here to change the values in "dataentries" 
			//or to access the For other calculations??
 
		};
	} // end of button class
 
	public static void main (String [ ] args ) { // start of main method
 
		GinTable frame = new GinTable();
	}//end of main method
 
 
	public class EditableTableModel extends AbstractTableModel // inner class for editableTableModel
	{
		String[] columnTitles;
		Object [][] dataEntries;
		int rowCount;
 
		public EditableTableModel (String [] columnTitles, Object[][] dataEntries) {
			this.columnTitles = columnTitles;
			this.dataEntries = dataEntries;
		} // end of editmethod constructor
		public int getRowCount () {
			return dataEntries.length;
		} //end getRowcount
		public int getColumnCount() { 
			return columnTitles.length;
		} //end Columncount
 
		public Object getValueAt(int row, int column) {
			return dataEntries[row][column];
		}
 
		public String getColumnName (int column) {
			return columnTitles[column];
		}
 
		public Class getColumnClass (int column) {
			return getValueAt(0,column).getClass();
		}
 
		public boolean isCellEditable(int row,int column) {
			return true;
		}
 
		public void setValueAt(Object value, int row,int column) {
			dataEntries[row][column] = value;
		}
	} //end of inner class EditableTableModel
} // end of class

(Upgrading Java was only asked for so it can optimize the performance. Not just to throw out some fix.)

Edited by DragonMaster Jay, 06 June 2009 - 12:37 AM.

  • 0

#11
stettybet0

stettybet0

    Trusted Tech

  • Technician
  • 2,579 posts

COBOL is an older programming language, so a switch to newer methods would eliminate the bug.

Updating Java would not update COBOL. Updating Java would not change the user's code (or "methods") at all. Updating Java is not an acceptable fix for the user's problem.
  • 0

#12
diabillic

diabillic

    Member 1K

  • Member
  • PipPipPipPip
  • 1,370 posts

I studied Java for quite a while. COBOL is an older programming language, so a switch to newer methods would eliminate the bug. I gathered some example info from the DB of examples I have:


Is this familiar (just an example on doing tables from here):

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
import javax.swing.event.*;
 
public class GinTable extends JFrame{
	Container container;
	JTable table;
	JScrollPane scrollPane;
	JButton button;
 
	public GinTable () {
		super ("GinTable");
		container = this.getContentPane ();
 
		String [] columnTitles = {
			"Player name", "Game 1 Score"};
		Object[][] dataEntries =	{
									{"Lynne", new Integer (1),new Integer(2)},
									{"Dan", new Integer (1),new Integer(2)}, 
									{"push button for total:",null}
									};
 
 
		TableModel model = new EditableTableModel (columnTitles, dataEntries);
		table = new JTable(model);
		table.createDefaultColumnsFromModel();
 
		JButton button = new JButton("Calculate Score");
		button.setPreferredSize(new Dimension(100,25));
 
		GridLayout grid = new GridLayout(0,1, 10,10);
		container.setLayout(grid);
 
		container.add(new JScrollPane(table));
 
 
		container.add(button);
		button.addActionListener(new ButtonL ());
		addWindowListener (new WindowEventHandler ());
		setDefaultCloseOperation (WindowConstants.DISPOSE_ON_CLOSE);
		setBackground (Color.white);
		setSize(350, 300);
		show();
 
	} //end of constructor method
 
	class WindowEventHandler extends WindowAdapter { // inner class for window events
 
		public void windowClosing (WindowEvent evt) {
			System.exit (0);
 
		}//End of sytem exit methdo
 
 
 
	} //end of WindowEventHandler inner class
 
 
	class ButtonL implements ActionListener // inner class for button
	{
		public void actionPerformed (ActionEvent e) {
			//example: add the scores
			int total=0;
			int tableLength = table.getRowCount();
			for (int i=0;i<tableLength-1;i++) {
				//use the getValueAt() method:
				total+=((Integer)(table.getValueAt(i,1))).intValue();
			}		
			//This is how to use the setValueAt() method, where
			//"new Integer(total)" is the wrapper, 
			//"tableLength" is the row # and 1 is the column #:
			table.setValueAt(new Integer(total),tableLength-1,1);
			//IMPORTANT: now tell the JTable to update its view:
			((AbstractTableModel)( table.getModel())).fireTableChanged(null); 
			// what code here to change the values in "dataentries" 
			//or to access the For other calculations??
 
		};
	} // end of button class
 
	public static void main (String [ ] args ) { // start of main method
 
		GinTable frame = new GinTable();
	}//end of main method
 
 
	public class EditableTableModel extends AbstractTableModel // inner class for editableTableModel
	{
		String[] columnTitles;
		Object [][] dataEntries;
		int rowCount;
 
		public EditableTableModel (String [] columnTitles, Object[][] dataEntries) {
			this.columnTitles = columnTitles;
			this.dataEntries = dataEntries;
		} // end of editmethod constructor
		public int getRowCount () {
			return dataEntries.length;
		} //end getRowcount
		public int getColumnCount() { 
			return columnTitles.length;
		} //end Columncount
 
		public Object getValueAt(int row, int column) {
			return dataEntries[row][column];
		}
 
		public String getColumnName (int column) {
			return columnTitles[column];
		}
 
		public Class getColumnClass (int column) {
			return getValueAt(0,column).getClass();
		}
 
		public boolean isCellEditable(int row,int column) {
			return true;
		}
 
		public void setValueAt(Object value, int row,int column) {
			dataEntries[row][column] = value;
		}
	} //end of inner class EditableTableModel
} // end of class

(Upgrading Java was only asked for so it can optimize the performance. Not just to throw out some fix.)


If you studied Java, you shouldnt have known that updating would not fix the problem!

Im still seeing if I can find a solution for your problem. Did you write the code that your trying to run?
  • 0

#13
DragonMaster Jay

DragonMaster Jay

    Member

  • Banned
  • PipPipPip
  • 826 posts
To stettybet0, and Cilix.

It would optimize the App. No it was not a fix for the user, and no it will not "update" COBOL.

COBOL is object oriented form of language that appeared first in 1959. COBOL is a standard language that can be featured in Java programming. As it is a standard, active programming language, COBOL can be integrated easily in other languages, because it is one of the oldest.

In no way did I say that was a fix for the user's issue, and in no way does it help to keep bringing that up. It did take quite a while to gather that code, so go easy on me.
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP