473,322 Members | 1,690 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Sun Java System Application Server help..

jeffbroodwar
118 100+
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.String AddProduct(String description, int rprice) throws java.rmi.RemoteException
{

ResultSet rs;
String cmd;

try
{
cmd = "Select * from tblproduct";
rs=stmt.executeQuery(cmd);
rs.moveToInsertRow();
rs.updateString("description", description);
rs.updateInt("rprice", rprice);
rs.insertRow();

return "Successful";

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

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

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

}

==================================================
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 2331
r035198x
13,262 8TB
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.String AddProduct(String description, int rprice) throws java.rmi.RemoteException
{

ResultSet rs;
String cmd;

try
{
cmd = "Select * from tblproduct";
rs=stmt.executeQuery(cmd);
rs.moveToInsertRow();
rs.updateString("description", description);
rs.updateInt("rprice", rprice);
rs.insertRow();

return "Successful";

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

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

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

}

==================================================
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 100+
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
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...
0
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...
0
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...
11
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...
1
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...
0
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...
2
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...
2
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: ...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.