Parsing Data recieved from Socket
I am Recieveing Data from Socket
BufferdReader bfReader = new BufferedReader(new InputStreamReader(requestSocket.getInputStream()));
from sender side i am sending it using C# Application by Creating DataTable and Populating it(it has 6 columns) and then using its writexml function i write xml to stringwriter object and then converting it to string and sending on socket.
How can i parse it here and get individual values of columns by name here for each row sent from there.
Edited by: Naseerqau on May 27, 2010 5:26 AM
Here is input which i am sending on socket
DataTable dtAlerts = new DataTable("Alerts");
dtAlerts.Columns.Add("Alert_Code");
dtAlerts.Columns.Add("Alert_Message");
dtAlerts.Columns.Add("USER_IP");
dtAlerts.Columns.Add("USER_ID");
dtAlerts.Columns.Add("Link");
dtAlerts.Columns.Add("Image_Path");
dtAlerts.Columns.Add("System_Name");
dtAlerts.Rows.Add(1,"Message1","127.0.0.1","mad","http://forums.sun.com","imgepath","made");
using (StringWriter sw = new StringWriter())
dtAlerts.WriteXml(sw);
Message = sw.ToString();
sw.Dispose();
BWrite(Message); // BWriter is a Binary Witer
now i want to get these paramerte on other side and stoer each seperately in respective variables
code i am using is
Socket requestSocket = openSocket(address, port);
DocumentBuilderFactory docFactory1 = DocumentBuilderFactory.newInstance();
DocumentBuilder Builder1 = docFactory1.newDocumentBuilder();
One///
inStream = new BufferedInputStream(requestSocket.getInputStream());
Document doc1 = Builder1.parse(inStream);
Or //
Document doc1 = Builder1.parse(requestSocket.getInputStream());
but on both methods i am getting the exception i posted earlier
Now i am lost and dont know what to do
Similar Messages
-
CTRL-M (^M) characters in data read from sockets
Hi,
We have developed a software applications which opens upto 300 TCP connections and 4000 UDP sockets. The data from the TCP application is multiplexed to UDP sockets and viceversa.
We connect to the application using a TCP socket and send certain data to the application which in turns sends this data to all the 4000 UDP sockets. The data received from 4000 UDP sockets is in turn sent back to the TCP socket as responses.
We used telnet to connecct to thespecific TCP port on our application, sent a request to be sent to all 4000 UDP sockets and noticed ctrl-M characters in the data received from TCP socket. However we are sure we are not appending or adding this ctrl-m character while sending the data on TCP socket.
telnet host port >/tmp/abc
send a request
send next request
(after 10 mins, close connection)
cat -vet /tmp/abc >/tmp/xyz
There are ctrl-m characters in /tmp/xyz.
^M is observed only at the end of few lines and not on all lines. Successive repeatition of this test generates ^M in different lines but at the end of the line always.
Can anybody help me to know why these ^M characters are getting generated?
Note: We are completely working on Solaris and do not move contents across Windows and Unix. Our application is completely written on C++
Thanks.
Message was edited by:
shekhnamI think I've misunderstood something here. The problem you're having is with the response being filtered by Telnet or your client, not what telnet is sending to the server?
In that case I think the explanation is clear. Telnet is trying to display what comes back on a screen, and it is deleting and inserting newlines every now and then according to its internal whim so as to make the data wrap. I don't know if you can control that, but I also don't know if it matters as long as you have your own client application. You just have to stop treating Telnet as a viable test client. -
Create Back ground job for data recieved from a legacy system
Hi All,
I have a requirement where i need to schedule a back ground job once a proxy is triggered for the address data sent from a Legacy system. This proxy is triggerred from SAP PI, then i need to create a job shedule where address data is created as BP's(Business Partners) and assigned to a already created Target Group. Then once the Target group is completed with all BP needs to assigned to aCampaign Id. As the data is large it takes lot of time to execute. Please Advice.
Regards,
Nagesh ThanneeruHi
If you can divide the data into two internal tables and later collect into the one internal table, this could solve yuor problem.
Also you need to make sure that enough memory is available in the system. Check DB6cockpit for that.
Also there are a lot of correction notes available with SAP for the error"TSV_TNEW_BLOCKS_NO_ROLL_MEMORY"
Check what the job exactly does, and search for the relevant notes, as there are different notes for different application areas...
if its a loading job(Infopackage) you can reduce the data packet size of the IP, but that might hamper the loading performance.
Hope this helps
Regards
Shilpa -
How to modify data recieved from the database and displayed in a DG
Hello, it's me again with a simple question :
i've got the SQLi request who returns multiples rows.
In this row i have for example :
Reward --> 1
How to, instead of displaying 1 in the datagrid, change this value to "YES"
I follow this lead :
private function onResultStats(event:ResultEvent):void
ServerStatsArr = new ArrayCollection(event.result.source);
for (var i:int=0; i < ServerStatsArr.length;i++)
if (ServerStatsArr[i].abonnement == 304){
ServerStatsArr[i].abonnement = 'Premium';
}else{
ServerStatsArr[i].abonnement = 'Non';
if (ServerStatsArr[i].transparence == 1) {
ServerStatsArr[i].transparence = 'Oui' ;
}else{
ServerStatsArr[i].transparence = 'Non' ;
ServerStatsArr.refresh();
Why this method is working for abonnement when (ServerStatsArr[i].abonnement == 304) it displays Premium but it's NOT working for transparence ?
i tested (ServerStatsArr[i].transparence == 1) and (ServerStatsArr[i].transparence == '1')
Thank youhi Again,
private function setLabel(item:Object,column:DataGridColumn):String
switch(column.dataField)
case "transparence":
if (item.transparence == "1")
return ("yes")
else
return ("no")
break;
case "abonnement":
if (item.abonnement == "304")
return ("premium")
else
return ("none")
break;
default:
return("");
and the adjustments to your grid - add the labelfunction to the following columns
<mx:DataGridColumn headerText="transparence" dataField="transparence" labelFunction="setLabel"/>
<mx:DataGridColumn headerText="abonnement" dataField="abonnement" labelFunction="setLabel" />
I hope we get a distinction credit for this assignment ...
David. -
JTable Refreshing problem for continuous data from socket
Hi there,
I am facing table refreshing problem. My table is filled with the data received from socket . The socket is receiving live data continuously. When ever data received by client socket, it notify table model to parse and refresh the data on specific row. The logic is working fine and data is refresh some time twice or some thrice, but then it seem like java table GUI is not refreshing. The data on client socket is continuously receiving but there is no refresh on table. I am confident on logic just because when ever I stop sending data from server, then client GUI refreshing it self with the data it received previous and buffered it.
I have applied all the available solutions:
i.e.
- Used DefaultTableModel Class.
- Created my own custem model class extend by AbstractTableModel.
- Used SwingUtilities invokeLater and invokeAndWait methods.
- Yield Stream Reader thread so, that GUI get time to refresh.
Please if any one has any idea/solution for this issue, help me out.
Here is the code.
Custom Data Model Class
package clients.tcp;
import java.util.*;
import javax.swing.table.*;
import javax.swing.*;
public class CustomModel extends DefaultTableModel implements Observer {
/** Creates a new instance of CustomModel */
public CustomModel() {
//super(columnNames,25);
String[] columnNames = {"Sno.","Symbol","BVol","Buy","Sale",
"SVol","Last","..","...","Total Vol...",
"..","High","..","Low","Change","Average","..."};
super.setColumnIdentifiers(columnNames);
super.setRowCount(25);
/*This method called by client socket when ever it recived data as line/record*/
public synchronized void update(Observable o, Object arg){
collectData(arg.toString());
/*This method used to parse, collect and notify table for new data arrival*/
public synchronized void collectData(String rec){
String validSymbol="";
System.out.println("collectDataRecord :-"+rec);
StringTokenizer recToken=new StringTokenizer(rec," ");
Vector rowVector=new Vector();
for(int i=0;i<25;i++){
validSymbol=(String)getValueAt(0,1);
if(rec.indexOf(validSymbol) != -1){
for(int j=0;recToken.hasMoreTokens();j++){
super.setValueAt(recToken.nextToken(),i,j);
//break;
Client Socket Class
package clients.tcp;
import java.io.*;
import java.net.*;
import java.util.*;
import javax.swing.*;
public class DataReceiver extends Observable implements Runnable{
private Socket TCPConnection = null;
private BufferedReader br = null;
private String serverName = "Salahuddin";
private int serverPort = 5555;
public DataReceiver()
public void setServerName(String name){
this.serverName=name;
public void setServerPort(int port){
this.serverPort=port;
//03-20-04 12:30pm Method to open TCP/IP connection
public void openTCPConnection()
try
TCPConnection = new Socket(serverName, serverPort);
br = new BufferedReader(new InputStreamReader(
TCPConnection.getInputStream()));
System.out.println("Connection open now....");
//System.out.println("value is: "+br.readLine());
}catch (UnknownHostException e){
System.err.println("Don't know about host: ");
}catch (IOException e){
System.err.println("Couldn't get I/O for "
+ "the connection to: ");
//03-20-04 12:30pm Method to receive the records
public String receiveData(){
String rec = null;
try
rec = br.readLine();
catch(IOException ioe)
System.out.println("Error is: "+ioe);
ioe.printStackTrace(System.out);
catch(Exception ex)
System.out.println("Exception is: "+ex);
ex.printStackTrace(System.out);
return rec;
public void run()
while(true)
String str=null;
str = receiveData();
if(str != null)
/*try{
final String finalstr=str;
Runnable updateTables = new Runnable() {
public void run() { */
notifyAllObservers(str);
SwingUtilities.invokeAndWait(updateTables);
}catch(Exception ex){
ex.printStackTrace(System.out);
System.out.println("Observer Notified...");*/
try{
Thread.sleep(200);
}catch(Exception e){
public synchronized void notifyAllObservers(String str){
try{
setChanged();
notifyObservers(str);
}catch(Exception e){
e.printStackTrace(System.out);
Regards,
Salahuddin Munshi.use your code to post codes more easy to read, lyke this:
package clients.tcp;
import java.util.*;
import javax.swing.table.*;
import javax.swing.*;
public class CustomModel extends DefaultTableModel implements Observer {
/** Creates a new instance of CustomModel */
public CustomModel() {
//super(columnNames,25);
String[] columnNames = {"Sno.","Symbol","BVol","Buy","Sale",
"SVol","Last","..","...","Total Vol...",
"..","High","..","Low","Change","Average","..."};
super.setColumnIdentifiers(columnNames);
super.setRowCount(25);
/*This method called by client socket when ever it recived data as line/record*/
public synchronized void update(Observable o, Object arg){
collectData(arg.toString());
/*This method used to parse, collect and notify table for new data arrival*/
public synchronized void collectData(String rec){
String validSymbol="";
System.out.println("collectDataRecord :-"+rec);
StringTokenizer recToken=new StringTokenizer(rec," ");
Vector rowVector=new Vector();
for(int i=0;i<25;i++){
validSymbol=(String)getValueAt(0,1);
if(rec.indexOf(validSymbol) != -1){
for(int j=0;recToken.hasMoreTokens();j++){
super.setValueAt(recToken.nextToken(),i,j);
//break;
Client Socket Class -
I am working with a canon XHA1 and as of late I have been getting an error that says no data recieved from camera. I will get around 7 seconds of tape then it errors out. I tried running on both Vegas 11 and HDV split. I have made sure my connections are tight and checked my after market fire wire card. Can anyone please give me hand.?
Hello BSA,
You mention using an aftermarket firewire card. Depending on how this is connected, if it's internal or external, may affect the connection. If your system has an onboard card you should try using this over the aftermarket one.
If you own another computer it would be a a good thing to check to ensure that the firewire out on the camcorder is working as it should. Another firewire cable should also be used for the purposes of testing the connection.
If this is a time sensitive-matter, additional support options are available through our Support Site. Please use this to Contact Us.
Did this answer your question? Please click the Accept as Solution button so that others may find the answer as well. -
XI to jdbc error: No more data to read from socket
i have a XI to JDBC scenario, where a receiver JDBC communication channel sends a query to the database, i get an error in the response (from database) as:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <!-- Call Adapter
-->
- <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
<SAP:Category>XIAdapterFramework</SAP:Category>
<SAP:Code area="MESSAGE">GENERAL</SAP:Code>
<SAP:P1 />
<SAP:P2 />
<SAP:P3 />
<SAP:P4 />
<SAP:AdditionalText>com.sap.aii.af.ra.ms.api.DeliveryException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'NAME' (structure 'STATEMENT'): java.sql.SQLException: No more data to read from socket</SAP:AdditionalText>
<SAP:ApplicationFaultMessage namespace="" />
<SAP:Stack />
<SAP:Retry>M</SAP:Retry>
</SAP:Error>Hi Sudeep,
This error most likely occurs when you use DB connection pool, which I think is the case in XI. When the JDBC adapter tries to connect to the database and discovers that the connection has been timed out/lost, then this exception is generated. Please have a look of the connection settings of your JDBC adapter and also at the note 831162.
Cheers...
Vasu
<b>** REward POInts if found useful **</b> -
NIO Socket implementation - delay between select and get data from socket
Hi all,
I have implemented a internal CallAPI for RPC over a socket connection. It works fine but if there are more than five clients and some load I have the phenomena that the READ selector returns a SelectorKey but I did not get any data from the socket.
My implementation is based on NIO has following components:
+ Accept-Thread
Thread handles new clients.
+ Read-Thread
Thread handles the data from the socket for the registered client. Each request is handled in an own Process-Thread. A Thread-Pool implementation is used for processing.
+ Process-Thread
The Process-Thread reads the data from the socket and starts the processing of the logical request.
In my tests I get the notification of data at the socket. The Process-Thread want to read the data for the socket, but no data are available. In some situations if have to read about 20 times and more to get the data. Between each read attempt I have inserted a sleep in the Process-Thread if no data was available. This have improved the problem, but it already exists. I tested the problem with several systems and jvm's but it seams that it is independent from the system.
What can I to do improve the situation?
I already include the read implementation from the grizzly-Framework. But it doesn't improve the situation.
Socket - Init
protected void openSocket( String host, int port ) throws IOException
serverChannel = ServerSocketChannel.open();
serverChannel.configureBlocking( false );
serverSocket = serverChannel.socket();
serverSocket.setReuseAddress( true );
this.serverhost = host;
this.serverport = port;
this.srvAcceptSelector = Selector.open();
this.srvReadSelector = Selector.open();
InetSocketAddress isa = null;
if ( serverhost != null )
isa = new InetSocketAddress( this.serverhost, this.serverport );
else
isa = new InetSocketAddress( this.serverport );
serverSocket.bind( isa, 50 );
serverChannel.register( this.srvAcceptSelector, SelectionKey.OP_ACCEPT );
}New Client � Init
// New Client
if ( key.isAcceptable())
keyCountConnect++;
ServerSocketChannel actChannel =
(ServerSocketChannel) key.channel();
// Socket akteptieren
SocketChannel actSocket = actChannel.accept();
if ( actSocket != null )
actSocket.finishConnect();
actSocket.configureBlocking( false );
actSocket.socket().setTcpNoDelay( true );
this.registerSocketList.add( actSocket );
this.srvReadSelector.wakeup();
}Read Data from Socket
protected int readDatafromSocket( ByteArrayOutputStream socketdata )
throws IOException
int readedChars = 0;
int count = -1;
Selector readSelector = null;
SelectionKey tmpKey = null;
if ( sc.isOpen())
ByteBuffer inputbuffer = null;
try
inputbuffer = bufferpool.getBuffer();
while (( count = sc.read( inputbuffer )) > 0 )
readedChars += count;
inputbuffer.flip();
byte[] tmparray=new byte[inputbuffer.remaining()];
inputbuffer.get( tmparray );
socketdata.write( tmparray );
inputbuffer.clear();
if ( count < 0 )
this.closeSocket();
if( readedChars == 0 )
readedChars = -1;
if ( log.isDebug())
log.debug( "Socket is closed! " );
else if ( readedChars == 0 )
if ( log.isDebug())
log.debug( "Reread with TmpSelector" );
// Glassfish/Grizzly-Implementation
readSelector = SelectorFactory.getSelector();
if ( readSelector == null )
return 0;
count = 1;
tmpKey = this.sc.register( readSelector, SelectionKey.OP_READ );
tmpKey.interestOps(
tmpKey.interestOps() | SelectionKey.OP_READ );
int code = readSelector.select( 500 );
tmpKey.interestOps(
tmpKey.interestOps() & ( ~SelectionKey.OP_READ ));
if ( code == 0 )
return 0;
// Return on the main Selector and try again.
while (( count = sc.read( inputbuffer )) > 0 )
readedChars += count;
inputbuffer.flip();
byte[] tmparray=new byte[inputbuffer.remaining()];
inputbuffer.get( tmparray );
socketdata.write( tmparray );
inputbuffer.clear();
if ( count < 0 )
this.closeSocket();
if( readedChars == 0 )
readedChars =-1;
else if ( count == 0 )
// No data
finally
if ( inputbuffer != null )
bufferpool.releaseBuffer( inputbuffer );
inputbuffer = null;
// Glassfish-Implementierung
if ( tmpKey != null )
tmpKey.cancel();
if ( readSelector != null)
// Bug 6403933
try
readSelector.selectNow();
catch (IOException ex)
SelectorFactory.returnSelector( readSelector );
return readedChars;
}Thanks for your time.I've commented on that blog before. It is rubbish:
- what does 'overloading the main Selector' actually mean? if anything?
- 'Although this not clearly stated inside the NIO API documentation': The API documentation doesn't say anything about which Selector you should register channels with. Why would it? Register it with any Selector you like ...
- 'the cost of maintaining multiple Selectors can reduce scalability instead of improving it' Exactly. So what is the point again?
- 'wrapping a ByteBuffer inside a ByteBufferInputStream:' Code is rubbish and redundant. java.nio.channels.Channels has methods for this.
There is no a priori advantage to using multiple Selectors and threads unless you have multiple CPUs. And even then not much, as non-blocking reads and writes don't consume significant amounts of CPU. It's the processing of the data once you've got it that takes the CPU, and that should be done in a separate thread.
So I would re-evaluate your strategy. I suspect you're getting the channel registered with more than one Selector at a time. Implement it the simple way first then see if you really have a problem with 'overloading the main Selector' ... -
How do i parse data from the second jframe back to the first?
Hello.
I have a jFrame were I promt users to keep a list of Names in a jTable. (I keep data for something else, but lets say names.. ) Anyway, afterwords I want to add some extra parameters for each name. So I created a new frame, which is opened when user press an Edit button. The new frame opens and users can add for the specific name some extra data, like age, height, color, sex.. etc. that characterizes this person.
On this second form i have a save button, which when its pressed i would like to keep this information for this name, so as when user press edit again from the first frame on the same Name the data that previously entered will be loaded (lets say that the user can not enter the say name again)
I haven' t figured the code for the save Button, but with the rest I am fine.
Can you give any ideas with structures that I have to use and how the action listener will have to be??
When I set visible the new form i have made a constructor that loads the new form which have a label with the name of the person that is edited., but how do i parse data from the second form back to the first that is already opened??
Thanks very much..I found it.. it was not so hard afterall..
anyway, i quote the new code..
package namelist;
// Java core packages
import java.awt.event.*;
import java.util.*;
// Java extension packages
import javax.swing.*;
import javax.swing.table.*;
public class NamesGUI extends javax.swing.JFrame {
//Variables for managing the jTables
DefaultTableModel tableModel;
Vector rows,cols;
String[] colName1 = {"List of Names"};
ManageJTables mJT = new ManageJTables();
Hashtable h;
/** Creates new form ProsAgentGUI */
public NamesGUI() {
h = new Hashtable();
initComponents();
/** 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.
private void initComponents() {
Panel = new javax.swing.JPanel();
ToolBar = new javax.swing.JToolBar();
ADD = new javax.swing.JButton();
EDIT = new javax.swing.JButton();
REMOVE = new javax.swing.JButton();
jButton1 = new javax.swing.JButton();
TScrollPane = new javax.swing.JScrollPane();
Table = new javax.swing.JTable();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Names");
setBackground(new java.awt.Color(0, 51, 51));
Panel.setBorder(javax.swing.BorderFactory.createTitledBorder("List of Names"));
ToolBar.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
ADD.setText("ADD");
ADD.setToolTipText("");
ADD.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
ADD.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ADDActionPerformed(evt);
ToolBar.add(ADD);
EDIT.setText("EDIT");
EDIT.setToolTipText("");
EDIT.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
EDIT.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
EDITActionPerformed(evt);
ToolBar.add(EDIT);
REMOVE.setText("REMOVE");
REMOVE.setToolTipText("");
REMOVE.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
REMOVE.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
REMOVEActionPerformed(evt);
ToolBar.add(REMOVE);
jButton1.setText("jButton1");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
ToolBar.add(jButton1);
rows=new Vector();
cols= new Vector();
cols=mJT.addColumns(colName1, cols);
tableModel =new DefaultTableModel();
tableModel.setDataVector(rows,cols);
Table.setModel(tableModel);
TScrollPane.setViewportView(Table);
org.jdesktop.layout.GroupLayout PanelLayout = new org.jdesktop.layout.GroupLayout(Panel);
Panel.setLayout(PanelLayout);
PanelLayout.setHorizontalGroup(
PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(ToolBar, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 210, Short.MAX_VALUE)
.add(TScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 210, Short.MAX_VALUE)
PanelLayout.setVerticalGroup(
PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(PanelLayout.createSequentialGroup()
.add(ToolBar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 34, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(TScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE))
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(Panel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
.addContainerGap(29, Short.MAX_VALUE)
.add(Panel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
pack();
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
System.out.println(h.toString());
public void updateNamesTable (int id, String na){
Integer i2 = new Integer(id);
Object o2 = (Object)i2;
if (h.containsKey(o2)){
Name a = (Name)h.get(o2);
a.name = na;
h.put(o2,a);
else {
Name aa = new Name();
aa.name=na;
h.put(o2,(Object)aa);
private void EDITActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String name = Table.getValueAt(Table.getSelectedRow(),0).toString();
int rowNum= Table.getSelectedRow();
Integer i = new Integer(rowNum);
Object o = (Object)i;
updateNamesTable (rowNum, name);
//public NameEditor(Name n, Hashtable h, int id)
NameEditor re = new NameEditor((Name)h.get(o), h, rowNum );
re.setVisible(true);
private void REMOVEActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
mJT.deleteRow(Table.getSelectedRow(), rows, Table);
private void ADDActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
mJT.addRow(rows, Table);
* @param args the command line arguments
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new NamesGUI().setVisible(true);
// Variables declaration - do not modify
javax.swing.JButton ADD;
javax.swing.JButton EDIT;
javax.swing.JPanel Panel;
javax.swing.JButton REMOVE;
javax.swing.JScrollPane TScrollPane;
javax.swing.JTable Table;
javax.swing.JToolBar ToolBar;
javax.swing.JButton jButton1;
// End of variables declaration
public class NameEditor extends javax.swing.JFrame {
Hashtable h;
Name n;
int id;
/** Creates new form NameEditor */
public NameEditor() {
initComponents();
public NameEditor(Name n, Hashtable h, int id) {
this.h=h;
this.n=n;
this.id=id;
initComponents();
NameField.setText(n.name);
jTextField2.setText(n.weight);
jTextField1.setText(n.height);
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
/** 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.
private void initComponents() {
NameLabel = new javax.swing.JLabel();
NameField = new javax.swing.JTextField();
SaveBut = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Name Editor");
getAccessibleContext().setAccessibleName("Name Editor");
NameLabel.setText("Name: ");
NameField.setEditable(false);
NameField.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
NameFieldActionPerformed(evt);
SaveBut.setText("SAVE");
SaveBut.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
SaveButActionPerformed(evt);
jLabel3.setText("Height");
jLabel4.setText("Weight");
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(layout.createSequentialGroup()
.addContainerGap()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(jLabel4)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED))
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jLabel3)
.add(NameLabel))
.add(16, 16, 16)))
.add(17, 17, 17)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(NameField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 138, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
.add(org.jdesktop.layout.GroupLayout.LEADING, jTextField2)
.add(org.jdesktop.layout.GroupLayout.LEADING, jTextField1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 46, Short.MAX_VALUE))))
.add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
.add(127, 127, 127)
.add(SaveBut)))
.addContainerGap())
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.addContainerGap()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(NameLabel)
.add(NameField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(30, 30, 30)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel3)
.add(jTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(12, 12, 12)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel4)
.add(jTextField2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 27, Short.MAX_VALUE)
.add(SaveBut)
.addContainerGap())
pack();
public void updateNameTable (){
Integer i2 = new Integer(id);
Object o2 = (Object)i2;
h.put(o2,n);
private void SaveButActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
n.height= jTextField1.getText();
n.weight = jTextField2.getText();
private void NameFieldActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
* @param args the command line arguments
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new NameEditor().setVisible(true);
// Variables declaration - do not modify
javax.swing.JTextField NameField;
javax.swing.JLabel NameLabel;
javax.swing.JButton SaveBut;
javax.swing.JLabel jLabel3;
javax.swing.JLabel jLabel4;
javax.swing.JTextField jTextField1;
javax.swing.JTextField jTextField2;
// End of variables declaration
} -
No more data to read from socket only in 2nd and 3rd database
Hi,
I'm developing an application for a client with three independent login modes, each one with an independent database.
I'm using the following products:
Oracle 9i database (9.2.0.6.0)
Oracle Content Management SDK 10g (9.0.4.0.0)
Oracle Workflow (2.6.3.0.0)
Oracle Application Server 10g (9.0.4.2.0)
In development, I've these products installed in x86 machines with Windows 2000. I've no problems and no errors.
In the client, I've the same products and versions but installed in a Solaris Machine and I've the following error ONLY when I use the second and the third login modes (not always, maybe only in 50% of the times I submit data in the application). In the first login mode I have no problems. The code for the different modes is essentially the same so I don't understand what is the problem. I don't have access to the client server so I can't make a debug.
The error is:
Caused by: java.sql.SQLException: No more data to read from socket
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:189)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:231)
at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:985)
at oracle.jdbc.ttc7.MAREngine.unmarshalUB1(MAREngine.java:746)
at oracle.jdbc.ttc7.MAREngine.unmarshalSB1(MAREngine.java:705)
at oracle.jdbc.ttc7.Oclose.receive(Oclose.java:105)
at oracle.jdbc.ttc7.TTC7Protocol.close(TTC7Protocol.java:565)
at oracle.jdbc.driver.OracleStatement.close(OracleStatement.java:848)
at oracle.jdbc.driver.OraclePreparedStatement.privateClose(OraclePreparedStatement.java:351)
at oracle.jdbc.driver.OraclePreparedStatement.close(OraclePreparedStatement.java:285)
at oracle.jdbc.driver.OracleCallableStatement.close(OracleCallableStatement.java:876)
at oracle.jdbc.oracore.OracleTypeADT.initMetadata(OracleTypeADT.java:579)
at oracle.jdbc.oracore.OracleTypeADT.init(OracleTypeADT.java:406)
at oracle.sql.ArrayDescriptor.initPickler(ArrayDescriptor.java:1023)
at oracle.sql.ArrayDescriptor.<init>(ArrayDescriptor.java:137)
at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:102)
I'm using oracle jdbc thin driver.
As data source class I'm using jdbc.pool.OracleConnectionCacheImpl.
Anyone have a clue what is happening?Have you resolved this? I am getting the same error, but after restarting my webserver and re-establishing my connection pools it works(for a while). I need to find the root.
Thanks for any help,
Mark -
Parsing data from Serial Port one byte at a time
Hi everyone,
What I want to do is read in from the serial port byte by byte and parse each byte that I am reading in. The size of the data read in varies. How do I do that? I can do using .dll but I want to learn how to do it in labview. I searched through the forum for something similar but no luck. I have seen some that puts the VISA read in a while loop and others that puts the property node, "bytes at Port" in a while loop. What is the difference in doing either way? I am using Labview 7.1 Can anyone point me in the right direction?
ThanksHi guys..
I'm still a beginner in using labview tcp/ip function. for now, i have a project to read the labview data with java programming language so that i can monitor that data using any devices that using java, such as PC or cell phone. my task for now is to determine the format of data that being sent (its type, length, etc), coz as far as i done until now, the data that read in the java is still a raw material so that i dont know how to gain the information from that data.
my question is :
- how does the type cast work in changing the data format from one to another?
- how does the bytes to read in tcp read work? coz when i'm changing the length of bytes to read constant from 4 bytes to another, the data is becoming mess up. As far as i know, the bytes to read only read the first "constant number" byte in the tcp read to determine the length and type of the data..
thanks -
"No more data to read from socket."?
Hi everybody,
We recently migrated from Oracle 10g Database Enterprise Edtion to Oracle 11g R2 Database Enterprise Edition
with Data Guard and a dedicated standy-by database. The database is a data source for multiple applications.
Among others, we are using two JBoss 4.2.3 GA application servers which run together in a clustered configuration.
During our migration of our database, we also updated our OJDBC thin drivers from Oracle within our JBosses. We
replaced the ojdbc14.jar with ojbc6.jar (Oracle 11g 11.1.0.7.0) and updated or added referenced libraries as well.
Since our migration we experience an unfamiliar problem from time to time. Suddenly our deployed EJBs crash with
the exception "SQLException: No more data to read from socket." The occurence is rather random than bound to
a specific bean. The only noticeable thing is that it appears more often when there is more work load on our
JBosses.
Our only solution up to now is to shutdown our JBosses, restart the database and restart our JBosses again.
Depending on our work load we do this from every two days to every 4 hours.
I googled the message and even found several hundred hits that mentioned the exception above, but none of
them got really solved, instead people found some case of work around for them. But none of them worked for us,
since this exception seems more general and can have multiple causes.
We did not have this problems when we were using the Oracle 10g database. Currently I am not sure if this problem
is related to the new Oracle 11g R2 database, the new OJDBC thin driver or JBoss.
Anybody experienced the same problem? And maybe even got it properly solved?
If you need further information, just ask. I will happily offer as much information as possible to solve this.
Greetings,
CB
Edited by: Crazy Bytes on 08.06.2010 03:10Hi,
I remember that we received similar error after upgrading the database from 9.2.0.7 to 10.2.0.4 in one of our application using JDBC 10.1.0.5. We worked with Oracle support, and they provided us with patch Patch 5851267, that resolved our problem.
So I would recommend you to do the same.
regards -
[solaris 8] Oracle 8.1.6 EE: no more data to read from socket
Hi,
I'm sorry for writing to this list, but it is the most related I could find.
I installed Oracle 8.1.6 EE on a sparc 5 with solaris 8. I had to install the thread patches for solaris 8 because the emn0 process of oracle was dying every 30 minutes.
After that, the DB seemed to work ok, but when running a heavy java process (jdbc),
the process reports "java.sql.SQLException: No more data to read from socket".
Have anyone experienced this kind of problem ?
I decided to reinstall solaris 7... Could anyone help me ? comments ? suggestions ?
Thanks in advance.
GabrielReason: the ORACLE server process crashes (sometimes), and the result is the "empty"
socket. -
Error -no more data to read from socket vendor code 17410
Hi everyone
I have installed a gateway on my server. My oracle database 11.1.0.7 is running on windows server 2008 and i am trying to connect to sql server 2005.
After creating the database link when i test the database link i get this error
no more data to read from socket vendor code 17410
can you please suggest me how to get rid of this error?????
thanks a manyenable gateway tracing by setting HS_FDS_TRCE_LEVEL=255 in your DG4MSQL configuration file. Then open a new SQL*Plus window and execute:
select user from dual@<dg4msql db link>;
A trace file is generated in the ORACLE_HOME/dg4msql/trace directory. Post its content. -
How to Parse XML data directly from context variables in webdynpro
Hello,
I have two requirements:
1) I have a context variable which has string value.
I want to write the this value into a flat file.
How do I do this in WebDynpro.
Any sample code for this.
2) In Webdynpro, I want to parse and process the XML data directly from a string context variable which
has the value in XML format.
How do I achieve this. Any pointers or sample codes for this.
Thanks and Regards,
Anupama.Anupama,
Here is some link which talks about unpacking xml and converting to HTML.
<a href="http://help.sap.com/saphelp_nw04/helpdata/en/eb/3dfb402eb5f76fe10000000a1550b0/content.htm">http://help.sap.com/saphelp_nw04/helpdata/en/eb/3dfb402eb5f76fe10000000a1550b0/content.htm</a>
I have done something like this in portal development and not in webdynpro.But in principle it should work very where.
Maybe you are looking for
-
In po i am unable 2 give frieght value 0.525.
In my po i am unable 2 give frieght value 0.525. a error msg coming that input format---- not possible. its taking only 0.52. My requirement is 0.525. Thanku Shakir
-
CheckBox in customized cell renderer - Urgent
i need to customize the cell renderer for a table for one of the columns. One of the column is Boolean type and i want it the way it comes in a default cell renderer. if i mention the renderer for the column as "checkbox" - it gives me the checkbox "
-
Iphone 4s won't boot on and itunes doens't detect it when on battery. Plug it in and Apple logo appear then disappear, try to recover, but there's a 1602 error. Is it dead?
-
Hello all, I've installed MDW on one of the desktops, with all the pre-requiestes installed before hand. Now When I try to open an laptop application on MAS, it asks for a username and pwd, with the dsn name. I select DSN : ars_db Username : arsadmin
-
Hi All, I am using Sax parser (jaxp1.1), I have directed to validate the xml using setValidating(true), even then it is not validating the data against DTD spec. PLease let me know the possible things to be checked. Thanks Sathish