Problem with getString() in OCCI

/* <br>
My name is Chandra, <br>
I am facing a problem in retriving many records from a table using OCCI <br>
I am using VC6.0 in WindowXP - SP2 with Oracle 10G client <br>
<br>
Here is my Example <br>
I have no issue with the program when there are 10 records in emp table <br>
where as I am getting an error when there are 20 records. <br>
Code is executing till the end <br>
it also printed Finished Printing which is in main <br>
and gave the following error <br>
<br>
ERROR::: <br>
1.exe has encountered a problem and needs to close. <br>
we are sorry for the inconvenience <br>
Error Signature is saying that it happend with Mod Name ntdll.dll and <br>
ModVer: 5.1.2600.2180 and Offset:00010fc2 <br>
When I tried by modifying line <br>
emp1.ename     = rs->getString(1); <br>
to <br>
emp1[i].ename     = "Chandra"; <br>
it is working Perfectly <br>
Please advice what is wrong with getString(1); <br>
Is there any other function which I can use to store the value of ename into a string? <br>
If there is please advice me how to use. <br>
Thanks a lot for your support <br>
Regards, <br>
Chandra. <br>
*/ <br>
<b>
#include <iostream> <br>
#include <occi.h> <br>
#include <stdio.h> <br>
using     namespace oracle::occi; <br>
using     namespace std; <br>
int          numberofrecords; <br>
struct emp <br>
{ <br>
     string     ename; <br>
     int     age; <br>
     int     year; <br>
}emp1[50]; <br>
<br>
void empselect() <br>
{ <br>
     string     user = "scott"; <br>
     string     pass = "tiger"; <br>
     string     osid = ""; <br>
     Environment* env = Environment::createEnvironment(Environment::DEFAULT); <br>
     printf("Environment is Set \n"); <br>
     int ret = 0; <br>
     int i=1; <br>
     try <br>
     { <br>
          printf("Creating the Connection\n"); <br>
          Connection *con = env->createConnection(user, pass, osid); <br>
          printf("\n"); <br>
          cout << "Connection Established - Connected as " << user << "/" << osid << "." << endl; <br>
          cout << "Creating Statement" << endl; <br>
          Statement stmt     = con->createStatement("select from emp"); <br>
          cout << "Executing Query" << endl; <br>
          ResultSet *rs     = stmt->executeQuery(); <br>
          while (rs->next()) <br>
          { <br>
               emp1[i].ename     = rs->getString(1); <br>
               emp1[i].age     = rs->getNumber(2); <br>
               emp1[i].year     = rs->getNumber(3); <br>
               i++; <br>
          } <br>
          numberofrecords = i; <br>
          printf("Out of while loop \n"); <br>
          stmt->closeResultSet(rs); <br>
          cout << "Closing connection." << endl; <br>
          env->terminateConnection(con); <br>
     } <br>
     catch (SQLException ea) <br>
     { <br>
          cout <<"Inside Exception - OBULA\n"; <br>
          cerr << "Can’t connect: " << ea.what(); <br>
          ret = 1; <br>
     } <br>
     cout << "Before Termination" << endl; <br>
     Environment::terminateEnvironment(env); <br>
     cout <<"Terminated \n"; <br>
} <br>
<br>
void main() <br>
{ <br>
     int j; <br>
     cout << "Calling justlasd \n"; <br>
     empselect(); <br>
     cout<<"Priniting Results\n"; <br>
     for(j=0;j<numberofrecords;j++) <br>
          cout << "emp - "<< emp1[j].ename << "\tage - "<< emp1[j].age << "\t - " << emp1[j].year << endl; <br>
     cout <<"Finished printing"; <br>
}</b>

Hey guys try dis code........i too had the same problem soo i hav solved tht in dis way.....
#ifndef DllExport
#define DllExport     __declspec( dllexport )
#endif
#include <iostream.h>
#include <occi.h>
using namespace oracle::occi;
using namespace std;
typedef struct DllExport MultisiteTableRecord
unsigned int ReqID; //will point to table 1
} MultisiteTableRecord;
typedef OCCI_STD_NAMESPACE::vector<string> cols;
typedef struct DllExport RowType : public MultisiteTableRecord
     int id;
string name;
} RowList;
enum
ID = 1,
NAME,
class demo{
public:
Environment* env ;     
     Connection* conn;
     Statement* stmt;
     ResultSet *rs;
     list<RowList> row1;
int main( )
     demo *d = new demo;
     try{          
          d->env = Environment::createEnvironment(Environment::OBJECT);          
          d->conn = d->env->createConnection( "infodba", "infodba","tceng" );          
          cout << "Environment and Connection created" << endl;     
          string sqlQuery = "SELECT id,name FROM demo ";          
          d->stmt = d->conn->createStatement(sqlQuery);
          d->rs = d->stmt->executeQuery ();
          int row =1 ;
          ResultSet::Status status;
          while((status = d->rs->next()) == (ResultSet::DATA_AVAILABLE))
               RowList r;
               r.id = d->rs->getInt(ID);
               r.name = d->rs->getString(2);
               d->row1.push_back(r);
          list<RowList>::iterator i;
          for (i = d->row1.begin(); i != d->row1.end(); i++){
                    cout<<i->name.c_str()<<endl;
                    cout<<i->id<<endl;
cout << "we" ;
          d->stmt->closeResultSet(d->rs);//to free resources
     d->conn->terminateStatement(d->stmt);
     d->env->terminateConnection(d->conn);
     Environment::terminateEnvironment(d->env);
          cout << "Closing connection." << endl;
     catch(int error){
cout << "hi" ;
          cout << error;
          return 0;
}

Similar Messages

  • Problem with OCCI

    Hi,
    I have a problem with OCCI, when i create the connection the following exception appears:
    ORA-24960 - the attribute OCI_ATTR_USERNAME is greater than the maximum allowable length of 255.
    A piece of code:
    string userName;
         string password;
         string connectionString;
         userName = "lucas";
         password = "lucas";
         connectionString = "lucas"
         printf("Imprimindo o valor das váriaveis \n\n");
         printf("User name --");
         printf(userName.c_str());
         printf("\n");
         printf("Password --");
         printf(password.c_str());
         printf("\n");
         printf("Connection String --");
         printf(connectionString.c_str());
         printf("\n\n");
         Environment *env;
         Connection *cn;
         try{          
              printf("Criando Environment. \n");
              env = Environment::createEnvironment(Environment::DEFAULT);
              printf("Environment criado. \n");
         }catch(SQLException e){
              printf(e.what());
              printf("\n");
         try{          
              printf("Criando Connection.\n");
              cn = env->createConnection(userName.c_str(),password.c_str(),connectionString.c_str()); \\ Exception happens here
              printf("Connection criada. \n");
         }catch(SQLException e){
         printf(e.what());
              printf("\n");
    TKs.
    Lucas

    hello,i have the same problem,now i havn't overcome the problem.
    i think that the problem is the system envirment path problem.
    or the instant client problem.

  • Problems with varchar2 column and a select statement

    Hi to all,
    I am new to ODP...so I would really appreciate your help..
    I am having problems with using the following code:
    con.ConnectionString = "User Id=bla;Password=bla;Data Source=bla;";
    string cmdQuery = "SELECT * from try where data ="+textBox1.Text+"";
    OracleCommand cmd = new OracleCommand(cmdQuery);
    cmd.Connection = con;
    cmd.CommandType = CommandType.Text;
    OracleDataReader reader = cmd.ExecuteReader();
    while (reader.Read())
    MessageBox.Show(reader.GetString(0)+"");
    cmd.Dispose();
    con.Close();
    where:
    data is the name of a field in the table
    textBox1 is the name of a text box where the user inserts the values..
    The error that appears is "Invalid identifier"..
    I hope it makes sense...and please help...

    Hi,
    I'm fairly sure it IS the single quotes actually. Print out the string you're trying to excute, then try it outside odp.net, does it work?
    For example:
    SQL> select * from dual where dummy=foo;
    select * from dual where dummy=foo
    ERROR at line 1:
    ORA-00904: "FOO": invalid identifier
    SQL> select * from dual where dummy='foo';
    no rows selected
    Cheers,
    Greg

  • Problem with ResultSet in a loop

    hi,
    i have a probleme with ResultSet when, my code is bellow
    ResultSet rs = stmt.executeQuery(sql);
    sql="SELECT NAME FROM prestationtemp";
    rs = stmt.executeQuery(sql);
    String sqlDel="";
    while (rs.next())
    sqlDel="Delete from prestation where NAME="+rs.getString("NAME");
    stmt.executeQuery(sqlDel);
    the problem is that the loop iterate just once like if there is just one record, and if I remove stmt.executeQuery(sqlDel); from the loop it iterate normaly.
    thanks in advance.

    you will need to use 2 Statments e.g.
    Statement stmt1 = connection.createStatement();
    Statement stmt2 = connection.createStatement();
    ResultSet rs = stmt.executeQuery(sql);
    sql="SELECT NAME FROM prestationtemp";
    rs = stmt1.executeQuery(sql);
    String sqlDel="";
    while (rs.next())
    sqlDel="Delete from prestation where NAME="+rs.getString("NAME");
    stmt2.executeQuery(sqlDel);
    } When you reuse a Statement, any resultsets previously created are automatically closed.
    Looking at your code, it seems that you only need 1 SQL call:
    Delete from prestation where NAME in (SELECT NAME FROM prestationtemp)
    Much more efficient!

  • Problem with date format dd/mm/yyyy. But I need to convert yyyy-mm-dd.

    Dear friends,
    I have the problem with date format. I receiving the date with the format dd/mm/yyyy. But I can upload to MySQL only in the format of yyyy-mm-dd.
    how should I handle this situation, for this I've created these code lines.But I have some problem with these line. please help me to solve this problem.
    String pattern = "yyyy-mm-dd";
    SimpleDateFormat format = new SimpleDateFormat(pattern);
    try {
    Date date = format.parse("2006-02-12");
    System.out.println(date);
    } catch (ParseException e) {
    e.printStackTrace();
    System.out.println(format.format(new Date()));
    this out put gives me Tue Apr 03 00:00:00 IST 2007
    But I need the date format in yyyy-mm-dd.
    regards,
    maza
    thanks in advance.

    Thanks Dear BalusC,
    I tried with this,
    rs.getString("DATA_SCAD1")// where the source from .xls files
    String pattern = "yyyy-MM-dd";
    SimpleDateFormat format = new SimpleDateFormat(pattern);
    try {
    Date date = format.parse("DATA_SCAD1");
    System.out.println(date);
    } catch (ParseException e) {
    e.printStackTrace();
    System.out.println(format.format(new Date()));
    this out put gives me Tue Apr 03 00:00:00 IST 2007
    But I want to display the date format in yyyy-mm-dd.
    regards,
    maza

  • Problem with OCI call  and  how to install and use 'DEBUG_EXTPROC' on Linux

    Hi,
    Can any one let me know how I can install and use this debug_extproc package. I have installed oracle XE server on Linux machine(32-bit).
    When I use : DEBUG_EXTPROC.STARTUP_EXTPROC_AGENT' ... i get an error saying that : it is not declared.
    I tried looking in all the directories but did not find the dbgextp.sql(which is required in order to install that package).And tried searching on google but could not get any relevant information.
    Also I am newbie to OCI call interface and also to C programming too: I have coded a external procedure or custom user aggregate in C. But since I was using C++ : 'set' STL. I have compiled my program using g++ instead of gcc and I have correspondingly modified the make file in public/demo directory.
    So, is it fine to do it that way: using OCI (instead of OCCI(C++)) but again compiling the pgm as a regular C++ using g++ instead of gcc.(But rest of the pgm including printf statements : everything is in C).
    Also I have created the library from my : custagg.so library:
    SQL> create or replace library custagg is '$ORACLE_HOME/lib/custagg.so'
    But my aggregate function implemented as external C function using OCI is either not recognised or else : if recognized then there is some error because of which i am getting the following errors : ORA-06522
    SQL> select MinDistance(TT) from egg1;
    select MinDistance(TT) from egg1
    ERROR at line 1:
    ORA-06520: PL/SQL: Error loading external library
    ORA-06522: /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/custagg.so:
    cannot dynamically load executable
    Please kindly answers my queries and trying to resolve this for almost 4 days now and could not find any clue on how to get this done.
    Thanks,
    -NN

    #/bin/make
    # Make file for OCI,OCCI and ODBC demos
    # Usage :
    # For compiling & linking the cdemo81.c file
    # make -f demo_xe.mk buildoci CDEMOEXE=cdemo81 CDEMOOBJS=cdemo81.o
    .SUFFIXES: .o .c .cpp
    ICINCHOME=$(ORACLE_HOME)/rdbms/public/
    ICLIBHOME=$(ORACLE_HOME)/lib
    ICLIBPATH=-L$(ICLIBHOME)
    THREADLIBS=-lthread
    CCLIB=$(ICLIBPATH) -lclntsh $(THREADLIBS)
    OCCILIB=$(ICLIBPATH) -locci -lclntsh $(THREADLIBS)
    CCINCLUDES = -I$(ICINCHOME)
    CCFLAGS=$(CCINCLUDES) -D_REENTRANT -g -xs
    LDFLAGS=
    SO_EXT=.so
    EXTLDFLAGS=$(LDFLAGS) -shared
    REMOVE=rm -rf
    MKLINK=ln
    MAKE=make
    MAKEFILE=demo_xe.mk
    CDEMOEXE=custagg.so
    CDEMOOBJS=custagg.o
    OCCIDEMO=occidml
    OCCIOBJDEMO=occiobj
    OTT=$(ORACLE_HOME)/bin/ott
    OCCIOTTUSR=hr
    OCCIOTTPWD=hr
    ODBCDEMOEXE=odbcdemo
    ODBCDEMOOBJS=odbcdemo.o
    AQDEMOEXE=ociaqdemo00
    AQDEMOOBJS=ociaqdemo00.o
    EXTDEMO=extdemo2.so
    CC=/usr/bin/g++
    echo "LIBCLNT value is :" $(LIBCLNT)
    echo "CC value is :" $(CC)
    .c.o:
    g++ -c -I$(ICINCHOME) $(CCFLAGS) $<
    all: clean buildoci
    echo "LIBCLNT value is :" $(LIBCLNT)
    buildoci: $(LIBCLNT) $(CDEMOOBJS)
    g++ -o $(CDEMOEXE) $(LDFLAGS) $(CDEMOOBJS) $(CCLIB)
    echo "CC value is :" $(CC)
    echo "LIBCLNT value is :" $(LIBCLNT)
    clean:
    $(REMOVE) $(CDEMOOBJS) $(CDEMOEXE)
    # This port-specific file is currently empty on Solaris. Product
    # lines may use this file to override compiler definitions and
    # flags used in occi.mk.
    # Linux compiler definitions
    CC=/usr/bin/gcc
    cc=/usr/bin/gcc
    CCFLAGS=$(CCINCLUDES) -DLINUX -D_GNU_SOURCE -D_REENTRANT -g
    LDFLAGS=-g
    # This macro CCINCLUDES has to be redefined on Linux because of
    # the existence of the 'new' directory in t_work. The name new
    # clashes with a system header file.
    CCINCLUDES = -idirafter .
    THREADLIBS=-lpthread
    ifdef BUILD_CCC296
    CC=/usr/bin/g++296
    endif
    And I am executing the make file using the command :
    make -f demo12.mk buildoci CDEMOEXE=custagg.so CDEMOOBJS=custagg.o
    I am not getting any error while running this make file.
    Can you please tell me whether PLSQL/Oracle is able to locate the file or not. Incase, if it is locating the file but due to some error in the custagg.so it is throwing that error. If this is the case, is there any way that i can debug the C program .....how can i install the debug_extproc package.. I am really new to C & OCI ... if the custagg.so is being located then there might be some problem with the way I am dynamically allocating memory to some variables.
    Please kindly reply to this Post/response.
    Please let me know if you also want to see my program code.
    Thanks & Regards,
    -NN

  • Beginner Has Problem With Loading JDBC Driver Using MySQL

    Hi, I am having problem with loading JDBC driver, and need your diagnotic help.
    1. I have installed MySQL (C:\mysql), created a databse (soup), and created a littel table (VIDEOS). I am able to see the table in the console:
    sql> select * from videos
    2. I have downloaded the latest version of Connector/J (mysql-connector-java-3.1.0-alpha.zip), and unzip the zip file into my C:\ directory.
    3. I copied the mysql-connector-java-3.1.0-alpha-bin.jar to the C:\j2sdk1.4.1_02\jre\lib\ext folder and it is in my CLASSPATH
    4. MySQL server is running
    C:\> C:\mysql\bin\mysqld-nt --standalone
    5. open another DOS window and use the database
    mysql>USE SOUP
    6. succesfully compiled a Java program (javac Test.java):
    import java.sql.* ;
    public class Test
    public static void main( String[] args )
    try
    Class.forName("org.gjt.mm.mysql.Driver").newInstance();
    try
    Connection con = DriverManager.getConnection( "jdbc:mysql://localhost:3306/soup" );
    try
    Statement statement = con.createStatement();
    ResultSet rs = statement.executeQuery("SELECT TITLE FROM VIDEOS");
    while ( rs.next() )
    System.out.println( rs.getString( "TITLE" ) );
    rs.close();
    statement.close();
    catch ( SQLException e )
    System.out.println( "JDBC error: " + e );
    finally
    con.close();
    catch( SQLException e )
    System.out.println( "could not get JDBC connection: " + e );
    catch( Exception e )
    System.out.println( "could not load JDBC driver: " + e );
    7. when I run the Java program (java Test), I got
    the message:
    could not load JDBC driver: java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver
    What am I missing?

    Hi,
    I missed to specify test in my last post.
    Try running your program by explicitly setting the classspath when
    running your program . java -classpath c:\mysql-connector-java-3.1.0-alpha-bin.jar test
    Make sure your jar file contains org.gjt.mm.mysql.Driver class

  • Problem with GenericCatalogDAO  JDBC Resultset using parameters not working

    Hello
    I have a problem with Petstore GenericCatalogDAO. java. The problem is the behaviour of the resultset object when retrieving data from the database.Below are two synareos one that
    works (when) hard coded and one that does not work when parameter values passed into the the result set.
    1. The code the WORKS.
    statement = connection.prepareStatement("select a.productid , name, descn from product a, product_details b
    where a.productid = b.productid and locale= 'en_US' and a.catid = 'FISH' order by name"
    ,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
    resultSet = statement.executeQuery();
    resultSet.absolute(1);
    String s = resultSet.getString(1);
    The code that gives me a 'exhausted resultset' error which I think means no results
    String[] parameterValues = new String[] { locale.toString(), categoryID };(For example parameters are 'en_US' and 'FISH')
    statement = connection.prepareStatement("select a.productid , name, descn from product a, product_details b
    where a.productid = b.productid and locale=? and a.catid =? order by name"
    ,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
    for (int i = 0; i < parameterValues.length; i++) {
    statement.setString(i + 1, parameterValues[i]);
    resultSet = statement.executeQuery();
    resultSet.absolute(1);
    String s = resultSet.getString(1);
    There is obviously a problem using these named parametevalues with these preparedstatement resultset, Does anybody know anything about this and a fix for it????
    Cheers. Roger

    Which version of PetStore are you using?
    -Larry

  • Problem with Retrieving Parent records

    Hi
    I am facing some problem with Relation ship tables
    I am able to retrieve all child relation record by using Parent record id, but the other why around is not working that is
    I am unable to retrieve  all parent records by using a child record.
    Please can you help out this..
    find the below sample method which i was trying
    public HashMap<String, Record[]> getMemberRecords(Record[] rec,
                   RetrieveRelationshipsCommand relation,
                   RepositorySchemaEx repositorySchema, String code,
                   HashMap<String, Record[]> returnMap) throws MDMException {
              LOG.debug("calling getMemberRecords");
              HashMap<String, Record[]> returnVal = returnMap;
              LOG.debug("Assigning returnType to default HashMap.");
              try {
                   for (int recordCount = 0; recordCount < rec.length; recordCount++) {
                        LOG.debug("For recordCount = " + recordCount);
                        Record tempRec = rec[recordCount];
                        relation.setAnchorRecord(tempRec);
                        LOG.debug(" setting AnchorRecord = " + tempRec);
                        relation.setLoadRecords(true);
                        LOG.debug(" setting LoadRecords = " + true);
                        relation.setGetChildren(false);
                        LOG.debug(" setGetChildren has setup with  = " + true);
                        relation.setAnchorRecordId(tempRec.getId());
                        LOG.debug(" setting AnchorRecordId = " + tempRec.getId());
                        relation.setRelationshipId(repositorySchema
                                  .getRelationshipId(code));
                        LOG.debug("Before execution relation execute.");
                        relation.execute();
                        LOG.debug("After execution relation execute.");
                        RelationshipGroup group = relation.getRelationshipGroup();
                        LOG.debug("Retrieved Relationship Group.");
                        Relationship[] relat = group.getMembers();
                        LOG.debug("Length = "+relat.length);
                        Record[] tempRecords = null;
                        if (relat != null) {
                             int length = relat.length;
                             LOG.debug("Length = "+length);
                             tempRecords = new Record[length];
                             for (int count = 0; count < length; count++) {
                                  tempRecords[count] = relat[count].getMemberRecord();
                        if (tempRecords != null) {
                             LOG
                                       .info("Records size is not equal to Null So Calling recursive getMemberRecords.");
                             returnMap = getMemberRecords(tempRecords, relation,
                                       repositorySchema, code, returnMap);
                        LOG
                                  .debug("Setting HashMap Value Values with Parent ID, records[]");
                        returnVal.put(tempRec.getId().getString(), tempRecords);
              } catch (SessionException se) {
                   MDMException exception = new MDMException();
                   ErrorContext ec = new ErrorContext();
                   ec.setErrorMessage(se.getMessage());
                   ec.setErrorCode("MetadataException : " + se);
                   LOG.fatal(se, se.getCause());
                   se.printStackTrace();
                   exception.setContext(ec);
                   throw exception;
              } catch (IllegalArgumentException iae) {
                   MDMException exception = new MDMException();
                   ErrorContext ec = new ErrorContext();
                   ec.setErrorMessage(iae.getMessage());
                   ec.setErrorCode("MetadataException : " + iae);
                   LOG.fatal(iae, iae.getCause());
                   iae.printStackTrace();
                   exception.setContext(ec);
                   throw exception;
              } catch (CommandException ce) {
                   MDMException exception = new MDMException();
                   ErrorContext ec = new ErrorContext();
                   ec.setErrorMessage(ce.getMessage());
                   LOG.fatal(ce, ce.getCause());
                   ce.printStackTrace();
                   exception.setContext(ec);
                   throw exception;
              LOG.debug("Before returning from getMemberRecords");
              return returnVal;

    Hi
    I am facing some problem with Relation ship tables
    I am able to retrieve all child relation record by using Parent record id, but the other why around is not working that is
    I am unable to retrieve  all parent records by using a child record.
    Please can you help out this..
    find the below sample method which i was trying
    public HashMap<String, Record[]> getMemberRecords(Record[] rec,
                   RetrieveRelationshipsCommand relation,
                   RepositorySchemaEx repositorySchema, String code,
                   HashMap<String, Record[]> returnMap) throws MDMException {
              LOG.debug("calling getMemberRecords");
              HashMap<String, Record[]> returnVal = returnMap;
              LOG.debug("Assigning returnType to default HashMap.");
              try {
                   for (int recordCount = 0; recordCount < rec.length; recordCount++) {
                        LOG.debug("For recordCount = " + recordCount);
                        Record tempRec = rec[recordCount];
                        relation.setAnchorRecord(tempRec);
                        LOG.debug(" setting AnchorRecord = " + tempRec);
                        relation.setLoadRecords(true);
                        LOG.debug(" setting LoadRecords = " + true);
                        relation.setGetChildren(false);
                        LOG.debug(" setGetChildren has setup with  = " + true);
                        relation.setAnchorRecordId(tempRec.getId());
                        LOG.debug(" setting AnchorRecordId = " + tempRec.getId());
                        relation.setRelationshipId(repositorySchema
                                  .getRelationshipId(code));
                        LOG.debug("Before execution relation execute.");
                        relation.execute();
                        LOG.debug("After execution relation execute.");
                        RelationshipGroup group = relation.getRelationshipGroup();
                        LOG.debug("Retrieved Relationship Group.");
                        Relationship[] relat = group.getMembers();
                        LOG.debug("Length = "+relat.length);
                        Record[] tempRecords = null;
                        if (relat != null) {
                             int length = relat.length;
                             LOG.debug("Length = "+length);
                             tempRecords = new Record[length];
                             for (int count = 0; count < length; count++) {
                                  tempRecords[count] = relat[count].getMemberRecord();
                        if (tempRecords != null) {
                             LOG
                                       .info("Records size is not equal to Null So Calling recursive getMemberRecords.");
                             returnMap = getMemberRecords(tempRecords, relation,
                                       repositorySchema, code, returnMap);
                        LOG
                                  .debug("Setting HashMap Value Values with Parent ID, records[]");
                        returnVal.put(tempRec.getId().getString(), tempRecords);
              } catch (SessionException se) {
                   MDMException exception = new MDMException();
                   ErrorContext ec = new ErrorContext();
                   ec.setErrorMessage(se.getMessage());
                   ec.setErrorCode("MetadataException : " + se);
                   LOG.fatal(se, se.getCause());
                   se.printStackTrace();
                   exception.setContext(ec);
                   throw exception;
              } catch (IllegalArgumentException iae) {
                   MDMException exception = new MDMException();
                   ErrorContext ec = new ErrorContext();
                   ec.setErrorMessage(iae.getMessage());
                   ec.setErrorCode("MetadataException : " + iae);
                   LOG.fatal(iae, iae.getCause());
                   iae.printStackTrace();
                   exception.setContext(ec);
                   throw exception;
              } catch (CommandException ce) {
                   MDMException exception = new MDMException();
                   ErrorContext ec = new ErrorContext();
                   ec.setErrorMessage(ce.getMessage());
                   LOG.fatal(ce, ce.getCause());
                   ce.printStackTrace();
                   exception.setContext(ec);
                   throw exception;
              LOG.debug("Before returning from getMemberRecords");
              return returnVal;

  • Problem with type 4 driver using oracle 10g

    HI,
    I am unable to establish a type 4 connection with oracle 10g.
    Specs:
    Driver used: OracleDriver that comes with the ojdbc14.jar along with oracle 10g
    JDK used: Tried using both j2sdk1.4.2 and using JDK 5.0
    JRE: Again, JRE that was shipped with j2sdk 1.4.2 and JRE 5.0
    OS: Windows XP sp2
    I am able to compile the following piece of code, so there is no classpath problem, etc.
    When I try to run the program, the exception thrown is "No Suitable Driver"
    There is no problem with the TNSListener, etc...even if all Oracle related services in 'services.msc' are Started/Stopped, the error remains.
    I am, however, able to establish the connection using type1 driver.
    Please Help!
    import java.sql.*;
    import java.io.*;
    class TestConn
         Connection connection;
         Statement statement;
         ResultSet resultset;
         public void testConn() throws SQLException, ClassNotFoundException
              DriverManager.registerDriver(new oracle.jdbc.driver.OracleStatement());
              //DriverManager.registerDriver(new sun.jdbc.odbc.JdbcOdbcDriver());
              connection = DriverManager.getConnection("oracle:jdbc:thin:@127.0.0.1:1521", "scott", "tiger");
              //connection = DriverManager.getConnection("jdbc:odbc:dsn1", "scott", "tiger");
              System.out.println("Connection Established");
              statement = connection.createStatement();
              resultset = statement.executeQuery("select ename from emp");
              while(resultset.next())
                   System.out.println(resultset.getString(1));
    class Test
         public static void main(String args[]) throws SQLException, ClassNotFoundException
              TestConn obj = new TestConn();
              obj.testConn();
    };

    The JDBC URL should include the database SID. For example, if the database SID is Orcl
    connection = DriverManager.getConnection("oracle:jdbc:thin:@127.0.0.1:1521:Orcl", "scott", "tiger");

  • Problems with Java AQ interface migrating 9i to 10g

    Hi!
    I've got problems with Java AQ Interface migrating from 9i DB, JDBC, AQ to 10g rel.2 DB, JDBC, AQ
    First, i started to occasionally receive NullPointerException in Oracle JDBC 9.2.0.8
    java.lang.NullPointerException
    at oracle.jdbc.driver.OracleStatement.describe(OracleStatement.java:6439)
    at oracle.jdbc.driver.OracleStatement.get_column_index(OracleStatement.java:6203)
    at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:1557)
    at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:1543)
    at gpnic.messaging.LDAPMessenger.messageFromRS(Unknown Source)
    We were using 9.2.0.8 JDBC and 9i and 10g databases.
    We decided to go up for 10g r2 JDBC Drivers, and 10.2 AQ but started to get the following errors:
    oracle.AQ.AQOracleSQLException: ORA-25216: invalid recipient, either NAME or ADDRESS must be specified
    ORA-06512: на "SYS.DBMS_AQIN", line 454
    ORA-06512: на line 1
         at oracle.AQ.AQOracleQueue.enqueue(AQOracleQueue.java:1267)
         at gpnic.comm.messaging.transport.AQTransportAdapter$AQDestanation.send(AQTransportAdapter.java:607)
         at gpnic.comm.messaging.transport.OutboundThread.run(OutboundThread.java:83)
    I'm specifying address of an agent, but oracle says I am not.
    I tried both native AQ and JMS interfaces, bot got the same error. I specify recipient the following way:
    'consumer' var contains name of AQ agent and is not null
    native AQ interface:
    aqSess = AQDriverManager.createAQSession(db_conn);
    AQQueue destQ = aqSess.getQueue(schema, queue);
    dequeueOptionsOut = new AQDequeueOption();
    dequeueOptionsOut.setWaitTime(AQDequeueOption.WAIT_NONE);
    dequeueOptionsOut.setConsumerName(consumer);
    dequeueOptionsOut.setDequeueMode(AQDequeueOption.DEQUEUE_REMOVE);
    dequeueOptionsOut.setNavigationMode(AQDequeueOption.NAVIGATION_FIRST_MESSAGE);
    AQMessageProperty mpOut = new AQMessageProperty();
    Vector vRecpt = new Vector();
    vRecpt.add(new AQAgent(consumer, null, 0));
    mpOut.setRecipientList(vRecpt);
    AQMessage aqMsg = null;
    AQEnqueueOption eOpt = null;
    //prepare message
    aqMsg = destQ.createMessage();
    CLOB chMsg = CLOB.createTemporary(db_conn, true, CLOB.DURATION_SESSION);
    chMsg.open(CLOB.MODE_READWRITE);
    chMsg.putString(1,msg);
    //creating oracle type message
    gpnic.db.SDSTypes.SdsMsgT oraMsg = new gpnic.db.SDSTypes.SdsMsgT(chMsg);
    AQObjectPayload payload = aqMsg.getObjectPayload();
    payload.setPayloadData(oraMsg);
    //setting properties
    aqMsg.setMessageProperty(mpOut);
    //do enqueueOut
    eOpt = new AQEnqueueOption();
    destQ.enqueue(eOpt, aqMsg); //<- here AQOracleSQLException is thrown
    JMS interface to Oracle AQ:
    TopicSession session;
    TopicConnection connection;
    TopicPublisher publisher;
    AQjmsAgent[] recipientList;
    connection = AQjmsTopicConnectionFactory.createTopicConnection(db_conn);
         session = connection.createTopicSession(true, Session.CLIENT_ACKNOWLEDGE);
         connection.start();
         Topic topic = ((AQjmsSession) session).getTopic(schema, queue);
         publisher = session.createPublisher(topic);
         recipientList = new AQjmsAgent[1];
         recipientList[0] = new AQjmsAgent(consumer, null);
    CLOB chMsg = CLOB.createTemporary(db_conn, true, CLOB.DURATION_SESSION);
    chMsg.open(CLOB.MODE_READWRITE);
    chMsg.putString(1,msg);
    //creating oracle type message
    gpnic.db.SDSTypes.SdsMsgT oraMsg = new gpnic.db.SDSTypes.SdsMsgT(chMsg);
    AdtMessage adtMessage = ((AQjmsSession)session).createAdtMessage();
    adtMessage.setAdtPayload(oraMsg);
    ((AQjmsTopicPublisher) publisher).publish(adtMessage, recipientList); <- here Exception is thrown
    We tried the following combinations
    9i DB, 9i jdbc, 9i aq - enqueue ok
    10g DB, 9i jdbc, 9i aq - enqueue ok
    10g DB, 10g jdbc, 10g aq - exception is thrown
    Can anyone help?

    Duplicate post, please check Upgrade 9i to 10g

  • Problem with code

    hi all ! I hadd some problems with my code. I have some dates that should be ordered by the hour (hora) but its not. Now I know its not the SQL because I execute it with my sql control center and its just fine. SO it must be when I pass the data from one object to another.
    Here what I do:
    OK I think I got it. ITS NOT A SQL ERROR !!! or a table error !!! I executed the code using my sql control center and the result is ordered and correct. So it has to be something related to the code that saves the data. I save the data in a bean like this:
    public HashMap getCitasxfecha2(java.sql.Date fecha,String tipo) throws java.sql.SQLException
            BeanDatosCitas t = new BeanDatosCitas();
            HashMap m = new HashMap();
            ResultSet cdr = bd3.busquedaCitas2(fecha,tipo);
            java.sql.Time vector[]= new java.sql.Time[9999];
            System.out.println("salgo del busquedaCitas2");
            int id = 0;
            while (cdr.next())
            //String hora=convertir(cdr.getTime("Hora"));
             id = cdr.getInt("idCita");
                t = new BeanDatosCitas(
                id,                             // Nos servir� como identificador en la tabla HashMa
                cdr.getDate("Fecha"),
                cdr.getTime("Hora"),
                cdr.getString("Protocolo"),
                cdr.getString("DNI"),
                cdr.getString("Opcion"),
                cdr.getString("Observacion"),
                cdr.getString("Horaentrada"),
                cdr.getString("Nombres"),
                cdr.getString("Apellidos"),
                cdr.getString("Prescriptor"),
                cdr.getString("Mutua"),
                cdr.getInt("Sesigast"),
                cdr.getInt("Sesifaltantes"),
                cdr.getString("Tipo"),
                0
                m.put(new Integer(id), t);
            numFilas = m.size();
            return m;
        }Then I do a:
    respuesta = bBDCit.getCitasxfecha2(datNac,tipo);
            int nFilas2 = bBDCit.getNumFilas();
            Collection tabla2 = respuesta.values();
            request.setAttribute("citas_diarias",tabla2); And in my JSP I do:
    <c:forEach var="fila" items="${requestScope.citas_diarias}">it seems like in any part of this code the error happens. What could it be?
    Thanks again!

        public java.util.List getCitasxfecha2(java.sql.Date fecha,String tipo) throws java.sql.SQLException
            BeanDatosCitas t = new BeanDatosCitas();
            java.util.List list = new java.util.ArrayList();
            ResultSet cdr = bd3.busquedaCitas2(fecha,tipo);
            java.sql.Time vector[]= new java.sql.Time[9999];
            System.out.println("salgo del busquedaCitas2");
            int id = 0;
            while (cdr.next())
                //String hora=convertir(cdr.getTime("Hora"));
                id = cdr.getInt("idCita");
                t = new BeanDatosCitas( id,
                            // Nos servir� como identificador en la tabla HashMa
                    cdr.getDate("Fecha"),
                    cdr.getTime("Hora"),
                    cdr.getString("Protocolo"),
                    cdr.getString("DNI"),
                    cdr.getString("Opcion"),
                    cdr.getString("Observacion"),
                    cdr.getString("Horaentrada"),
                    cdr.getString("Nombres"),
                    cdr.getString("Apellidos"),
                    cdr.getString("Prescriptor"),
                    cdr.getString("Mutua"),
                    cdr.getInt("Sesigast"),
                    cdr.getInt("Sesifaltantes"),
                    cdr.getString("Tipo"),
                    0
                list.add(t);
            numFilas = list.size();
            return list;
            int nFilas2 = bBDCit.getNumFilas();
            Collection tabla2 = bBDCit.getCitasxfecha2(datNac,tipo);
            request.setAttribute("citas_diarias",tabla2);That should just about cover it. The JSP can stay the same.

  • Problem with filling up vector

    Hello,
    i'm having a problem with the following code; when i try to fill up the vector, it overwrites the previous values with the new, so the when i add the second item, the first item becomes the second too. So when i return the vector, all values are similar (the last).
    public Vector getClients(){
    Database singleton = Database.getDatabase();
    User user=new User();
    Vector clients = new Vector();
    try{
    singleton.openConnection();
    ResultSet rs = singleton.getResultSet("SELECT * FROM tblClients");
    while(rs.next()){
    user.setNaam(rs.getString("naam"));
                   user.setVoornaam(rs.getString("voornaam"));
                   user.setNickname(rs.getString("nickname"));
                   user.setEmail(rs.getString("email"));
                   user.setPaswoord(rs.getString("paswoord"));
    System.out.print("user added:" + user.getNickname() + "\n" );
    clients.add(user);
    System.out.println(user);
    singleton.closeConnection();
    }catch(SQLException sqle){
    sqle.getMessage();
    sqle.printStackTrace();
    System.out.print(clients.size() + " users added\n");
    return clients;
    }

    You are always adding the same user-Object to the Vector.
    You should put the command
    user=new User();inside the while-loop to have different objects for different users.

  • Problem with JFileChoosers

    I have a problem with JFileChooser.showOpenDialogBox(Component c). When I select a directory and click the Open button,the program goes wacky. Same is the case if I click Cancel button without selecting any file. How to solve this problem. I want the directory be opened and all subdirectories and files be shown just as in MS Word for example.

    Try and modify the following function:
         * Loads the FileChooser Object if not present.
         *@return Instance of File chooser
         private JFileChooser getFileChooser()
              if (mFlChooser == null)
                   mFlChooser = new JFileChooser();
                   mFlChooser.setFileFilter(
                        new javax.swing.filechooser.FileFilter()
                             public String getDescription()
                                  return sRes.getString("Text Documents (*.txt)");
                             * See Parent for Doc
                             *@param f See Parent for Doc
                             *@return See Parent for Doc
                             public boolean accept(File f)
                                  // Adapted
                                  if (f.isDirectory())
                                       return true;
                                  String extension = null;
                                  String s = f.getName();
                                  int i = s.lastIndexOf('.');
                                  if (i > 0 && i < s.length() - 1)
                                       extension = s.substring(i + 1).toLowerCase();
                                  if (extension != null)
                                       return extension.equals(".");
                                  return false;
              return mFlChooser;
         }

  • Mysql problem with german special characters

    hi,
    I wrote a software and it worked quite good, but after I installed it on a new machine with j2se 1.4 I've problems with the german special characters.
    this code works good on the old machine (jdk 1.3.1) and prints the wanted characters like �,�,�.
    Class.forName("org.gjt.mm.mysql.Driver").newInstance();
    java.sql.Connection conn;
    conn = DriverManager.getConnection("jdbc:mysql://localhost/testdb?user=testuser&password=xxxx");
    Statement s = conn.createStatement();
    ResultSet r = s.executeQuery("select something from testtb where id='1'");
    r.first();
    System.out.println( r.getString(1) );
    but on the new machine (j2se 1.4) I only receive the character ?.
    I updated my org.gjt.mm.mysql to the current MySQL Connector/J 3.0.9 and added
    conn = DriverManager.getConnection("jdbc:mysql://localhost/testdb?user=testuser&password=xxxx&useUnicode=true&characterEncoding=ISO-8859-1");
    but I've got still the same problem.
    Thanks in advance
    Markus

    with "wanted characters like �,�,�"
    I meant: like &#x00E4;,&#x00FC;,&#x00F6;

Maybe you are looking for

  • Co41 enhancement for add field in ALV output

    I must add a custom filed to ALV output of transaction CO41 and i trying to use all the 25 enhancements provided (that i find in other post CO41- Enhancement ), but i haven't found any way to get the desired results. Can any body help me? Thanks in a

  • Function module for reading payroll results

    HI, I need a function module for reading payroll results RT table. Import parameters are personal number, payroll area, and payroll period. Export should be RT table. Regards, Wasim Ahmed

  • Flex and br in a ul not right

    I expected a line break in an unordered list when I added a <br> (see code below).  Instead, it was treated as a new <li> with a new bullet point.  How do I get this to work? private const noticeList:String =      "<ul> " +           "<li>Department

  • Convert Formulae into MDX

    <p>Hi,  </p><p>  I am trying to convert Year ending Quarter into MDXequivalent. These are the formulae which has to be converted intoMDX.</p><p> </p><p>YEQ1 = Qtr1 + @MDSHIFT(QTR2, -1, YEARS) + @MDSHIFT(QTR3, -1,YEARS) + @MDSHIFT(QTR4, -1, YEARS)</p>

  • How to edit web.xml deployment descriptor from console in weblogic 8.1?

    In weblogic 7.0, deployment descriptor such as web.xml can be edited from the admin console, but on weblogic 8.1 I can't find a way to do so. Is this function taken out? Why is it taken out? Do I have an alternative to edit it without unpacking and p