473,701 Members | 2,979 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sun Java System Application Server help..

jeffbroodwar
118 New Member
i'm currently working on a project about webservices. i tried to create an ordinary service that inserts data to the database. here's the code :

=============== =============== =============== ======

// ADD PRODUCT
public java.lang.Strin g AddProduct(Stri ng description, int rprice) throws java.rmi.Remote Exception
{

ResultSet rs;
String cmd;

try
{
cmd = "Select * from tblproduct";
rs=stmt.execute Query(cmd);
rs.moveToInsert Row();
rs.updateString ("descriptio n", description);
rs.updateInt("r price", rprice);
rs.insertRow();

return "Successful ";

}
// IF ERROR OCCURS CATCH HERE. EX: SQL ERROR FROM TRY BLOCK ABOVE //
catch(SQLExcept ion e1)
{

lastErrorMessag e = "Database error occured : " + e1.getMessage() ;
return lastErrorMessag e;
}

// IF DATABASE CONNECTION PROBLEM OCCURS CATCH THEN RETURN VALUE //
catch(Exception e)
{
lastErrorMessag e = e.getMessage();
return lastErrorMessag e;
}

}

=============== =============== =============== =====
i've isolated the database connection to a different method..... please review the code.. actually if you will look at the code you won't see any error.... even if you test it, it works fine. the problem triggers when more than 1 client access the webservice. it throws an exception (null pointer exception) i think this problem is related to threading in the server / server settings. i'm using Sun Java System Application Server 9 update1 netbeans 5.5 and mysql 5.0.... please help me... any suggestions will be much appreciated.. thank you...
Mar 2 '07 #1
2 2349
r035198x
13,262 MVP
i'm currently working on a project about webservices. i tried to create an ordinary service that inserts data to the database. here's the code :

=============== =============== =============== ======

// ADD PRODUCT
public java.lang.Strin g AddProduct(Stri ng description, int rprice) throws java.rmi.Remote Exception
{

ResultSet rs;
String cmd;

try
{
cmd = "Select * from tblproduct";
rs=stmt.execute Query(cmd);
rs.moveToInsert Row();
rs.updateString ("descriptio n", description);
rs.updateInt("r price", rprice);
rs.insertRow();

return "Successful ";

}
// IF ERROR OCCURS CATCH HERE. EX: SQL ERROR FROM TRY BLOCK ABOVE //
catch(SQLExcept ion e1)
{

lastErrorMessag e = "Database error occured : " + e1.getMessage() ;
return lastErrorMessag e;
}

// IF DATABASE CONNECTION PROBLEM OCCURS CATCH THEN RETURN VALUE //
catch(Exception e)
{
lastErrorMessag e = e.getMessage();
return lastErrorMessag e;
}

}

=============== =============== =============== =====
i've isolated the database connection to a different method..... please review the code.. actually if you will look at the code you won't see any error.... even if you test it, it works fine. the problem triggers when more than 1 client access the webservice. it throws an exception (null pointer exception) i think this problem is related to threading in the server / server settings. i'm using Sun Java System Application Server 9 update1 netbeans 5.5 and mysql 5.0.... please help me... any suggestions will be much appreciated.. thank you...
Is this code in a servlet?
Mar 2 '07 #2
jeffbroodwar
118 New Member
no...i think it has something to do with the connector settings in the sun java application admin... you have there a connector settings. under it are 3 sub categories : connector resources, connector connection pools, admin object resources..... anyway it's just a wild guess, still not sure if these settings will solve my problem. any ideas? i'm using sun java application server 8.2 and mysql 5.0 thanx again... :-)
Mar 5 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

23
3651
by: BlackHawke | last post by:
Hello! This is my second post. Ppl really helped me with the first. I hope there are answers for this one as well I own a game company (www.aepoxgames.net) releasing the beta for our first sci-fi space game in about 2 weeks (www.andromedaonline.net) We have multiple servers, but the game engine (Game Server Program) is a Java program (don't ask why) on a windows 2003 enterprise system with dual
0
6810
by: Ravi Tallury | last post by:
Hi We are having issues with our application, certain portions of it stop responding while the rest of the application is fine. I am attaching the Java Core dump. If someone can let me know what the issue is. Thanks Ravi
0
2699
by: Dominique | last post by:
I am trying to communicate to a prolog server from a java client, however even though the connection is successfully made every time I try to perform QueryExecute I get an error, either Socket closed or null etc. Can anyone help? I am using SICStus prolog. Currently my prolog server looks like: :- write('starting'),nl. :- use_module(library(sockets)). :- use_module(library(prologbeans)). :- use_module(library(charsio)).
11
9254
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me understand the different ways to do the same thing in C++. I find my self sometimes, trying Object app = Object(); Object *app = Object(); Object app = new Object();
1
9638
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej and I was wondering if anyone here would be able to give me some tips for young players such as myself, for learning the language. Is this the best Newsgroup for support with JAVA?
0
5232
by: Tomek | last post by:
Welcome. I`m trying to prepere some project that shows how to use Corba technology i heterogenic systems.I`d like to create CORBA server with Borland Delphi (or C#.NET) and few client applications taht comunicate with serwer: J2ME client for WindowsCE 5.0, c# or Delphi from WindowsXP, some Web application using Java and maybe something for Linux system. For few days i`m looking for some examples in internet but most of them using only...
2
6958
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of attending interviews. If you own a company best way to judge if the candidate is worth of it. http://www.questpond.com/InterviewRatingSheet.zip
2
3978
by: astolpho | last post by:
I am using a slightly outdated reference book on J2EE programming. It gives 2 methods of creating a database used in its casestudies. The first is an ANT script that gives the following output: D:\original\CaseStudy-2-5\CaseStudy\Day02\exercise>asant database Buildfile: build.xml env-user: prop-user: set-user:
0
8737
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8649
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9084
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7827
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4411
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4665
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3104
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2399
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2036
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.