SQL queries help need-urgent

Based on your inputs-I studied and created the below objects.I apologise for asking lengthy questions,but i
need your help very much now to proceed next.
There is a COMPANY WHICH has many divisions/departments in it.
These divisions has employees.
*{color:#0000ff}--Created employee table which employee_id and Salary.*
**employees (*empid,salary){color}*
*{color:#0000ff}***DO i need to put the DEPT_ID and Manager_id in the EMPLOYEES table? {color}*
*{color:#0000ff}--Presently,iCreated a relationship table to have EMPLOYEE"S MANAGER information.a manager is an employee itself.{color}*
*{color:#0000ff}--Created a table for EMPLOyee and department---RELATIONSHIP ---> empl_id and dept_id{color}*
The COMPANY has numerous Products(also we can say projects) and these project work is done by the various depts.
*{color:#0000ff}Projects /Job table*
*--job_id*
*--Project_name*
*--Budget Amount{color}*
*{color:#0000ff}--Created a table for Project and department---RELATIONSHIP ---> proj_id and dept_id*
*--Also,Created a table for Project and Employee---RELATIONSHIP ---> proj_id and employee_id{color}*
Also,here scenario (1)Employees can work or be a part of many or multiple departments and work for multiple projects/products at a time (2)As usual-each Department has a manager.**EVery dept can handle or work only on one project.
*{color:#0000ff}--Created a table for Project and department---RELATIONSHIP ---> proj_id and dept_id*
*--Also,Created a table for Project and Employee---RELATIONSHIP ---> proj_id and employee_id*
*{color}*
_*{color:#000000}***(1)Are the tables and the relationships defined above enough or have i created too much tables?Please advise me.{color}*_
Queries:-Need to write SQLs for below items.Please help me.Could you all have a look
bq. h5. {color:#0000ff} \\ _     (2)SQL for a person see all his manager?***A person can have 2,3 managers._ \\ _     (3)need a person--->manager-->and their manager's MANAGER_ \\ _     (4)How will managers to view all employees reporting to him._ \\ {color} \\ h5. \\ {color:#0000ff}_(5)feasibility (SQL) to support the increase of salaries of employees in a department by percentage or amount wise._ \\ _     (6)SQL to update or change manager of a department/employee._ \\ {color} \\ h5. \\ {color:#0000ff}_(7)If a employee is removed-then all related details should also be removed._ \\ _     (8)to remove person and department,terminate a person from organisation_ \\ _     SHIFTING a person to different department,assign a person to a department_{color} \\ h5. {color:#0000ff}_SQL to collect all info of a person, his managers , departments and project this employee works._ \\ _     find Department which dont have managers._{color} \\ h5. \\ {color:#0000ff}_****find expenditure all projects together in terms of salary_{color}

Sorry for all the confusion with the questions.So let me clear myself,i am doing this not as assignment or homework,but something
which interests me and trying to leran.Earlier as I stated that its a part of my school(** well frnakly speaking, it was my plan if i could
put this as an item of the school as the scope is very huge.
*(1)one employee can be in many departments(1 TO MANY) and and each department has one manager.(1 to 1)*
Created a table for EMPLOyee and department-RELATIONSHIP ---> empl_id and dept_id*
(2)Also,an employee can work in multiple items/projects(1-MANY) at a time. And a project HAS only one department.(1 to 1)
**Projects table created has codes,the Project name ,Planned budget cost/amount, start_date and end_date AND DEPART_ID
Also,Created a table for Project and Employee-RELATIONSHIP ---> proj_id and employee_id*
This is the full scenario has put above.So,i needed help as I am very confused if i have done the correct relationships.
And,these below items are my plans to allow the schema nd tables support it.
(2)how will a person see all his manager?***A person can have 2,3 managers.(EMP->MANAGER relationship TABLE)
(3)SQL to be able to show a person--->manager-->and their manager's MANAGER
(4)How will managers to view all employees reporting to him.
(5)SQL to support the increase of salaries of employees in a department by percentage or amount wise.
(6)SQL to update or change manager of a department/employee.
(7)If a employee is removed-then all related details should also be removed.
(8)to remove person and department,terminate a person from organisation
SHIFTING a person to different department,assign a person to a department
Projects /Job table EMPLOYEES TABLE-> SALARY info
--job_id
--Project_name
--Budget Amount

Similar Messages

  • Sql loader help needed  urgent

    Hi,
    I normally get a csv having data as
    column1 ;columnb;columnc;
    13 ; 12 ; 13 ;
    11 ;13 ;33;
    as the table where it needs to go is say table
    xys( a number, b number , c number).
    so the control file is fairly simple ...
    But from now I need to restrict data entry if the change in format happens in the csv
    say if it is like
    column2;column1;column3,
    12,13;12;
    11;13;14;
    or say the csv like
    column1;column2;column3;column4;
    11;13;14;15;
    111;134;14;12;
    in both cases sql loader should not run and throw the error saying the reason in the log.
    how do i manage it in the control file `???
    any ideas???
    regards
    Message was edited by:
    SHUBH

    Hello,
    do you only need to check the first line of the file if it contains a line like
    column1;column2;column3 ?
    If yes, maybe a small script like this could be a starting point:
    You have to replace "column1;column2;column3" with the header information that's valid and instead of file1 in the CURRENTSTRING=... Line write the name of your input file.
    I hope this helps. (But maybe some of the experts here knows a way to do the verification checks with SQLLDR, so maybe its worth to wait a little bit :)
    #!/bin/ksh
    VALIDSTRING="column1;column2;column3"
    CURRENTSTRING=`head -n 1 file1`
    if [[ $VALIDSTRING == $CURRENTSTRING ]]
    then
    echo "They match."
    else
    echo "They dont match."
    fi
    --

  • HT201210 i have an error of no 11. kindly help, needed urgently

    i have an error of no 11. kindly help, needed urgently
    when i try to upgrage my
    iphone 3gs wit 4.1 to new latest 5.1
    it gives the erorr of 11. what that mean? Reply as soon as you can !
    thnx

    Error -1 may indicate a hardware issue with your device. Follow Troubleshooting security software issues, and restore your device on a different known-good computer. If the errors persist on another computer, the device may need service.

  • Some J2ME midlets doubts!! help needed urgently!!!

    Hi,
    I am currently working in a company where it does wireless technology like WAP and I am assigned a task of creating a screensaver midlet. I have some doubts on the midlets.
    1) How do i use a midlet suites? From what I heard from my colleagues & friends, a servlet is needed for midlets to interact with one another. is it true?
    2) How do I get the startin midlet to take note the phone is idling so that the screen saver midlet can be called?
    Help needed urgently... if there is any source codes for me to refer to would be better... Thanks...
    Leonard

    indicates that MIDlet suites are isolated (on purpose) from each other, so you can't write over another one's address space.
    Also, I believe (at least on cell phones) that you have to specifically enter the Java Apps mode; unless you do the app won't execute. If you are in Java apps mode and a call comes in, the cell's OS puts the Java app currently executing on "Pause" mode and switches back to phone mode.
    Not sure if you will be able to have a Java app do that automatically.
    BTW why do you need a screensaver on an LCD display? Is it really intended to show an advertisement?
    Download and real all the docs you can from Sun, once you get over the generic Java deficiencies MIDlet's aren't that hard.

  • SQL Server2008 help needed

    Having trouble with SQLServer 2008 (not MySQL) and my database connection in Dreamweaver CS6.  My document type is set as .asp using VBScript.  I can list the table information  but cannot use the insert wizard to add new records.  I don't get any errors after creating the insert form, but no records get inserted.  I'm not a VBScript expert, but do I have to manually write some code to insert records?  How do I attach it to a button?

    Thanks for the quick reply.  I won't be back in the office for a few days, but I'll try to post it when I get back in.  It's pretty much the code generated from the Dreamweaver Insert Record wizard.  I see where the submit button is created and the value is set but the action on the form is set to MM_insert, so I don't see where the submit code is actually called.
    Date: Wed, 3 Oct 2012 12:06:14 -0600
    From: [email protected]
    To: [email protected]
    Subject: SQL Server2008 help needed
        Re: SQL Server2008 help needed
        created by bregent in Dreamweaver General - View the full discussion
    This post should be moved to the app dev forum.  Please post the code from your form and the insert script pages.
         Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/4746757#4746757
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4746757#4746757
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4746757#4746757. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Dreamweaver General by email or at Adobe Community
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • Load bar at start up, then shut down. HELP NEEDED URGENTLY!!! plss....

    Load bar at start up, then shut down. HELP NEEDED URGENTLY!!! plss..

    The startup disk may need repairing.
    Startup your Mac while holding down the Command + R keys so you can access the built in utiliites to repair the startup disk if necessary or restore OS X using OS X Recovery

  • SQL Report help needed

    Hi All,
    I am creating a report which is having 2 sql queries ,1 for the main columns that i need to show and 2 from total sum and count.
    Report is something as given below
    SET TAB OFF;
    set linesize 1500;
    set pagesize 50;
    SET FEEDBACK OFF;
    SET WRAP OFF
    COLUMN today NEW_VALUE VAR1 NOPRINT;
    TTITLE LEFT 'ABC Inc.' SKIP 1 -
    LEFT 'Daily Report' SKIP 1 -
    LEFT 'As Of ' VAR1 SKIP 2
    BTITLE LEFT SKIP 'Page No : ' FORMAT 9999999999 SQL.PNO SKIP 3;
    COL SR_NO HEADING 'Seq'               FORMAT 999999;
    COL REFNO HEADING 'Ref No'                FORMAT A20;
    COL ORIG_NAME HEADING ' Branch Name'      
         FORMAT A50;
    SELECT      ROWNUM                SR_NO,
         REF_NO                REFNO,
         ORIGIN_NAME               BRNAME
    FROM BANK
    WHERE PASS_CD=101
    SELECT      ' Failure Count : '|| NVL(COUNT(DECODE(CODE,1,CODE,NULL)),0) ||
         ' Failure Total Amt : '|| NVL(SUM(DECODE(CODE,799,AMT,NULL)),0)
         || CHR(10) ||     
         ' Successful Count : '|| NVL(COUNT(DECODE(CODE,000,CODE,NULL)),0) ||
    ' Successful Total Amt: '|| NVL(SUM(DECODE(CODE,000,AMT,NULL)),0)
    FROM BANK;
    CLEAR BREAKS;
    CLEAR COLUMN;
    TTITLE OFF;
    When i am running this second query output is going to secong page and title is repeated again and same as 1rst page is showing page no-1
    Kindly help me,i want the output on the same page at bottom.
    Thanks

    i think its only work in ISQL* PLUS enivironment iam
    not sure.It does work in SQL*Plus
    is that i can use in the package??http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14357/ch12048.htm

  • Help needed urgently on a problem..plzzz

    hi..this is a linear congruential generator. I have to implement it and i need the execution time for the program.
    for your understanding i'm providing an example below.
    Xn=(( a* xn-1 )+b) mod m
    If X0=7 ; a = 7 ; b =7 ; m=10
    Then
    X0 = 7
    X1 =((7 * 7) + 7))mod 10 = 6
    X2 = ((6*7)+7))mod 10 = 9
    X3 = ((9*7)+7) mod 10 = 0
    X4 = ((0*7)+7) mod 10 = 7
    Now since the cycle is being repeated i.e 7 appears again�so the period is 4 coz there are 4 diff nos. i.e 7,6,9,0�..
    help required urgently....your help will be appreciated...thankyou..

    Hi,
    I wrote the code so that it catches any cycle (not only the "big" one).
    Otherwise it will enter infinite loop...
    The time complexity is O(N*logN): it can do at most N iterations (here N is your 'm'), and in each iteration there can be O(log N) comparisons (since I maintain TreeSet).
    Interesting issue: is it possible to supply such (x0, a, b, m) tuple such that all possible values from 0 to m-1 will be output? I think no :)
    Here is the program:
    package recurr;
    import java.util.TreeSet;
    import java.util.Comparator;
    public class Recurrences {
         private static long x0, a, b, m;
         private static TreeSet theSet;
         public static void main(String[] args)
              long l0, l1, l2, l3;
              try {
                   x0 = Long.parseLong(args[0]);
                   a = Long.parseLong(args[1]);
                   b = Long.parseLong(args[2]);
                   m = Long.parseLong(args[3]);
              } catch(NumberFormatException nfe) {
                   nfe.printStackTrace();
              System.out.println("X[0]: " + x0 + "\n");
              long curr = x0;
              boolean cut = false;
              int i;
              // initialize the set
              theSet = new TreeSet(new LongComparator());
              // we can get at most m distinct values (from 0 to m-1) through recurrences
              for(i=1; i <= m; ++i) {
                   // iterate until we find duplicate
                   theSet.add(new Long(curr));
                   curr = recurrence(curr);
                   if(theSet.contains(new Long(curr))) {
                        cut = true;
                        break;
                   System.out.println("X[" + i + "]: " + curr + "\n");
              if(cut) {
                   System.out.println("Cycle found: the next will come " + curr + "\n");
              } else {
                   System.out.println("No cycle found!");
              System.out.println("----------------------------------");
              System.out.println("Totally " + (i-1) + " iterations");
         private static long recurrence(long previous)
              return (a*previous + b)%m;
         static class LongComparator implements Comparator
              public int compare(Object o1, Object o2)
                   if(((Long)o1).longValue() < ((Long)o2).longValue()) {
                        return -1;
                   } else if(((Long)o1).longValue() > ((Long)o2).longValue()) {
                        return 1;
                   } else return 0;
    }

  • Help needed Urgently- Rebate based on collected amount

    Dear all,
    I come across scenario while discussiion with client that they require rebate with collection. Details of the requirement are given below:
    1. SAP rebates run on billed values & set the accrual in rebate agreement on the rate what we have specified in the rebate agreement. Requirement is that, If i have billed on 1000$ & my accrual value is 100$ with the rate of 10%. If i collected 800$ instead of 1000$, then i need to pay the accrual on the basis of 800$ not on the basis of 1000$. It means i have to adjust accrual amount on the basis of 800$. Conclusion is that i have to pay not 100$ accrual instead less then 100$ on the basis of 800$ which i collected.
    2. In month 1 have billed on 5000$, my accrual amount is 500$ with rate of 10%. In the 2nd month i have to bill 1000$ and i have given an discount of 500$, it means my billed value is 500$ and my accrual amount is 50$@10%. In month 3 again i billed 500$ and my accrual amount is 50$@10%.
    Requirement is that, when i am going to pay the accrual to client, i should pay correct accrual for which he is entitled for. Means i should pay 100$ accrual not 600$ because i have already given an discount of 500$. Discount which i have given already of 500$ should need to be offest with the first month accrual of 500$. So remaning accrual is 100$.
    Great if somebody can help me out for the solutioning of the above requirements.

    Thanks Ivano,
    Somebody has started the conversation.
    Let me put my questions again.
    This requirement is nothing to do with Payment procedure in the agreement type.
    1. In any month if i billed 1000$, so my account receivable would be 1000$. My rebate for that month is 100$ at the rate of 10%. During customer receipt if i collected against my invoice 900$ instead of 1000$, my accrual needs to be corrected 90$ instead of 100$.
    I know this can not be fullfilled by standard SAP, by any thoughts on this welcomed.
    2. I know Rebate can be settled partially or full settlement by payment method( by cheque, bank transfer, or by credit memo) we have configure in rebate agreement type. But here requirement is totally different.
    Here, i need to pay the Rebate as a Discount instead of by cheque or by credit memo. While doing the partial or full settlement system will take into account collected accrual up to that day & apply as a discount to the final bill.
    Scenario is like that sometimes customer asked to give us the discount on bill for whatever they accrued so far.
    This is again cannot solved by standard SAP, but any thought by any body welcome. We have already thought that we need to enhance the solution.
    Solution needed urgently.

  • Weblogic 7.0 Porting Help needed urgently ........

    I have the following scenario
    Servlet makes a call to Session Bean which has transcations manageb by container.
    Session bean 1 executes SQL Queries
    Session Bean 1 invokes methods on Session Bean 2 in another Weblogic Instance
    to get value object.
    Session Bean 1 after updating the database as well after intracting with another
    Weblogic Instance returns a Java Object to Servlet.
    In weblogic 6.1 SP2 everything works well.
    While porting the application to weblogic 7.0 SP1 , the operation by Session Bean
    1 is all done.
    But before returning the vaules to Servlet the container most probably throws
    a Remote Exception. If I catch the Remote Exception and do nothing. I am getting
    the desired result.
    My Question is why should I be getting a Remote Exception from the other weblogic
    instance.
    The remote Exception seems to be a JTA Exception on other weblogic instance.
    I am using Oracle Thin Driver for Oracle 8.1.7 with
    TXDatasource.
    The trace of Remote Exception is as follows (Please scroll below for another exception
    as well)
    [2002/04/22 11:14:07:406] [DEBUG] [com.hns.iag.dbsp.servlets.DSPServlet] Remote
    exception while deleting java.rmi.RemoteException: Exception while commiting Tx
    : 3:efdbedc9111bd8d6; nested exception is:
    javax.transaction.SystemException: Timeout during commit processing
    Start server side stack trace:
    java.rmi.RemoteException: Exception while commiting Tx : 3:efdbedc9111bd8d6; nes
    ted exception is:
    javax.transaction.SystemException: Timeout during commit processing
    javax.transaction.SystemException: Timeout during commit processing
    at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(Se
    rverTransactionImpl.java:265)
    at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTran
    sactionImpl.java:208)
    at weblogic.ejb20.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:2
    78)
    at com.hns.iag.dbsp.ejb.user.DBSPUserManagerBean_ymjd1a_EOImpl.deleteDBS
    PUser(DBSPUserManagerBean_ymjd1a_EOImpl.java:812)
    at com.hns.iag.dbsp.ejb.user.DBSPUserManagerBean_ymjd1a_EOImpl_WLSkel.in
    voke(Unknown Source)
    at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:15
    9)
    at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
    ef.java:262)
    at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
    ef.java:229)
    at com.hns.iag.dbsp.ejb.user.DBSPUserManagerBean_ymjd1a_EOImpl_WLStub.de
    leteDBSPUser(Unknown Source)
    at com.hns.iag.dbsp.servlets.DSPServlet.doDeleteUser(DSPServlet.java:114
    9)
    at com.hns.iag.dbsp.servlets.DSPServlet.service(DSPServlet.java:131)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
    (ServletStubImpl.java:1058)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:401)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:306)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
    n.run(WebAppServletContext.java:5412)
    at weblogic.security.service.SecurityServiceManager.runAs(SecurityServic
    eManager.java:744)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
    rvletContext.java:3086)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
    pl.java:2544)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
    End server side stack trace
    At the same time the trace on another weblogic instance hosting Session Bean 2
    is as follows
    It continues after specified time .....
    <Apr 21, 2002 9:20:26 PM IST> <Error> <JTA> <110200> <User [guest] is not authorized
    to invoke startCommit on a transaction branch.>
    <Apr 21, 2002 9:20:56 PM IST> <Error> <JTA> <110200> <User [guest] is not author
    ized to invoke startCommit on a transaction branch.>
    <Apr 21, 2002 9:20:58 PM IST> <Error> <JTA> <110201> <User [guest] is not author
    ized to invoke startRollback on a transaction branch.>
    <Apr 21, 2002 9:21:07 PM IST> <Error> <JTA> <110201> <User [guest] is not author
    ized to invoke startRollback on a transaction branch.>
    Thanks,
    Kumar

    I have the following scenario
    Servlet makes a call to Session Bean which has transcations manageb by container.
    Session bean 1 executes SQL Queries
    Session Bean 1 invokes methods on Session Bean 2 in another Weblogic Instance
    to get value object.
    Session Bean 1 after updating the database as well after intracting with another
    Weblogic Instance returns a Java Object to Servlet.
    In weblogic 6.1 SP2 everything works well.
    While porting the application to weblogic 7.0 SP1 , the operation by Session Bean
    1 is all done.
    But before returning the vaules to Servlet the container most probably throws
    a Remote Exception. If I catch the Remote Exception and do nothing. I am getting
    the desired result.
    My Question is why should I be getting a Remote Exception from the other weblogic
    instance.
    The remote Exception seems to be a JTA Exception on other weblogic instance.
    I am using Oracle Thin Driver for Oracle 8.1.7 with
    TXDatasource.
    The trace of Remote Exception is as follows (Please scroll below for another exception
    as well)
    [2002/04/22 11:14:07:406] [DEBUG] [com.hns.iag.dbsp.servlets.DSPServlet] Remote
    exception while deleting java.rmi.RemoteException: Exception while commiting Tx
    : 3:efdbedc9111bd8d6; nested exception is:
    javax.transaction.SystemException: Timeout during commit processing
    Start server side stack trace:
    java.rmi.RemoteException: Exception while commiting Tx : 3:efdbedc9111bd8d6; nes
    ted exception is:
    javax.transaction.SystemException: Timeout during commit processing
    javax.transaction.SystemException: Timeout during commit processing
    at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(Se
    rverTransactionImpl.java:265)
    at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTran
    sactionImpl.java:208)
    at weblogic.ejb20.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:2
    78)
    at com.hns.iag.dbsp.ejb.user.DBSPUserManagerBean_ymjd1a_EOImpl.deleteDBS
    PUser(DBSPUserManagerBean_ymjd1a_EOImpl.java:812)
    at com.hns.iag.dbsp.ejb.user.DBSPUserManagerBean_ymjd1a_EOImpl_WLSkel.in
    voke(Unknown Source)
    at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:15
    9)
    at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
    ef.java:262)
    at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
    ef.java:229)
    at com.hns.iag.dbsp.ejb.user.DBSPUserManagerBean_ymjd1a_EOImpl_WLStub.de
    leteDBSPUser(Unknown Source)
    at com.hns.iag.dbsp.servlets.DSPServlet.doDeleteUser(DSPServlet.java:114
    9)
    at com.hns.iag.dbsp.servlets.DSPServlet.service(DSPServlet.java:131)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
    (ServletStubImpl.java:1058)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:401)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:306)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
    n.run(WebAppServletContext.java:5412)
    at weblogic.security.service.SecurityServiceManager.runAs(SecurityServic
    eManager.java:744)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
    rvletContext.java:3086)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
    pl.java:2544)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
    End server side stack trace
    At the same time the trace on another weblogic instance hosting Session Bean 2
    is as follows
    It continues after specified time .....
    <Apr 21, 2002 9:20:26 PM IST> <Error> <JTA> <110200> <User [guest] is not authorized
    to invoke startCommit on a transaction branch.>
    <Apr 21, 2002 9:20:56 PM IST> <Error> <JTA> <110200> <User [guest] is not author
    ized to invoke startCommit on a transaction branch.>
    <Apr 21, 2002 9:20:58 PM IST> <Error> <JTA> <110201> <User [guest] is not author
    ized to invoke startRollback on a transaction branch.>
    <Apr 21, 2002 9:21:07 PM IST> <Error> <JTA> <110201> <User [guest] is not author
    ized to invoke startRollback on a transaction branch.>
    Thanks,
    Kumar

  • Unable to allocate 27160 bytes.........Help needed urgently

    hi
    in my production database in getting this error..
    ORA-04031: unable to allocate 27160 bytes of shared memory ("shared
    pool","unknown object","sga heap(1,0)","session param values")
    help needed urgently

    If you have a program that does not use bind variables you can get this error.
    In such cases you do not want to increase the size of the shared pool, but reduce it, and flush regularly. This is a bug in the application and should be fixed to use bind variables.
    Another possible workaround is setting cursor_sharing = force, but this can cause other problems, so should only be used as a last resort. If the apps connections can be distinguished by user account or machine, then a log on trigger could be set cursor_sharing just for that application, to limit the damage until the vendor can fix it.

  • XML Generation using a sql query in an efficient way -Help needed urgently

    Hi
    I am facing the following issue while generating xml using an sql query. I get the below given table using a query.
         CODE      ID      MARK
    ==================================
    1 4 2331 809
    2 4 1772 802
    3 4 2331 845
    4 5 2331 804
    5 5 2331 800
    6 5 2210 801
    I need to generate the below given xml using a query
    <data>
    <CODE>4</CODE>
    <IDS>
    <ID>2331</ID>
    <ID>1772</ID>
    </IDS>
    <MARKS>
    <MARK>809</MARK>
    <MARK>802</MARK>
    <MARK>845</MARK>
    </MARKS>
    </data>
    <data>
    <CODE>5</CODE>
    <IDS>
    <ID>2331</ID>
    <ID>2210</ID>
    </IDS>
    <MARKS>
    <MARK>804</MARK>
    <MARK>800</MARK>
    <MARK>801</MARK>
    </MARKS>
    </data>
    Can anyone help me with some idea to generate the above given CLOB message

    not sure if this is the right way to do it but
    /* Formatted on 10/12/2011 12:52:28 PM (QP5 v5.149.1003.31008) */
    WITH data AS (SELECT 4 code, 2331 id, 809 mark FROM DUAL
                  UNION
                  SELECT 4, 1772, 802 FROM DUAL
                  UNION
                  SELECT 4, 2331, 845 FROM DUAL
                  UNION
                  SELECT 5, 2331, 804 FROM DUAL
                  UNION
                  SELECT 5, 2331, 800 FROM DUAL
                  UNION
                  SELECT 5, 2210, 801 FROM DUAL)
    SELECT TO_CLOB (
                 '<DATA>'
              || listagg (xml, '</DATA><DATA>') WITHIN GROUP (ORDER BY xml)
              || '</DATA>')
              xml
      FROM (  SELECT    '<CODE>'
                     || code
                     || '</CODE><IDS><ID>'
                     || LISTAGG (id, '</ID><ID>') WITHIN GROUP (ORDER BY id)
                     || '</ID><IDS><MARKS><MARK>'
                     || LISTAGG (mark, '</MARK><MARK>') WITHIN GROUP (ORDER BY id)
                     || '</MARK></MARKS>'
                        xml
                FROM data
            GROUP BY code)

  • Sql Forms 2.3 help needed urgent

    I have a situation here.How to navigate to the next blk, And If we make any changes in the .inp file will it help?
    My client here uses Forms 2.3 for there Oracle Apps 10.7c

    Use the block level trigger FND_NXTBLK, or if not in an AOL environment use NXT_BLK (if I recall correctly). This is how you navigate from block to block. The command would be
    #EXEMACRO exetrg FND_NXTBLK;
    or you could use go_blk
    #EXEMACRO GO_BLK block_name;
    The .inp file is your form. Don't edit it unless you know what you are doing. Use the SQL*Forms tool and you'll be safer.
    Hope this helps. Not much detail in your posting. - Tristan

  • A puzzling situation...help needed urgently!

    This is somewhat related to the topic I posted here (the app is the same) : http://forum.java.sun.com/thread.jspa?threadID=5253292
    So I managed to set things straight and pass the value of the floor selected from the drop down list to a page called FloorPlanRender.jsp (the parameter name is "floorselected", and I store this parameter into an integer variable of the same name as shown in the code for the whole page below). A controller class receives the request, initializes the DB connection and redirects to the appropriate JSP page (not shown in the codes below, but it works fine) -
    [BTW, I have posted the entire code for the page and classes involved...that was just to make the code more informative. The problem seems to be in a very small part of the code alone].
    <%@page language="java" contentType="text/html"%>
    <%@page import="java.util.Iterator"%>
    <%@page import="java.util.ArrayList"%>
    <%@page import="seatplanner.beans.FloorPlanRenderElement"%>
    <% String base = (String)application.getAttribute("base"); %>
    <% String imageURL = (String)application.getAttribute("imageURL"); %>
    <jsp:useBean id="dataManager" scope="application"
      class="seatplanner.model.DataManager"/>
    <!DOCTYPE html
         PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
      <title>Tech Mahindra SeatMaster&reg; | Floor Plan</title>
      <link rel="stylesheet" href="/TechMSeatPlan/css/pagestyle.css" type="text/css"/>
    </head>
    <body>
    <div id="all">
    <!-- Display logo -->
    <div id="toppanel"> <jsp:include page="TopPanel.jsp"/> </div>
    <br/> <br/>
    <!-- Display main content -->
    <div id="contentpanel">
    <!-- Store the floor selected and get the row and column count for the floor -->
    <% String floorselect = request.getParameter("floorselected");
       int floorselected = Integer.parseInt(floorselect);
       int rowcount = dataManager.getRowCount(floorselected);
       int columncount = dataManager.getColumnCount(floorselected);
       ArrayList<FloorPlanRenderElement> floorplanelements = dataManager.getFloorPlanElements(floorselected);
       Iterator<FloorPlanRenderElement> iterator = floorplanelements.iterator(); %>
    <!-- Create Table to display the grid -->
    <% if(!(floorplanelements.isEmpty())) // Checks whether the retrieved ArrayList is empty or not
    FloorPlanRenderElement anelement = new FloorPlanRenderElement();%>
    <table id="floorplan">
    <% while(iterator.hasNext())
         for(int i=1; i==rowcount; i++)
              { %>
                   <tr>
                   <% for(int j=1; j==columncount; j++)
                        anelement = iterator.next(); // Store the elements one by one
                   %>
                   <td width=30px height=30px> <img src="<%=imageURL + anelement.floorelement.getElementType() + "-" + anelement.floorelement.getOccupied()%>"/> </td>
                    <% } //close for...j loop %>
                    </tr>
          <% } //close for...i loop %>
    <% } //close while... loop %>
    </table>
    <% } //close if, start else
    else { %>
    No floor plan exists. Please choose another floor.
    <% } //close else %>
    </div>
    </div>
    </body>
    </html>
                        Now, using this value for floor selected, I have to get the rows and columns configured for this floor from a database. This involves performing a select max statement so that I can get the maximum row and column number respectively. So I call upon the relevant methods in the DataManager class by creating an object, which in turn gets forwarded to a class known as FloorPlanRenderPeer.java [The code for both are shown below]:
    DataManager.java
    package seatplanner.model;
    import java.util.Hashtable;
    import java.util.ArrayList;
    import java.util.Enumeration;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import java.sql.Statement;
    import seatplanner.beans.FloorPlanRenderElement;
    public class DataManager {
      private String dbURL = "";
      private String dbUserName = "";
      private String dbPassword = "";
      /*Basic and connectivity operations */
      public void setDbURL(String dbURL) {
        this.dbURL = dbURL;
      public String getDbURL() {
        return dbURL;
      public void setDbUserName(String dbUserName) {
        this.dbUserName = dbUserName;
      public String getDbUserName() {
        return dbUserName;
      public void setDbPassword(String dbPassword) {
        this.dbPassword = dbPassword;
      public String getDbPassword() {
        return dbPassword;
      public Connection getConnection() {
        Connection conn = null;
        try {
          conn = DriverManager.getConnection(getDbURL(), getDbUserName(),
              getDbPassword());
        catch (SQLException e) {
          System.out.println("Could not connect to DB: " + e.getMessage());
        return conn;
      public void putConnection(Connection conn) {
        if (conn != null) {
          try { conn.close(); }
          catch (SQLException e) { }
         /* Floor related operations */
         public ArrayList<Integer> getAllFloorNumbers() {
              return FloorPeer.getAllFloorNumbers(this);
         /* Floor Plan Rendering related operations */
         public int getRowCount(int floorselected) {
              return (FloorPlanRenderPeer.getRowCount(this, floorselected));
         public int getColumnCount(int floorselected) {
              return (FloorPlanRenderPeer.getColumnCount(this, floorselected));
         public ArrayList<FloorPlanRenderElement> getFloorPlanElements(int floorselected) {
              return FloorPlanRenderPeer.getFloorPlanElements(this, floorselected);
    FloorPlanRenderPeer.java
    package seatplanner.model;
    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.ArrayList;
    import seatplanner.beans.FloorPlanRenderElement;
    /* This class handles all floor plan rendering operations */
    public class FloorPlanRenderPeer
    /* This method returns the number of rows configured for the floor */
    public static int getRowCount(DataManager dataManager, int floorselected) {
         int rowcount=0;
        Connection connection = dataManager.getConnection();
        if (connection != null) {
          try { 
              Statement s = connection.createStatement();
              try
            String sql = "select max(grid_x_pos) from seatplanner.floorgridpart where floor_id =" + floorselected;
            ResultSet rs = s.executeQuery(sql);
              try {
                  rowcount = rs.getInt(1);
              finally { rs.close(); }
            finally {s.close(); }
          catch (SQLException e) {
            System.out.println("Could not get row count: " + e.getMessage());
          finally {
            dataManager.putConnection(connection);
        return (rowcount);
    /* This method returns the number of columns configured for the floor */
    public static int getColumnCount(DataManager dataManager, int floorselected) {
         int columncount=0;
        Connection connection = dataManager.getConnection();
        if (connection != null) {
          try {
            Statement s = connection.createStatement();
               try {
            String sql = "select max(grid_y_pos) from seatplanner.floorgridpart where floor_id =" + floorselected;
              ResultSet rs = s.executeQuery(sql);
              try {
                  columncount = rs.getInt(1);
                        } finally { rs.close(); }
               } finally {s.close(); }
          catch (SQLException e) {
            System.out.println("Could not get column count: " + e.getMessage());
          finally {
            dataManager.putConnection(connection);
        return columncount;
    /* This method returns all the grid elements needed to render the floor plan for the selected floor */
    public static ArrayList<FloorPlanRenderElement> getFloorPlanElements(DataManager dataManager, int floorselected) {
        ArrayList<FloorPlanRenderElement> floorplanrenderelements = new ArrayList<FloorPlanRenderElement>();
         FloorPlanRenderElement oneelement = new FloorPlanRenderElement();
        Connection connection = dataManager.getConnection();
        if (connection != null) {
          try {
            Statement s = connection.createStatement();
            String sql = "select distinct A.grid_x_pos, A.grid_y_pos, A.element_ID, B.element_type, B.occupied" +
                              "from seatplanner.floorgridpart A, seatplanner.floorelement B where (A.floor_ID = " + floorselected +
                              "and A.element_ID = B.ID) order by A.grid_x_pos, A.grid_y_pos asc";     
            try {
              ResultSet rs = s.executeQuery(sql);
              try {
                while (rs.next()) {
                  oneelement.floorgridpart.setGridXPos(rs.getInt(1));
                     oneelement.floorgridpart.setGridYPos(rs.getInt(2));
                     oneelement.floorgridpart.setElementID(rs.getString(3));
                     oneelement.floorelement.setID(rs.getString(3));
                     oneelement.floorelement.setElementType(rs.getString(4));
                     oneelement.floorelement.setOccupied(rs.getString(5));
                     floorplanrenderelements.add(oneelement);
              finally { rs.close(); }
            finally {s.close(); }
          catch (SQLException e) {
            System.out.println("Could not get floor numbers: " + e.getMessage());
          finally {
            dataManager.putConnection(connection);
        return floorplanrenderelements;
    }When I run the application and choose my floor, the result throws me a "No floor plan exists...." [the else...part in the jsp page].
    I have come to know that it is because for some odd reason, the rowcount and columncount variables are not being set properly. I have tested the queries used in the FloorPlanRender peer class in the mySQL query browser and they work (both the row and column count for floor 3 for example, should return 20). But they don't. When I printed out the rowcount and columncount variables, they were set to a 0. I thought the floorselected parameter wasn't retrieved from the previous page properly, but to my surprise it was successfully set to 3, indicating the desired floor number.
    I can't begin to see where the error is. There is nothing wrong with the DB connection or the query, but the correct value is not being set to the variables in the jsp page.
    Can someone please have a look at the code and guide me as to what possibly is going wrong? I have spent a lot of time and effort and still haven't spotted the mistake, if any. Your help is much appreciated.

    Again wrong usage of Iterator :)
    <%@page language="java" contentType="text/html"%>
    <%@page import="java.util.Iterator"%>
    <%@page import="java.util.ArrayList"%>
    <%@page import="seatplanner.beans.FloorPlanRenderElement"%>
    <% String base = (String)application.getAttribute("base"); %>
    <% String imageURL = (String)application.getAttribute("imageURL"); %>
    <jsp:useBean id="dataManager" scope="application"
      class="seatplanner.model.DataManager"/>
    <!DOCTYPE html
         PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
      <title>Tech Mahindra SeatMaster&reg; | Floor Plan</title>
      <link rel="stylesheet" href="/TechMSeatPlan/css/pagestyle.css" type="text/css"/>
    </head>
    <body>
    <div id="all">
    <!-- Display logo -->
    <div id="toppanel"> <jsp:include page="TopPanel.jsp"/> </div>
    <br/> <br/>
    <!-- Display main content -->
    <div id="contentpanel">
    <!-- Store the floor selected and get the row and column count for the floor -->
    <% String floorselect = request.getParameter("floorselected");
       int floorselected = Integer.parseInt(floorselect);
       int rowcount = dataManager.getRowCount(floorselected);
       int columncount = dataManager.getColumnCount(floorselected);
       ArrayList<FloorPlanRenderElement> floorplanelements = dataManager.getFloorPlanElements(floorselected);
       Iterator<FloorPlanRenderElement> iterator = floorplanelements.iterator(); %>
    <!-- Create Table to display the grid -->
    <% if(!(floorplanelements.isEmpty())) // Checks whether the retrieved ArrayList is empty or not
    FloorPlanRenderElement anelement = new FloorPlanRenderElement();%>
    <table id="floorplan">
    <% while(iterator.hasNext()){
    anelement = iterator.next(); // The iterator.next() every call would takes the pointer to the next element in the collection
    for(int i=1; i==rowcount; i++){ %>
    <tr>
    <% for(int j=1; j==columncount; j++){%>
    <td width=30px height=30px> <img src="<%=imageURL + anelement.floorelement.getElementType() + "-" + anelement.floorelement.getOccupied()%>"/> </td>
    <% } //close for...j loop %>
    </tr>
    <% } //close for...i loop %>
    <% } //close while... loop %>
    </table>
    <% } //close if, start else
    else { %>
    No floor plan exists. Please choose another floor.
    <% } //close else %>
    </div>
    </div>
    </body>
    </html>For god sake please bother to understand how any implementation of java.util.Iterator works
    for more info go through javadocs
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/Iterator.html
    and i believe you have completey ignored my other suggestion of using enhanced loop in J2SE 5.0+ if iterator is confusing.
    Anyways,hope the above might help you in fixing of what you are trying to..
    REGARDS,
    RaHuL

  • "com.mysql.jdbc.PacketTooBigException": Help needed urgently

    hi,
    I am using mm.mysql j/connector ver 3.0.6 and MYSQL server version 4.0.
    Max_allowed packet= 8MB at the server side
    I am getting PacketTooBigException when i am trying to update a particular column.
    What should i do.
    Any help will be greatly appreciated!!!

    the driver uses a 64 k max packet size by default. it is supposed to change this as neccessary upon connection but perhaps that is failing?
    below is the 3.0.7 connection code that i have slightly modified for you so that it prints out the connection properties after they have been initialized so that you can see what they are.
    try it out and i hope you find this helpful.
       Copyright (C) 2002 MySQL AB
          This program is free software; you can redistribute it and/or modify
          it under the terms of the GNU General Public License as published by
          the Free Software Foundation; either version 2 of the License, or
          (at your option) any later version.
          This program is distributed in the hope that it will be useful,
          but WITHOUT ANY WARRANTY; without even the implied warranty of
          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
          GNU General Public License for more details.
          You should have received a copy of the GNU General Public License
          along with this program; if not, write to the Free Software
          Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    /*Slight Modification by Max Stocker April 29, 2003 to trace what the connection values get initialized to. */
    package com.mysql.jdbc;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.Reader;
    import java.io.UnsupportedEncodingException;
    import java.math.BigDecimal;
    import java.net.URL;
    import java.sql.Clob;
    import java.sql.Date;
    import java.sql.ParameterMetaData;
    import java.sql.Ref;
    import java.sql.SQLException;
    import java.sql.Savepoint;
    import java.sql.Time;
    import java.sql.Timestamp;
    import java.util.ArrayList;
    import java.util.Calendar;
    import java.util.HashMap;
    import java.util.Iterator;
    import java.util.List;
    import java.util.Map;
    import java.util.Properties;
    import java.util.StringTokenizer;
    import java.util.TimeZone;
    * A Connection represents a session with a specific database.  Within the
    * context of a Connection, SQL statements are executed and results are
    * returned.
    * <P>A Connection's database is able to provide information describing
    * its tables, its supported SQL grammar, its stored procedures, the
    * capabilities of this connection, etc.  This information is obtained
    * with the getMetaData method.
    * @see java.sql.Connection
    * @author Mark Matthews
    * @version $Id: Connection.java,v 1.31.2.19 2003/03/28 22:42:24 mmatthew Exp $
    public class Connection implements java.sql.Connection {
        // The command used to "ping" the database.
        // Newer versions of MySQL server have a ping() command,
        // but this works for everything
        private static final String PING_COMMAND = "SELECT 1";
         * Map mysql transaction isolation level name to
         * java.sql.Connection.TRANSACTION_XXX
        private static Map mapTransIsolationName2Value = null;
         * The mapping between MySQL charset names
         * and Java charset names.
         * Initialized by loadCharacterSetMapping()
        private static Map charsetMap;
         * Table of multi-byte charsets.
         * Initialized by loadCharacterSetMapping()
        private static Map multibyteCharsetsMap;
         * Default socket factory classname
        private static final String DEFAULT_SOCKET_FACTORY = StandardSocketFactory.class
            .getName();
        static {
            loadCharacterSetMapping();
            mapTransIsolationName2Value = new HashMap(8);
            mapTransIsolationName2Value.put("READ-UNCOMMITED",
                new Integer(TRANSACTION_READ_UNCOMMITTED));
              mapTransIsolationName2Value.put("READ-UNCOMMITTED",
                   new Integer(TRANSACTION_READ_UNCOMMITTED));
            mapTransIsolationName2Value.put("READ-COMMITTED",
                new Integer(TRANSACTION_READ_COMMITTED));
            mapTransIsolationName2Value.put("REPEATABLE-READ",
                new Integer(TRANSACTION_REPEATABLE_READ));
            mapTransIsolationName2Value.put("SERIALIZABLE",
                new Integer(TRANSACTION_SERIALIZABLE));
         * Internal DBMD to use for various database-version
         * specific features
        private DatabaseMetaData dbmd = null;
         * The list of host(s) to try and connect to
        private List hostList = null;
          * A map of statements that have had setMaxRows() called on them
         private Map statementsUsingMaxRows;
         * The I/O abstraction interface (network conn to
         * MySQL server
        private MysqlIO io = null;
         * Mutex
        private final Object mutex = new Object();
         * The driver instance that created us
        private NonRegisteringDriver myDriver;
         * The map of server variables that we retrieve
         * at connection init.
        private Map serverVariables = null;
         * Properties for this connection specified by user
        private Properties props = null;
         * The database we're currently using
         * (called Catalog in JDBC terms).
        private String database = null;
         * If we're doing unicode character conversions,
         * what encoding do we use?
        private String encoding = null;
         * The hostname we're connected to
        private String host = null;
         * The JDBC URL we're using
        private String myURL = null;
         * The password we used
        private String password = null;
         * Classname for socket factory
        private String socketFactoryClassName = null;
         * The user we're connected as
        private String user = null;
         * The timezone of the server
        private TimeZone serverTimezone = null;
         * Allow LOAD LOCAL INFILE (defaults to true)
        private boolean allowLoadLocalInfile = true;
         * Are we in autoCommit mode?
        private boolean autoCommit = true;
         * Should we capitalize mysql types
        private boolean capitalizeDBMDTypes = false;
         * Should we continue processing batch commands if
         * one fails. The JDBC spec allows either way, so
         * we let the user choose
        private boolean continueBatchOnError = true;
         * Should we do unicode character conversions?
        private boolean doUnicode = false;
         * Are we failed-over to a non-master host
        private boolean failedOver = false;
        /** Does the server suuport isolation levels? */
        private boolean hasIsolationLevels = false;
         * Does this version of MySQL support quoted identifiers?
        private boolean hasQuotedIdentifiers = false;
        // This is for the high availability :) routines
        private boolean highAvailability = false;
         * Has this connection been closed?
        private boolean isClosed = true;
         * Should we tell MySQL that we're an interactive client?
        private boolean isInteractiveClient = false;
         * Is the server configured to use lower-case
         * table names only?
        private boolean lowerCaseTableNames = false;
         * Has the max-rows setting been changed from
         * the default?
        private boolean maxRowsChanged = false;
         * Do we expose sensitive information in exception
         * and error messages?
        private boolean paranoid = false;
         * Should we do 'extra' sanity checks?
        private boolean pedantic = false;
         * Are we in read-only mode?
        private boolean readOnly = false;
        /** Do we relax the autoCommit semantics? (For enhydra, for example) */
        private boolean relaxAutoCommit = false;
         * Do we need to correct endpoint rounding errors
        private boolean strictFloatingPoint = false;
         * Do we check all keys for updatable result sets?
        private boolean strictUpdates = true;
        /** Are transactions supported by the MySQL server we are connected to? */
        private boolean transactionsSupported = false;
         * Has ANSI_QUOTES been enabled on the server?
        private boolean useAnsiQuotes = false;
         * Should we use compression?
        private boolean useCompression = false;
         * Can we use the "ping" command rather than a
         * query?
        private boolean useFastPing = false;
         * Should we tack on @hostname in DBMD.getTable/ColumnPrivileges()?
        private boolean useHostsInPrivileges = true;
         * Should we use SSL?
        private boolean useSSL = false;
         * Should we use stream lengths in prepared statements?
         * (true by default == JDBC compliant)
        private boolean useStreamLengthsInPrepStmts = true;
         * Should we use timezone information?
        private boolean useTimezone = false;
        /** Should we return PreparedStatements for UltraDev's stupid bug? */
        private boolean useUltraDevWorkAround = false;
        private double initialTimeout = 2.0D;
         * How many hosts are in the host list?
        private int hostListSize = 0;
         * isolation level
        private int isolationLevel = java.sql.Connection.TRANSACTION_READ_COMMITTED;
         * The largest packet we can send (changed
         * once we know what the server supports, we
         * get this at connection init).
        private int maxAllowedPacket = 65536;
        private int maxReconnects = 3;
         * The max rows that a result set can contain.
         * Defaults to -1, which according to the JDBC
         * spec means "all".
        private int maxRows = -1;
        private int netBufferLength = 16384;
         * The port number we're connected to
         * (defaults to 3306)
        private int port = 3306;
         * How many queries should we wait before we try to re-connect
         * to the master, when we are failing over to replicated hosts
         * Defaults to 50
        private int queriesBeforeRetryMaster = 50;
         * What should we set the socket timeout to?
        private int socketTimeout = 0; // infinite
         * When did the last query finish?
        private long lastQueryFinishedTime = 0;
         * When did the master fail?
        private long masterFailTimeMillis = 0L;
         * Number of queries we've issued since the master
         * failed
        private long queriesIssuedFailedOver = 0;
         * How many seconds should we wait before retrying to connect
         * to the master if failed over? We fall back when either
         * queriesBeforeRetryMaster or secondsBeforeRetryMaster is
         * reached.
        private long secondsBeforeRetryMaster = 30L;
         * The type map for UDTs (not implemented, but used by
         * some third-party vendors, most notably IBM WebSphere)
        private Map typeMap;
         * Ignore non-transactional table warning for rollback?
        private boolean ignoreNonTxTables = false;
         * Creates a connection to a MySQL Server.
         * @param host the hostname of the database server
         * @param port the port number the server is listening on
         * @param info a Properties[] list holding the user and password
         * @param database the database to connect to
         * @param url the URL of the connection
         * @param d the Driver instantation of the connection
         * @exception java.sql.SQLException if a database access error occurs
        Connection(String host, int port, Properties info, String database,
            String url, NonRegisteringDriver d) throws java.sql.SQLException {
            if (Driver.TRACE) {
                Object[] args = { host, new Integer(port), info, database, url, d };
                Debug.methodCall(this, "constructor", args);
            this.serverVariables = new HashMap();
            hostList = new ArrayList();
            if (host == null) {
                this.host = "localhost";
                hostList.add(this.host);
            } else if (host.indexOf(",") != -1) {
                // multiple hosts separated by commas (failover)
                StringTokenizer hostTokenizer = new StringTokenizer(host, ",", false);
                while (hostTokenizer.hasMoreTokens()) {
                    hostList.add(hostTokenizer.nextToken().trim());
            } else {
                this.host = host;
                hostList.add(this.host);
            hostListSize = hostList.size();
            this.port = port;
            if (database == null) {
                throw new SQLException("Malformed URL '" + url + "'.", "S1000");
            this.database = database;
            this.myURL = url;
            this.myDriver = d;
            this.user = info.getProperty("user");
            this.password = info.getProperty("password");
            if ((this.user == null) || this.user.equals("")) {
                this.user = "nobody";
            if (this.password == null) {
                this.password = "";
            this.props = info;
            initializeDriverProperties(info);
            if (Driver.DEBUG) {
                System.out.println("Connect: " + this.user + " to " + this.database);
            try {
                createNewIO(false);
                this.dbmd = new DatabaseMetaData(this, this.database);
            } catch (java.sql.SQLException ex) {
                cleanup();
                // don't clobber SQL exceptions
                throw ex;
            } catch (Exception ex) {
                cleanup();
                StringBuffer mesg = new StringBuffer();
                if (!useParanoidErrorMessages()) {
                    mesg.append("Cannot connect to MySQL server on ");
                    mesg.append(this.host);
                    mesg.append(":");
                    mesg.append(this.port);
                    mesg.append(".\n\n");
                    mesg.append("Make sure that there is a MySQL server ");
                    mesg.append("running on the machine/port you are trying ");
                    mesg.append(
                        "to connect to and that the machine this software is "
                        + "running on ");
                    mesg.append("is able to connect to this host/port "
                        + "(i.e. not firewalled). ");
                    mesg.append(
                        "Also make sure that the server has not been started "
                        + "with the --skip-networking ");
                    mesg.append("flag.\n\n");
                } else {
                    mesg.append("Unable to connect to database.");
                mesg.append("Underlying exception: \n\n");
                mesg.append(ex.getClass().getName());
                throw new java.sql.SQLException(mesg.toString(), "08S01");
         * If a connection is in auto-commit mode, than all its SQL
         * statements will be executed and committed as individual
         * transactions.  Otherwise, its SQL statements are grouped
         * into transactions that are terminated by either commit()
         * or rollback().  By default, new connections are in auto-
         * commit mode.  The commit occurs when the statement completes
         * or the next execute occurs, whichever comes first.  In the
         * case of statements returning a ResultSet, the statement
         * completes when the last row of the ResultSet has been retrieved
         * or the ResultSet has been closed.  In advanced cases, a single
         * statement may return multiple results as well as output parameter
         * values.  Here the commit occurs when all results and output param
         * values have been retrieved.
         * <p><b>Note:</b> MySQL does not support transactions, so this
         *                 method is a no-op.
         * @param autoCommit - true enables auto-commit; false disables it
         * @exception java.sql.SQLException if a database access error occurs
        public void setAutoCommit(boolean autoCommit) throws java.sql.SQLException {
            if (Driver.TRACE) {
                Object[] args = { new Boolean(autoCommit) };
                Debug.methodCall(this, "setAutoCommit", args);
            checkClosed();
            if (this.transactionsSupported) {
                // this internal value must be set first as failover depends on it
                // being set to true to fail over (which is done by most
                // app servers and connection pools at the end of
                // a transaction), and the driver issues an implicit set
                // based on this value when it (re)-connects to a server
                // so the value holds across connections
                this.autoCommit = autoCommit;
                String sql = "SET autocommit=" + (autoCommit ? "1" : "0");
                execSQL(sql, -1, this.database);
            } else {
                if ((autoCommit == false) && (this.relaxAutoCommit == false)) {
                    throw new SQLException("MySQL Versions Older than 3.23.15 "
                        + "do not support transactions", "08003");
                } else {
                    this.autoCommit = autoCommit;
            return;
         * gets the current auto-commit state
         * @return Current state of the auto-commit mode
         * @exception java.sql.SQLException (why?)
         * @see setAutoCommit
        public boolean getAutoCommit() throws java.sql.SQLException {
            if (Driver.TRACE) {
                Object[] args = new Object[0];
                Debug.methodCall(this, "getAutoCommit", args);
                Debug.returnValue(this, "getAutoCommit",
                    new Boolean(this.autoCommit));
            return this.autoCommit;
         * A sub-space of this Connection's database may be selected by
         * setting a catalog name.  If the driver does not support catalogs,
         * it will silently ignore this request
         * <p><b>Note:</b> MySQL's notion of catalogs are individual databases.
         * @param catalog the database for this connection to use
         * @throws java.sql.SQLException if a database access error occurs
        public void setCatalog(String catalog) throws java.sql.SQLException {
            if (Driver.TRACE) {
                Object[] args = { catalog };
                Debug.methodCall(this, "setCatalog", args);
            checkClosed();
            String quotedId = this.dbmd.getIdentifierQuoteString();
            if ((quotedId == null) || quotedId.equals(" ")) {
                quotedId = "";
            StringBuffer query = new StringBuffer("USE ");
            query.append(quotedId);
            query.append(catalog);
            query.append(quotedId);
            execSQL(query.toString(), -1, catalog);
            this.database = catalog;
         * Return the connections current catalog name, or null if no
         * catalog name is set, or we dont support catalogs.
         * <p><b>Note:</b> MySQL's notion of catalogs are individual databases.
         * @return the current catalog name or null
         * @exception java.sql.SQLException if a database access error occurs
        public String getCatalog() throws java.sql.SQLException {
            if (Driver.TRACE) {
                Object[] args = new Object[0];
                Debug.methodCall(this, "getCatalog", args);
                Debug.returnValue(this, "getCatalog", this.database);
            return this.database;
         * DOCUMENT ME!
         * @return DOCUMENT ME!
        public boolean isClosed() {
            if (Driver.TRACE) {
                Object[] args = new Object[0];
                Debug.methodCall(this, "isClosed", args);
                Debug.returnValue(this, "isClosed", new Boolean(this.isClosed));
            return this.isClosed;
         * Returns the character encoding for this Connection
         * @return the character encoding for this connection.
        public String getEncoding() {
            return this.encoding;
         * @see Connection#setHoldability(int)
        public void setHoldability(int arg0) throws SQLException {
            // do nothing
         * @see Connection#getHoldability()
        public int getHoldability() throws SQLException {
            return ResultSet.CLOSE_CURSORS_AT_COMMIT;
         * NOT JDBC-Compliant, but clients can use this method
         * to determine how long this connection has been idle.
         * This time (reported in milliseconds) is updated once
         * a query has completed.
         * @return number of ms that this connection has
         * been idle, 0 if the driver is busy retrieving results.
        public long getIdleFor() {
            if (this.lastQueryFinishedTime == 0) {
                return 0;
            } else {
                long now = System.currentTimeMillis();
                long idleTime = now - this.lastQueryFinishedTime;
                return idleTime;
         * Should we tell MySQL that we're an interactive client
         * @return true if isInteractiveClient was set to true.
        public boolean isInteractiveClient() {
            return isInteractiveClient;
         * A connection's database is able to provide information describing
         * its tables, its supported SQL grammar, its stored procedures, the
         * capabilities of this connection, etc.  This information is made
         * available through a DatabaseMetaData object.
         * @return a DatabaseMetaData object for this connection
         * @exception java.sql.SQLException if a database access error occurs
        public java.sql.DatabaseMetaData getMetaData() throws java.sql.SQLException {
            checkClosed();
            return new DatabaseMetaData(this, this.database);
         * You can put a connection in read-only mode as a hint to enable
         * database optimizations
         * <B>Note:</B> setReadOnly cannot be called while in the middle
         * of a transaction
         * @param readOnly - true enables read-only mode; false disables it
         * @exception java.sql.SQLException if a database access error occurs
        public void setReadOnly(boolean readOnly) throws java.sql.SQLException {
            if (Driver.TRACE) {
                Object[] args = { new Boolean(readOnly) };
                Debug.methodCall(this, "setReadOnly", args);
                Debug.returnValue(this, "setReadOnly", new Boolean(readOnly));
            checkClosed();
            this.readOnly = readOnly;
         * Tests to see if the connection is in Read Only Mode.  Note that
         * we cannot really put the database in read only mode, but we pretend
         * we can by returning the value of the readOnly flag
         * @return true if the connection is read only
         * @exception java.sql.SQLException if a database access error occurs
        public boolean isReadOnly() throws java.sql.SQLException {
            if (Driver.TRACE) {
                Object[] args = new Object[0];
                Debug.methodCall(this, "isReadOnly", args);
                Debug.returnValue(this, "isReadOnly", new Boolean(this.readOnly));
            return this.readOnly;
         * @see Connection#setSavepoint()
        public java.sql.Savepoint setSavepoint() throws SQLException {
            throw new NotImplemented();
         * @see Connection#setSavepoint(String)
        public java.sql.Savepoint setSavepoint(String arg0)
            throws SQLException {
            throw new NotImplemented();
         * DOCUMENT ME!
         * @return DOCUMENT ME!
        public TimeZone getServerTimezone() {
            return this.serverTimezone;
         * DOCUMENT ME!
         * @param level DOCUMENT ME!
         * @throws java.sql.SQLException DOCUMENT ME!
        public void setTransactionIsolation(int level) throws java.sql.SQLException {
            if (Driver.TRACE) {
                Object[] args = { new Integer(level) };
                Debug.methodCall(this, "setTransactionIsolation", args);
            checkClosed();
            if (this.hasIsolationLevels) {
                StringBuffer sql = new StringBuffer(
                        "SET SESSION TRANSACTION ISOLATION LEVEL ");
                switch (level) {
                case java.sql.Connection.TRANSACTION_NONE:
                    throw new SQLException("Transaction isolation level "
                        + "NONE not supported by MySQL");
                case java.sql.Connection.TRANSACTION_READ_COMMITTED:
                    sql.append("READ COMMITTED");
                    break;
                case java.sql.Connection.TRANSACTION_READ_UNCOMMITTED:
                    sql.append("READ UNCOMMITTED");
                    break;
                case java.sql.Connection.TRANSACTION_REPEATABLE_READ:
                    sql.append("REPEATABLE READ");
                    break;
                case java.sql.Connection.TRANSACTION_SERIALIZABLE:
                    sql.append("SERIALIZABLE");
                    break;
                default:
                    throw new SQLException("Unsupported transaction "
                        + "isolation level '" + level + "'", "S1C00");
                execSQL(sql.toString(), -1, this.database);
                isolationLevel = level;
            } else {
                throw new java.sql.SQLException("Transaction Isolation Levels are "
                    + "not supported on MySQL versions older than 3.23.36.", "S1C00");
         * Get this Connection's current transaction isolation mode.
         * @return the current TRANSACTION_* mode value
         * @exception java.sql.SQLException if a database access error occurs
        public int getTransactionIsolation() throws java.sql.SQLException {
            if (Driver.TRACE) {
                Object[] args = new Object[0];
                Debug.methodCall(this, "getTransactionIsolation", args);
                Debug.returnValue(this, "getTransactionIsolation",
                    new Integer(isolationLevel));
            if (this.hasIsolationLevels) {
                 java.sql.Statement stmt = null;
                 java.sql.ResultSet rs = null;
                 try {
                      stmt = this.createStatement();
                      String query = null;
                      if (this.io.versionMeetsMinimum(4, 0, 3)) {
                           query = "SHOW VARIABLES LIKE 'tx_isolation'";
                      } else {
                           query = "SHOW VARIABLES LIKE 'transaction_isolation'";
                      rs = stmt.executeQuery(query);
                      if (rs.next()) {
                           String s = rs.getString(2);
                           if (s != null) {
                                  Integer intTI = (Integer) mapTransIsolationName2Value.get(s);
                                  if (intTI != null) {
                                       return intTI.intValue();
                           throw new SQLException("Could not map transaction isolation '" + s + " to a valid JDBC level.", "S1000");
                      } else {
                           throw new SQLException("Could not retrieve transaction isolation level from server", "S1000");
                 } finally {
                      if (rs != null) {
                           try {
                                rs.close();
                           } catch (Exception ex) {
                                // ignore
                           rs = null;
                      if (stmt != null) {
                           try {
                                stmt.close();
                           } catch (Exception ex) {
                                // ignore
                           stmt = null;
            return isolationLevel;
         * JDBC 2.0
         * Install a type-map object as the default type-map for
         * this connection
         * @param map the type mapping
         * @throws SQLException if a database error occurs.
        public void setTypeMap(java.util.Map map) throws SQLException {
            this.typeMap = map;
         * JDBC 2.0
         * Get the type-map object associated with this connection.
         * By default, the map returned is empty.
         * @return the type map
         * @throws SQLException if a database error occurs
        public synchronized java.util.Map getTypeMap() throws SQLException {
            if (this.typeMap == null) {
                this.typeMap = new HashMap();
            return this.typeMap;
         * The first warning reported by calls on this Connection is
         * returned.
         * <B>Note:</B> Sebsequent warnings will be changed to this
         * java.sql.SQLWarning
         * @return the first java.sql.SQLWarning or null
         * @exception java.sql.SQLException if a database access error occurs
        public java.sql.SQLWarning getWarnings() throws java.sql.SQLException {
            if (Driver.TRACE) {
                Object[] args = new Object[0];
                Debug.methodCall(this, "getWarnings", args);
                Debug.returnValue(this, "getWarnings", null);
            return null;
         * Allow use of LOAD LOCAL INFILE?
         * @return true if allowLoadLocalInfile was set to true.
        public boolean allowLoadLocalInfile() {
            return this.allowLoadLocalInfile;
         * DOCUMENT ME!
         * @return DOCUMENT ME!
        public boolean capitalizeDBMDTypes() {
            return this.capitalizeDBMDTypes;
         * After this call, getWarnings returns null until a new warning
         * is reported for this connection.
         * @exception java.sql.SQLException if a database access error occurs
        public void clearWarnings() throws java.sql.SQLException {
            if (Driver.TRACE) {
                Object[] args = new Object[0];
                Debug.methodCall(this, "clearWarnings", args);
            // firstWarning = null;
         * In some cases, it is desirable to immediately release a Connection's
         * database and JDBC resources instead of waiting for them to be
         * automatically released (                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      

Maybe you are looking for