Results 1 to 8 of 8
  1. #1
    Join Date
    Sep 2009
    Posts
    4
    Rep Power
    0

    Default Datasource problem

    Hi all ,

    I am using TCL file with multiple queries as input to the web services.

    From following statement I am getting always (like multiple tcl client ) getting single
    con object.

    conn = ServiceLookUp.getInstance().getDataSource(config). getConnection();

    **** ServiceLookUp class is single tone class .
    ********** My Resource tag in server.xml file

    <Resource name="jdbc/test"
    auth="Container"
    scope="Shareable"
    type="javax.sql.DataSource"
    factory="org.apache.tomcat.dbcp.dbcp.BasicDataSour ceFactory"
    maxActive="30"
    maxIdle="10"
    maxWait="10000"
    url="jdbc:oracle:thin:@***.***.***.***:1521:MCSTEM P"
    driverClassName="oracle.jdbc.driver.OracleDriver"
    username="mcstest"
    password="mcstest"
    removeAbandoned="true"
    removeAbandonedTimeout="60"
    logAbandoned="true" />

    Let me know how to get the different object instead of getting single object


    Please do need full, Thanks

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    I don't understand. Do you want to have many connections returned? Why?

  3. #3
    Join Date
    Sep 2009
    Posts
    4
    Rep Power
    0

    Default

    If I am running multiple tcl clients , I am getting the resultset exhausted and connection already closed errors.

    Because of same object is sharing the multiple tcl clients. One tcl is closed the connection
    Other tcl client is trying to asses the same connection.

    i.e reason I want different connection objects

  4. #4
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    But those errors are most likely coming from errors elsewhere. You should have posted the errors you were getting.
    Check the logic of your code. Perhaps you are trying to read data from closed connections.

  5. #5
    Join Date
    Sep 2009
    Posts
    4
    Rep Power
    0

    Default

    When multiple users access web service or any module related to database, same connection is served for all requests and errors like "Exhauseted Resultset " are thrown. Datasource is configured in server.xml of tomcat and connection is fetched through datasource. Web server used is Tomcat 5.5 and database is Oracle 9i.



    I have given the steps used by one of the modules called Query Service. This gives the problem described above.



    The TCL client sends query in a pre-defined format to the web service. It uses SOAP messages.

    The web service which is based on Axis2, will parse the query, submit the query to the database server through application server (Tomcat).
    The application server query data from Oracle database.

    The web service process result and send response back to the client in a pre-defined format.

    The TCL client will then parse the formatted result and return the response to the user.

    When multiple users try to access Query Service, we are facing problem. This module works fine for single user.

  6. #6
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    The problem probably lies in how you have your classes set up. You should be using connection pooling so users don't have to share the one connection. You also need to make sure that you acquire a connection, use it, and close it soon after every time. Don't make connections instance variables because multiple threads accessing them could mess them up.

  7. #7
    kishan.java is offline Member
    Join Date
    Oct 2009
    Posts
    8
    Rep Power
    0

    Default

    Hi All,

    I am new to java.

    I want to get the data from 3 table.

    first i will use a query on both table . after getting the result set. i want to write on more query inside the result set with where clause .

    so that i will get only corresponding match records from third table in the result set.

    please let me know how to write the code.

    my code is as below:


    try{

    String sql = "select DISTINCT REQUISITIONS.FOLDERID, REQUISITIONS.AUTOREQ, REQUISITIONS.MANAGERID, REQUISITIONS.RECRUITERID, " +
    " REQUISITIONRESPONSE.FOLDERID, REQUISITIONRESPONSE.QUESTION_TYPE_ID, REQUISITIONRESPONSE.RESPONSE " +
    " from REQUISITIONS,REQUISITIONRESPONSE" +
    " where REQUISITIONS.FOLDERID=REQUISITIONRESPONSE.FOLDERID ";



    System.out.println(":kishan test data1 " );



    ResultSet rs1 = st.executeQuery(sql);

    while(rs1.next())
    {
    System.out.println(":kishan test data2 " );

    int aInt = Integer.parseInt(rs1.getString(1));


    Candidate candidate=new Candidate();
    candidate.setRsKey(+aInt);

    candidate.setEmail(rs1.getString(2));
    candidate.setName(rs1.getString(3));
    candidate.setPhone(rs1.getString(4));

    candidate.setDegree(rs1.getString(5));
    candidate.setGradyear(rs1.getString(6));
    candidate.setSchoolname(rs1.getString(7));

    String sql1 = "select QUESTION_TYPE_ID, QUESTION_DESC from QUESTION_TYPE where QUESTION_TYPE_ID='"+rs1.getString(6)+"'";
    ResultSet rs2 = st.executeQuery(sql1);

    while(rs2.next())
    {

    System.out.println(":kishan test data in second query " +rs2.getString(1));
    if (rs2.getString(2).equals("Cost Center")){

    candidate.setJobtitle(rs1.getString(7));
    }else if (rs2.getString(2).equals("Business Unit")){
    candidate.setOrgname(rs1.getString(7));
    }



    }
    candidate.setJobtitle(rs1.getString(8));
    candidate.setOrgname(rs1.getString(9));



    list.add(candidate);
    }

    }

    Here i am getting Exhuasted Result set exception.

  8. #8
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,014
    Rep Power
    20

    Default

    First off, start your own thread on the forum instead of resurrecting one from 18 months ago.

    Then we can look at your problem.

Similar Threads

  1. DriverManager vs. DataSource
    By drieskn in forum JDBC
    Replies: 4
    Last Post: 02-05-2009, 04:38 AM
  2. JasperReports dataSource.
    By hendrix79 in forum Advanced Java
    Replies: 0
    Last Post: 01-29-2009, 10:54 AM
  3. Datasource & JNDI error
    By shweta in forum New To Java
    Replies: 4
    Last Post: 05-15-2008, 08:43 AM
  4. Cannot set DataSource for RowSet
    By piterskiy in forum JDBC
    Replies: 0
    Last Post: 12-07-2007, 07:58 PM
  5. Datasource
    By samson in forum JavaServer Pages (JSP) and JSTL
    Replies: 3
    Last Post: 04-02-2007, 11:06 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •