Could someone help me with this error: java.sql.SQLException: Closed Connec
My code:
<%@ include file="../setupcache.jsp"%>
<%
if(connectionPool_dig==null){
%>
<p>Could not connect to database. Please try again, thank!</p>
<%
return ;
Connection con = connectionPool_dig.getConnection();
if(con==null){
%>
<p>Could not connect to database. Please try again, thank!</p>
<%
return;
String file = request.getParameter("m_FILE");
file = "a";
String sql = " SELECT *"+
" FROM "+
" FILEUPLOAD, SUBJECT"+
" WHERE "+
" FILEUPLOAD.SUBJECTCODE = SUBJECT.CODE AND UPPER(FILEUPLOAD.FILENAME) LIKE(UPPER(?))";
PreparedStatement stmt = con.prepareStatement(sql);
stmt.setString(1,"%"+file+"%");
ResultSet rs = stmt.executeQuery();
while(rs.next()){
out.println("<br>"+rs.getString(1));
out.println("<br>"+rs.getString(2));
out.println("<br>"+rs.getString(3));
out.println("<br>"+rs.getString(4));
rs.close();
stmt.close();
try{
con.close();
}catch(SQLException e){}
%>
it usualy generate that error (once wrong then right then wrong....), but if I don't close connection (con.close), it work well. Could some one help me!
Hi,
I think that it should be better that returning the Connection
instance back to the Connection Pool. The connection
should not be close by you. it should controlled by the
connection pool mechanism. So I think that you should
check out your connection pool usage document for the
right usage.
If your code is the case, the connection in connection
pool will get less and your connection pool mechanism
may need to reallocate a new one for application. I
don't think that it is right.
good luck,
Alfred Wu
Similar Messages
-
PLEASE help me with this error java.sql.SQLException
The code
public void getInitialQuery() { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con = DriverManager.getConnection("jdbc:odbc:PDefApp1"); sta = con.createStatement(); System.out.println(SQLQuery); res = setupSQLConnection(SQLQuery); getRecordSet(res);
private void getRecordSet(ResultSet r) { try { jTextRecordNumberField.setText(String.valueOf(r.getInt("id"))); jTextFirstNameField.setText(r.getString(2)); jTextMiddleNameField.setText(r.getString(3)); jTextLastNameField.setText(r.getString(4)); jTextDateOfBirthField.setText(r.getString(5)); jTextAKAField.setText(r.getString(6)); jComboBoxChargingDocument.setSelectedItem(r.getString(7)); jTextAreaChargingNumber.setText(r.getString(8)); jComboBoxDecision.setSelectedItem(r.getString(9)); jComboBoxDefendentStatus.setSelectedItem(r.getString(10)); jComboBoxOriginatingUnit.setSelectedItem(r.getString(11)); jTextFieldApplicationDate.setText(r.getString(12)); jTextFieldDecisionDate.setText(r.getString(13)); jTextFieldDeliveryDate.setText(r.getString(14)); jTextAreaComments.setText(r.getString(15)); } catch (Exception e) { System.err.println("getRecordSet Exception: " + e.getMessage()); e.printStackTrace(); } }
The crash occurs in getRecordSet(ResultSet r) method and it occurs on ANY line. I've commented each line to see where it occurs.
The crash says the following
run: SELECT * FROM Table1 ORDER BY id ASC setupSQLQuery: SELECT * FROM Table1 ORDER BY id ASC getRecordSet Exception: [Microsoft][ODBC Driver Manager] Invalid cursor state java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6957) at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7114) at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(JdbcOdbc.java:3907) at sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(JdbcOdbcResultSet.java:5698) at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java:354) at publicdesktopapplication.PublicDesktopView.getRecordSet(PublicDesktopView.java:1411) at publicdesktopapplication.PublicDesktopView.getInitialQuery(PublicDesktopView.java:1377) at publicdesktopapplication.PublicDesktopView.<init>(PublicDefenderView.java:89) at publicdesktopapplication.PublicDesktopApplication.startup(PublicDesktopApplication.java:19) at org.jdesktop.application.Application$1.run(Application.java:171) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) at java.awt.EventQueue.dispatchEvent(EventQueue.java:597) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160) at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
I am very confused why this is crashing on me. It didnt crash in the older version of this application.
Please help!Don't do this either
SELECT * FROM Table1 Explictly name the columns in the order that you are going to fetch them. This makes your code easier to follow later and as side benefit prevents any changes in the column ordering from blowing your code to smitheens.
And I do hope your table is not in fact called Table1. -
Whenever I send a message to another iPhone user via iMessage it is sending my Apple ID instead of my phone number. Could someone help me with this???
Check this article: iOS: About Messages
Additional Information
You can change your iMessage Caller ID setting on iOS devices in Settings > Messages > Receive At > Caller ID. Note that the Caller ID setting is used only for new conversations. If you would like to change the address from which messages are sent, first change your Caller ID, and then delete the existing conversation and start a new one.
iMessage responses will be sent from the address the recipient most recently messaged. For example, on iPhone you can receive messages sent to your Apple ID and phone number. A friend sends you a message to your Apple ID. Responses in this conversation will be sent from your Apple ID, even if your Caller ID is set to your phone number. -
yesterday for the first time i turned on my macpro 2011 model and i got a crazy gray screen with lines all over it ,so i held down the power button and turn off then restarted and all was ok could someone help me with this,what caused this shut down. werd
Are the lines like psychedelic herringbone? If yes, I had that happen once, it was something serious, like the
Logic board. The good news is that it was fixed without any loss of data on the hard drive. Take it in to have Apple look at it ASAP. I took it to TekServe at the time, they are very nice about preserving your data and user library when possible.
Good luck and don't panic. -
Hi,
The possibilities can be of various reasons, with the sql statements,
xml descriptors, data sources, improper drivers anything. To crack down
the solution, kindly let me know the error messages and what exactly are
you trying to accomplish.
Thanks & Regards
Raj
manimaran t wrote:
what may be the cause of this error java.sql.SQLException: invalid sql
type passed to callable statement in iplanet ussing JNDI
Try our New Web Based Forum at http://softwareforum.sun.com
Includes Access to our Product Knowledge Base! -
What is this error java.sql.SQLException: Bad format for number ?
Dear All,
I am reading few values from database. Then I get this error "MyError:Error : java.sql.SQLException: Bad format for number 'Sarawak' in column 6. " So what is this error referring to. I have checked the database column and its value fits according the data type. Any hints please?I have checked the database column and its value fits according the data type.Check again. Then check again. Keep checking until you find your error. You are trying to read a string containing "Sarawak" as a number. You have "getInt(6)" or other numeric type, and the 6th column in the select statement is not numeric.
-
Pleasse help me with this error in SQL statement
Please tell me the error in this query:
the Error given is
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement
given :
Databse is MS Access
In the databse :
account - text
number - text
date - date/time
vendor - text
Connection connection = t.getConnection();
/* t - some object containing a connection*/
Statement stmt = connection.createStatement();
stmt.executeUpdate("INSERT INTO Bills (account, number, date, vendor)
VALUES ('vai', '23', 10/12/2006, 'jaadya')");I would imagine the problem is with the date. Different DBs have different date formats. To avoid that problem, use a PreparedStatement.
java.sql.Date date = ...;
PreparedStatement ps = con.prepareStatement("INSERT INTO Bills (account, number, date, vendor) VALUES (?, ?, ?, ?)");
ps.setString(1, "vai");
ps.setString(2, "23);
ps.setDate(3, date);
ps.setString(4, "jaadya");
ps.executeUpdate();This saves you from having to deal with vendors' various date formats, keeps you from having to escape special characters in strings, and prevents SQL injection. -
Can someone help me with this Error ?
When I start up my Thinkpad 600E it shows 301 on the first screen and then it goes to the diagnostic/Test screen.
I run a test on the system board and it comes up with this :
FRU 0086
22
0010
I know that there is some issue with the Harddisk. The trackpoint is broke so I have disabled and use an external mouse.
When I do the keyboard test, the key for F8 keeps blinking (even without pressing it). Could this be an issue ? Is there a work around like disabling the keyboard and using an external one ?
Or could it be because of the hard disk ?
Pls help
Thanks
AlexIs your datacontrol being called? I'd pad it with logs and see if maybe that's throwing an exception and causing a jsf error stack to be generated.
-
Can someone help me with this error i keep geting?
hello, ive been using photoshop for a while and then today i try to open it ad get this error:
can anyone help me?Is there any chance you've copied plug-ins or any other components from an older version of Photoshop into your current installation?
Do you have 3rd party plug-ins installed, and have you made a change in plug-ins recently?
It might be helpful if you'd go into Help - System Info, copy that data, and paste it in a post here.
-Noel -
Could someone help me with this code??
Hi!, I am really poor at Java, and was given this piece of code to fix. I have no idea why this compiles but does not run and have never dealt with packages either, so I would really appreciate it if someone could tell me what I could do to fix it!!
package Arrays;
import java.awt.*;
import java.awt.event.*;
* This class demonstrates a simple application
* A rather primitive ATM machine (needs work)
* Quite similar to the CashRegister Applet
public class VirtualATM extends Frame implements ActionListener
// the "screen"
TextArea display = new TextArea(8, 20);
// some local variables
private String current = new String("");
private double amount = 0d;
private double balance = 5000.0;
private int opCode;
// op code constants
static final int PINENTRY = 0;
static final int DEPOSIT = 1;
static final int WITHDRAWAL = 2;
// button labels - an array
String [] btnLabels =
"1", "2", "3", "Deposit",
"4", "5", "6", "Withdraw",
"7", "8", "9", "New Customer",
"0", ".","Enter","Quit"
* Default constructor
public VirtualATM()
super();
* Constructor with frame title
public VirtualATM(String title)
super(title);
setSize(400, 400);
// inner class to detect window closing and make sure
// quit method is executed before exit, not vital in
// this case but a good habit to get into
addWindowListener(new WindowAdapter()
public void windowClosing(WindowEvent e)
quit();
// set up the display
int nButtons = btnLabels.length;
Panel keypad = new Panel();
keypad.setLayout(new GridLayout(4, 4, 5, 5));
Button[] keys = new Button[nButtons];
for (int i = 0; i < nButtons; i++)
keys[i] = new Button(btnLabels);
keypad.add(keys[i]);
keys[i].addActionListener(this);
keys[i].setActionCommand(btnLabels[i]);
setLayout(new GridLayout(2, 1, 10, 10));
display.setEditable(false);
add(display);
add(keypad);
setVisible(true);
startup();
* Check the button presses
public void actionPerformed(ActionEvent e)
String command = e.getActionCommand();
char com = command.charAt(0);
// see if the character is part of a number:
if ((com >= '0') && (com <= '9') || (com == '.'))
doNumber(com);
else
// check here for function buttons
switch (com)
case 'D' :
current = "";
deposit();
break;
case 'W' :
current = "";
withdraw();
break;
case 'N' :
startup();
break;
case 'E' :
processOperation();
break;
case 'Q' :
quit();
break;
* This method prompts for a deposit
public void deposit()
opCode = DEPOSIT;
display.append("\nPlease enter amount to deposit: ");
* This method processes number button presses
* Could add PIN validation
public void doNumber(char com)
current += com;
if (opCode == PINENTRY)
display.append("*");
else
display.append("" + com);
* This method does the processing!
public void processOperation()
amount = toDouble(current);
switch (opCode)
case PINENTRY :
display.setText("Please choose a transaction");
break;
case DEPOSIT :
if (amount > 0.0)
balance += amount;
display.setText("Thank you, your new balance is: " + balance);
else
display.setText("You cannot deposit " + amount);
break;
case WITHDRAWAL :
if (amount <= balance)
balance -= amount;
display.setText("Thank you, your new balance is: " + balance);
else
display.setText("You cannot withdraw " + amount);
break;
* This method quits
public void quit()
System.exit(0);
* This method sets up for a new customer
public void startup()
display.setText("Welcome to Virtual Banking with VOB\n\n");
display.append("Please enter your PIN: ");
amount = 0.0;
current = "";
balance = 5000.00;
opCode = PINENTRY;
* converts a string to a double
private double toDouble(String s)
double theValue = -1.0;
try
if (s != "")
Double d = new Double(s);
theValue = d.doubleValue();
catch (NumberFormatException n)
current = "";
finally
return theValue;
* This method prompts for a withdrawal
public void withdraw()
opCode = WITHDRAWAL;
display.append("\nPlease enter amount to withdraw: ");
class main{
* Initialises the Application
* Creation date: (07-Dec-00 23:10:49)
public static void main(String[] args)
VirtualATM myATM = new VirtualATM("Virtual Overseas Bank");That sounds like a path or classpath issue issue. There are some instructions here for windows systems...
http://java.sun.com/docs/books/tutorial/getStarted/cupojava/win32.html
Basically you want to set your path to where your java.exe file is.
You can probably run it like this though (if you are in the dir where your ATM class is and you put the path where your jdk is installed):
D:\jdk1.3\bin\java VirtualATM
Here is the code, changed (note that this forum tends to screw up the code a little):
package Arrays;
import java.awt.*;
import java.awt.event.*;
* This class demonstrates a simple application
* A rather primitive ATM machine (needs work)
* Quite similar to the CashRegister Applet
public class VirtualATM extends Frame implements ActionListener
// the "screen"
TextArea display = new TextArea(8, 20);
// some local variables
private String current = new String("");
private double amount = 0d;
private double balance = 5000.0;
private int opCode;
// op code constants
static final int PINENTRY = 0;
static final int DEPOSIT = 1;
static final int WITHDRAWAL = 2;
// button labels - an array
String [] btnLabels =
"1", "2", "3", "Deposit",
"4", "5", "6", "Withdraw",
"7", "8", "9", "New Customer",
"0", ".","Enter","Quit"
* Default constructor
public VirtualATM()
super();
* Constructor with frame title
public VirtualATM(String title)
super(title);
setSize(400, 400);
// inner class to detect window closing and make sure
// quit method is executed before exit, not vital in
// this case but a good habit to get into
addWindowListener(new WindowAdapter()
public void windowClosing(WindowEvent e)
quit();
// set up the display
int nButtons = btnLabels.length;
Panel keypad = new Panel();
keypad.setLayout(new GridLayout(4, 4, 5, 5));
Button[] keys = new Button[nButtons];
for (int i = 0; i < nButtons; i++)
keys[i] = new Button(btnLabels);
keypad.add(keys[i]);
keys[i].addActionListener(this);
keys[i].setActionCommand(btnLabels[i]);
setLayout(new GridLayout(2, 1, 10, 10));
display.setEditable(false);
add(display);
add(keypad);
setVisible(true);
startup();
* Check the button presses
public void actionPerformed(ActionEvent e)
String command = e.getActionCommand();
char com = command.charAt(0);
// see if the character is part of a number:
if ((com >= '0') && (com <= '9') || (com == '.'))
doNumber(com);
else
// check here for function buttons
switch (com)
case 'D' :
current = "";
deposit();
break;
case 'W' :
current = "";
withdraw();
break;
case 'N' :
startup();
break;
case 'E' :
processOperation();
break;
case 'Q' :
quit();
break;
* This method prompts for a deposit
public void deposit()
opCode = DEPOSIT;
display.append("\nPlease enter amount to deposit: ");
* This method processes number button presses
* Could add PIN validation
public void doNumber(char com)
current += com;
if (opCode == PINENTRY)
display.append("*");
else
display.append("" + com);
* This method does the processing!
public void processOperation()
amount = toDouble(current);
switch (opCode)
case PINENTRY :
display.setText("Please choose a transaction");
break;
case DEPOSIT :
if (amount > 0.0)
balance += amount;
display.setText("Thank you, your new balance is: " + balance);
else
display.setText("You cannot deposit " + amount);
break;
case WITHDRAWAL :
if (amount <= balance)
balance -= amount;
display.setText("Thank you, your new balance is: " + balance);
else
display.setText("You cannot withdraw " + amount);
break;
* This method quits
public void quit()
System.exit(0);
* This method sets up for a new customer
public void startup()
display.setText("Welcome to Virtual Banking with VOB\n\n");
display.append("Please enter your PIN: ");
amount = 0.0;
current = "";
balance = 5000.00;
opCode = PINENTRY;
* converts a string to a double
private double toDouble(String s)
double theValue = -1.0;
try
if (s != "")
Double d = new Double(s);
theValue = d.doubleValue();
catch (NumberFormatException n)
current = "";
finally
return theValue;
* This method prompts for a withdrawal
public void withdraw()
opCode = WITHDRAWAL;
display.append("\nPlease enter amount to withdraw: ");
* Initialises the Application
* Creation date: (07-Dec-00 23:10:49)
public static void main(String[] args)
VirtualATM myATM = new VirtualATM("Virtual Overseas Bank"); -
Hi could someone help me with this basic issue ..
'sql*plus' is not recognized as an internal or external command,
operable program or batch file.
I have installed expression addition for practice on a win xp OS it was working fine but now this is the error when , I am trying to start the data base.
checked the environmental variables they seem to be ok but still no progress .
Thanks,
MaxHi,
In hurry are you typing sql*plus instead of sqlplus?
you could go to <oracle-home>/bin directory and run (ex: C:\oraclexe\app\oracle\product\11.2.0\server\bin\sqlplus.exe)
Regards
Yoonas -
Can someone help me with this error 2001 problem ?
i have a problem with my iphone 4s that my doesnt work at all unless i plug it to the charger cable, and then once i plug it, it shows on the screen that the battery is 100% and i cant turn on the wifi. Once i unplug the cable the iphone turns off immedately! so i tried to restore my iphone, and then when i try to restore it, it says that there is an error called "2001".. so what should i do ?? thanks.
Hi Randomkilla,
If you are getting a 2001 error when trying to restore you iPhone, you may find the troubleshooting in the following article helpful:
Apple Support: Resolve specific iTunes update and restore errors
http://support.apple.com/kb/TS3694
Regards,
- Brenden -
Can someone help me with this error message?
I am very new to java and I am trying to write a memory game but, when I try to compile I get this message
incompatible types
java.awt.Image
required int
my code is below:
import java.applet.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.JOptionPane;
public class mem1 extends JApplet
int CardPlace[];
int CardFace[];
Image img1;
Image img2;
Image img3;
Image CardBack;
private int mX = 0;
private int mY = 0;
boolean turned;
int flip = 0;
int pos;
int Position;
public void init()
int choice;
int cd1=0;
int cd2=0;
int cd3=0;
int counter=0;
CardPlace=new int[6];
CardFace=new int[6];
cd1 = getImage(getDocumentBase(),"Heart.gif");
cd2 = getImage(getDocumentBase(),"Happy.gif");
cd3 = getImage(getDocumentBase(),"Phone.gif");
CardBack = getImage(getDocumentBase(),"safari.gif");
while (counter<6)
choice = 1 + (int)(Math.random() * 3);
switch(choice)
case 1:
if(cd1<2)
{ CardPlace[counter] = 1;
counter++;
cd1++;
break;
case 2:
if(cd2<2)
{ CardPlace[counter] = 2;
counter++;
cd2++;
break;
case 3:
if(cd3<2)
{ CardPlace[counter] = 3;
counter++;
cd3++;
break;
addMouseListener(new MouseHandler());
public void paint(Graphics g)
int xposition = 0;
int yposition = 0;
int i = 0;
turned = false;
if ((mX>=0 && mX < 150) && (mY >=0 && mY<150))
Position = 0;
else if((mX >150 && mX < 300) && (mY>=0 && mY < 150))
Position = 1;
else if((mX >=300 && mX < 450) && (mY>=0 && mY < 150))
Position = 2;
else if((mX >=0 && mX < 150) && (mY>=150 && mY < 300))
Position = 3;
else if((mX >150 && mX < 300) && (mY>=150 && mY < 300))
Position = 4;
else if((mX >300 && mX < 450) && (mY>=150 && mY < 300))
Position = 5;
CardFace[Position]=CardPlace[Position];
if (flip == 0)
flip = Position;
else if(flip != Position)
if(CardFace[flip] != CardFace[Position])
CardFace[flip]=0;
CardFace[Position]=0;
flip = 0;
while (i<6)
if (xposition==450)
yposition=150;
xposition = 0;
switch(CardFace){
case 0:
g.drawImage(CardBack, xposition, yposition, this);
break;
case 1:
g.drawImage(img1,xposition,yposition,this);
break;
case 2:
g.drawImage(img2,xposition,yposition, this);
break;
case 3:
g.drawImage(img3,xposition,yposition,this);
break;
xposition = xposition + 150;
i++;
private class MouseHandler extends MouseAdapter
public void mousePressed(MouseEvent evt)
mX = evt.getX();
mY = evt.getY();
turned = true;
repaint();Hi,
Can u indicate the exact lines in which the
error message is thrown.
Raja -
Java.sql.SQLException: Closed Statement
I'm having a problem with my Java code trying to access an Oracle 10g database through the JDBC driver using the Oracle XML Publisher.
We generate a number of different reports, but one report consistently fails with the error: java.sql.SQLException: Closed Statement
It only happens in the production environment, which has significantly more data than the test and development environments.
One interesting (!) observation is that the error occurs after 10 minutes to the second (almost). Which leads me to think it is a timeout related problem, but am aware that this could be a red herring.
And finally, the code is being run within a job sheduled using the Quartz Scheduler v1.6.5.
Any help would be appreciated.
Many Thanks
Lawrence
Here is the stack trace:
java.sql.SQLException: Closed Statement: getMetaData
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.OracleResultSetImpl.getMetaData(OracleResultSetImpl.java:128)
at com.mchange.v2.c3p0.impl.NewProxyResultSet.getMetaData(NewProxyResultSet.java:47)
at oracle.apps.xdo.dataengine.XMLPGEN.processSQLDataSource(Unknown Source)
at oracle.apps.xdo.dataengine.XMLPGEN.writeData(Unknown Source)
at oracle.apps.xdo.dataengine.XMLPGEN.writeGroup(Unknown Source)
at oracle.apps.xdo.dataengine.XMLPGEN.writeGroup(Unknown Source)
at oracle.apps.xdo.dataengine.XMLPGEN.processSQLDataSource(Unknown Source)
at oracle.apps.xdo.dataengine.XMLPGEN.writeData(Unknown Source)
at oracle.apps.xdo.dataengine.XMLPGEN.writeGroupStructure(Unknown Source)
at oracle.apps.xdo.dataengine.XMLPGEN.processData(Unknown Source)
at oracle.apps.xdo.dataengine.XMLPGEN.processXML(Unknown Source)
at oracle.apps.xdo.dataengine.XMLPGEN.writeXML(Unknown Source)
at oracle.apps.xdo.dataengine.DataProcessor.processDataStructre(Unknown Source)
at oracle.apps.xdo.dataengine.DataProcessor.processData(Unknown Source)
at com.tmobile.sett.file.invoice.InvoiceFileFactory.generateXML(InvoiceFileFactory.java:157)
at com.tmobile.sett.file.invoice.InvoiceFileFactory.generateStatements(InvoiceFileFactory.java:365)
at com.tmobile.sett.file.invoice.InvoiceFileFactory.generateInvoices(InvoiceFileFactory.java:457)
at com.tmobile.sett.file.invoice.StatementGeneratorJob.execute(StatementGeneratorJob.java:34)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
Here is the code:
private void generateXML(String xmlTemplate, String xmlFilename, Hashtable parameters) {
DataProcessor dataProcessor = new DataProcessor();
log.debug("generateXML: xmlTemplate {}, xmlFilename {}", xmlTemplate, xmlFilename);
try {
// Set Data Template to be executed
dataProcessor.setDataTemplate(xmlTemplate);
// Obtain a new Connection from the Pool
Connection conn = HibernateUtil.getConnection();
if (conn == null)
log.debug("conn is null after getCall");
if (conn.isClosed())
log.debug("conn is closed after getCall");
// Set the Connection for the dataProcessor
dataProcessor.setConnection(conn);
if (conn.isClosed())
log.debug("conn is closed after setConnection");
dataProcessor.setParameters(parameters);
if (conn.isClosed())
log.debug("conn is closed after setParameters");
// Specify the output directory and file for the data file
dataProcessor.setOutput(xmlFilename);
if (conn.isClosed())
log.debug("conn is closed after setOutput");
// Process the data template
dataProcessor.processData();
if (conn.isClosed())
log.debug("conn is closed after processData");
// Return the connection to the pool
conn.close();
} catch (Exception e) {
System.err.println("Error generating XML with the following parameters:");
System.err.println("xmlTemplate=" + xmlTemplate);
System.err.println("xmlFilename=" + xmlFilename);
System.err.println("Here's the stack trace");
e.printStackTrace();
System.exit(1);
}I have made some progress in understanding the problem...
Basically, your comment about threads made me look at the code from a threads perspective. There are only three objects used, log4j, oracleXML Publisher and hibernate. Discounting log4j, the Oracle object is created, opened and closed within the procedure, so I concluded that hibernate was the most likely cause of the problem (i know, theres an element of educated guesswork in this).
Anyway, I found the hibernate timeouts (all around 300 seconds) and increased them to 3000 seconds... and lo and behold the reports are generated successfully, although some of them take over 20 minutes each.
So, this is a performance problem with the SQL itself:
SELECT service
, reply
, ROUND(SUM(DECODE(op, 3, 0, count))* :uplift,0) x_events
, ROUND(SUM(DECODE(op, 3, count, 0))* :uplift,0) y_events
FROM aggregate
WHERE ref_time >= :period_start
AND ref_time < :period_end
AND feed = 13
AND agreement = :agreement
AND line = 1
GROUP BY service, reply
ORDER BY 1,2
The SQL in question is querying data for a specific month from a monthly partitioned table that contains about 11 million records a month. We currently have 99 partitions.
Executing the sql in Toad / Sql developer / sqlplus takes around 20 seconds...so why 20 minutes?
Looking in the session browser, I can see that the 20 minute query is looking through all 99 partitions where the 20 second query is only looking at 1 partition for the month in question.
I'm not sure if this is heading off topic for the forum thread, but the question now is...
Why is Oracle using a clearly innefficient execution plan when we are using a query with bound variables and how do we get it to use a more efficient execution plan? -
itunes could not connect to the iphone an unknown error occurred 0xE8000003 please help me with this error any one have idea ?
http://support.apple.com/kb/ts3221
Maybe you are looking for
-
Dataloss in network... How to trace it..?
Hi, Though this question is related to SAP XI and SMICM trace, I feel this question can also be answered by people in WebAs General, so i am posting this in this forum. In my current scenario where SAP XI system pushes data to another system(ABC syst
-
Updated to iTunes 11.0.3.4 and can no longer connect to the store. Contacted support and was hung up with no explanation. I am run Windows XP professional SP 3 which is up to date. Anyone else have the same problem? How did you fix? Saw similar issue
-
LSMW error Transaction: 0000000001 Matl no.:
Hi I am rajesh found some error while uploading data LSMW std direct input geting error material not observibng in MM03 Transaction: 0000000001 Matl no.: Message no. BL001 Transaction: 0000000001 Matl no.: Transaction 0000000001: Taxes for sales o
-
How to force Address Book syncing Google contacts immediately?
Hi everyone, Last time I configured the Address Book as syncing the contacts with my Google account, but there was nothing changed in the Address Book. A couple of days later when I run Address Book again, the contacts in my Google accont was already
-
When I convert a .mov to iPod video format, the sound disappears
For some reason, I have a .mov file that loses its sound when I convert it to m4v. This doesn't happen on all .mov files, only a few. Any suggestions on things to check for/solutions?