Connecting to secondary database

I am trying to connect to an external oracle and update data. When I try to access the database (on statement CONNECT TO 'XXX' AS 'A' ), I get sy-subrc = 4. When I check the developer trace, I see an ORA-12154 error.
I have created an entry in the DBCON table. This database is accessible from the R/3 Oracle database. What entry does SAP expect in the DBCON-CON_ENV field? I tried using the full TNS entry which is XXX.WORLD = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = ip address)(PORT = port number))(CONNECT_DATA = (SID = sid value)))
and the name of the connection as XXX(same as the TNS alias). Is this the right way to configure the table?
Thanks in advance.

The right way to configure external database connections is to use transaction DBCO, where you have to specify:
"Name of connection" - you enter this name in a native SQL CONNECT statemetn to open connection
"DBMS" - database system (ORA for Oracle database)
"User name" - database user
"DB password" - database user password
"Conn. info" - for Oracle database short TNS name of the database to which you want to connect with structure "sid.domain" (for examle: prd.world)
Regards,
Maxim.

Similar Messages

  • How ADBC connection is benefits by using SAP HANA as secondary database ?

    Hi,
    I have one more important question.
    How ADBC connection is benefits by using SAP HANA as secondary database in terms of performance wise for the access of data from HANA database as a secondary database.
    I have 2 options and which is better for the good performance for accessing the data-
    1 .  In ABAP Reports in the SELECT statements by using CONNECTION (“HDB”) will this improve the
         performance.
          e.g : select * from BSEG into TABLE IT_TAB CONNECTION (“HDB”).
    2. Will Create the Stored procedure in HANA studio and Call
       from ABAP as below by using NATIVE SQL–
         EXEC SQL
          SET CONNECTION (‘HDB’).
         ENDEXEC.
        EXEC SQL.
          EXECUTE PROCEDURE proc (IN    p_in1                       
                                 OUT   p_out1   OUT   p_out2 )
       ENDEXEC.
    Regards,
    Pravin
    Message was edited by: Jens Weiler
    Branched from http://scn.sap.com/thread/3498161

    Hi Pravin,
    Option 1: In this case ADBC might even worsen the performance due to the overhead in the ADBC framework. OpenSQL is the method to go here, as OpenSQL - from the ABAP point of view - features the optimal communication with the database while ADBC has overhead like constructor-calls for the statement, parameter binding, etc.
    Option 2: In this case ADBC is comparable with EXEC SQL but features more options, e.g. clean concept of multiple connection (connection objects via CL_SQL_CONNECTION), exception handling, etc. So I strongly propose to favour ADBC over EXEC SQL, but not simply for performance reasons. You might have a look at the ABAP Language Help in your system on more information on ADBC and the advantages over Exec SQL.
    Cheers,
      Jasmin

  • Secondary database connections

    I am looking for information on Secondary database connections, especially with Oracle. Is there any other information than note 323151 (I am using the MiniSAP system for testing, therefor I do not have an official SAP customer status).
    I found something about this on help.sap.com, but this is more like an overview. I am looking for some examples on what to configure and how to use it.
    Any help would be appreciated.
    Thanks

    Hi Klaus,
    You need to prepare entries in the TNSNAME.ORA file (on the Oracle database server). The systemguys will know where to find it.
    Oracle File TNSNAMES.ORA (contains also the lines below)
    texd.world = (DESCRIPTION = (ADDRESS = (COMMUNITY = tcp.world)
                 (PROTOCOL = TCP) (Host = <servername>) (Port = 1521))
                 (CONNECT_DATA = (SID = <SID>) (GLOBAL_NAME = texd.world)
                 (SERVER = DEDICATED)))
    Replace <servername> with the actual servername of the oracle database.
    Replace <SID> with the SAP system ID (Like DEV for development or PRD for production).
    In SAP use transactiom SM30 to maintain table DBCON.
    Give the connection a name (this is used in your code). Example = MYCONNECTION.
    Set DBMS to ORA.
    Set the username to a user with sufficient rights
    Supply (2x) the password for this user
    Set the Verb.info to textd.world
    Do NOT check (leave unchecked) the Permanent checkbox.
    Save your work.
    In ABAP code you can connect to and use this connection like this:
    Declaration
    DATA: WA TYPE T000.
    Init connection
    EXEC sql.
    connect to 'MYCONNECTION' as 'MYDB'
    ENDEXEC.
    Open connection
    EXEC sql.
    SET CONNECTION 'MYDB'
    ENDEXEC.
    Do your trick
    EXEC sql PERFORMING your_form.
    SELECT * INTO :WA FROM T000.
    ENDEXEC.
    Stop connection
    EXEC sql.
    disconnect 'MYDB'
    ENDEXEC.
    FORM your_form.
      WRITE: / wa-mandt, wa-mtext.
    ENDFORM.
    Further information on using this (beside note 323151) can be found on notes 339092, 323151 and 178949.
    See also http://www.akadia.com/services/ora_dblinks.html
    Hope this helps you on your way.
    Regards,
    Rob.

  • DB Connect Error while establishing secondary Database DB2 in mainframe sys

    Hello,
    I am trying to establish a secondary database connection between my ECC system and a mainframe system.
    In my SAP system, the database is Oracle and version is 10.2
    I want to connect to a mainframe system DB2 (AS400).
    I have installed DB2 client in SAP server.
    I have checked the access to Mainframe system from DB2 client.
    I have made the entry in DBCON table via t-code DBCO, which looks like this
    AS4_HOST=<ip_address>;AS4_DB_LIBRARY=<LIB_NAME>;
    But when I run, the std program ABCD_TEST_CONNECTION, I am getting error
    Secondary DB connect FAILED!
    Some doubts:
    1) From an Oracle Database point, is it required to login to sqlplus and create a database link between Oracle Database and the Mainframe Database?
    2) Is it required to have an entry in SM59, which connects the Mainframe system, if so what type of connection & name?
    3) If anyone has faced situation like this, can you share what steps were taken to resolve the error?
    If this is not the forum to post this question, can you suggest the correct forum?
    Regards,
    Vikas

    Hello Prem,
    I have established connectivity with Mainframe via DB-Connect.
    THe steps are
    1) Make entry in DBCON table
    2) Install DB2 client in SAP-Server
    3) There are some jobs which needs to be run in Mainframe system. The job name was mentioned in one of SAP notes.
    If you are facing problems after this, just check SAP version and patch installed.
    Regards,
    Vikas

  • Error creating a secondary database connection

    Hi,
    I just did a kernel upgrade of our ECC 6.0 EHP4 from 701_REL PL150 to 721_EXT PL201 and now when I try to access the content server database (MaxDB) from the transaction DB13 I have the following error:
    "Set up of a secondary connection to the database system failed. It is possible that the data required for setting up the connection via EXEC SQL                (Native SQL) is faulty.
    No shared library found for the database with ID SDB_SBX
    Documentation for system log message BY G :
    As well as the standard connection, an attempt was made to set up
    another database connection, under the specified ID. The Shared Lib
    for this second database could not be found.
    The Shared Library is usually found in the the Executable
    directory (profile parameter DIR_LIBRARY) under the name dbs
    <dbs>slib<os_ext>. <dbs> stands for the database type and <os_ext>
    stands for the operating system-specific extension of the Shared
    Libraries.
    The database type is determined from the entry that corresponds to
    specified DB ID in the table DBDCON. Check whether the data in this
    entry is correct."
    The ECC 6.0 EHP4 is installed on MS-SQL database.
    The content server:
    - database MaxDB
    - Version 7.8.02.23
    - instance type : OLTP
    - kernel 7.8.02 build 023-121-242-871
    I have read the following notes: 1222907, 1610716, 1716826, 1553465, 1713986, 1028690, 1581595, 1025361, 1097997, 1517379.
    Before the ECC kernel upgrade I had no problem to connect to the MaxDB database with the transaction DB13.
    ECC instance is OK - I have no problem accessing the MS-SQL database.
    Thanks for your help,
    Sam

    Hi Deepak,
    I have downloaded lib_dbsl_219-10011364.sar from:
    SAP NetWeaver and complementary products" SAP NetWeaver" SAP EHP2 FOR SAP NETWEAVER 7.0" Entry by Component" Application Server ABAP
    SAP KERNEL 7.21 EXT 64-BIT UC - Windows on x64 64bit - MaxDB
    I still have the error:
    Loading DB library 'F:\usr\sap\xxx\DVEBMGS00\exe\dbsdbslib.dll' ...
    *** ERROR => DlLoadLib()==DLENOACCESS - LoadLibrary("F:\usr\sap\XXX\DVEBMGS00\exe\dbsdbslib.dll")
    Error 126 = "The specified module could not be found." [dlnt.c       255]
    {root-id=005056BD016D1ED3B3903BAAC4F045FC}_{conn-id=00000000000000000000000000000000}_0
    *** ERROR => Couldn't load library 'F:\usr\sap\XXX\DVEBMGS00\exe\dbsdbslib.dll'
    dbcon.c      5768]
    {root-id=005056BD016D1ED3B3903BAAC4F045FC}_{conn-id=00000000000000000000000000000000}_0
    ***LOG BYG=> could not load library for database connection SDB_XXX    [dbds         862]

  • Secondary database conections

    i’m working in a proyect, that consist in send data to other db server that is not on the r3 database server,
    both database server are running on SQL Server 2000.
    The version of sap is 46b.
    S.O. Windows 2000 SERVER
    THe secondary database is in Windows 2000 Server too.
    i found information in the notes: 313151,178949.
    i fill the table dbcon as follow:
    Connection name : SAPPVF   
    DBMS:MSS                   
    User name: csappvf                                    
    DB password *** / ********+
    Conn. info: MSSQL_SERVER=NHUERTA MSSQL_DBNAME=PRU
    csappvf, is the user with permision dbo in database PRU.
    Where NHUERTA, is secondary server, where is the database PRU.
    PRU, is the secondary database
      Code program abap.
    EXEC sql.
      CONNECT TO 'SAPPVF' AS 'MIM'
    ENDEXEC.
    EXEC SQL.
         SET CONNECTION 'MIM'
    ENDEXEC.
    IF SY-SUBRC = 0.
        EXEC SQL.
          SET CONNECTION 'MIM'
        ENDEXEC.
        EXEC SQL.
          SELECT single * INTO :WA_RENTA FROM RENTA
        ENDEXEC.
       but the program generate a dump:
    ABAP/4 Program ZMX_BC_IN_CONEXION
    vSource ZMX_BC_IN_CONEXION
    Line 38.    
    <b>Error Code DBIF_DSQL2_OBJ_UNKNOWN. </b>               
    Module  $Id: //bas/46D/src/krn/runt/abexsql.c#8 $ SAP.      
    Function ExecuteCall Line 806       
    Table does not exist in database....      
       How i can identify if the problem is of basis
                                                                 Someone have any suggestion about this !!!
    Message was edited by: Noemi Huerta
    Message was edited by: Noemi Huerta

    Hi Noemi,
    1. As u said, you have a secondary database connection
       which is tested and working. (But giving
       error in ur Z program)
    2. SAP recommends that instead of using NATIVE Sql,
       use OPEN Sql.
       So that if there is any change in database,
       the R/3 system(Database Manager) will automatically
       take care of it)
    3. According to me, you should you OPEN Sql.
       To do this,
       you will have to create the same Z / Y table
       in your R/3 database, with the same structure.
       This can be a blank table or structure.
       SO THAT ABAP IDENTIFIES IT AS A DATABASE OBJECT
       IN DD DICTIONARY WHEN SYNTAX CHECKING THE SQL.
    4.  One can use the following syntax.
          DATA: mydbcon(30) TYPE c. 
          mydbcon = 'SAPPVF'.
         Select * FROM YTABLE CONNECTION (mydbcon)
         into ITAB.
    HOPE THIS HELPS
    Regards,
    Amit M.

  • DB CONNECT support Hyperion database(Essbase)

    Hi,
    Does DB CONNECT support Hyperion database(Essbase) for SAP BW 3.5/7.0.
    Regards
    CSM Reddy

    Hi,
    assuming that you talk about ABAP DB CONNECT, this is not the case. From ABAP, SAP supports at maximum secondary connections to databases that are also supported by SAP as SAP databases (Oracle, the three DB2s, MSSQL, MAXDB).
    You also need to be aware that not every OS on your application server is able to connect to every database listed above. In case of SAP on iSeries, you need to have a Windows Appserver to be able to connect against most other databases supported by SAP.
    For more details about ABAP multi-connect refer to SAP note 323151, or the iSeries note 445872.
    However, the JAVA part of the WebAS provides means to open secondary connections against any database which support a JDBC driver. The BW UDI connector (which uses that ability) might also support the Hyperion database. I'm not familar with their plans.
    Hope that helps.
    Dorothea

  • How to use DB connect against secondary Oracle DB ?

    Hi all,
    this is the issue:
    an existing BI 7.0 based on Oracle 10.2.0.2.0 has to acquire data from an external Oracle 9.2.0.6 database. We want to use DB connect functionality.
    1st Q: are the existing components (DBSL and Oracle db-client) sufficient for interfacing to the secondary database?
    2nd Q: would it be better practice to look at the external database as a completely separate one? which means to install separate DBSL and db-client for it.
    Unfortunately neither online documentation nor SAP notes provide full clarification. Is there any experience in the field? all comments and contributions are warmly appreciated!
    THX, Harry

    Still puzzling on that issue. Will come back when completely solved. /hs
    OK, gurus, expertz and those to be, here's the story:
    BI 7.0 component of SCM-APO (Oracle 10.2.) is successfully connected to remote Oracle 9.2.
    Actually there have been just a couple of points to look after. First thing was to maintain the alias connection string in tnsnames.ora file. Plus this file is required twice, in the ORASID directory as well as in the <SID>ADM directory.
    Next issue is that apparently Oracle 'grants' are not supported by DB-Connect. But at least there is BI support package 11 which enables us to connect to other users' objects (different user than DB-Connect user). This healed the grants issue.
    Further topics have been the date conversion issue (this should already be done in the remote source DB) and name length and characters-2-B-used requirements.
    Once again thanks for your contributions and happy computing!
    Harry
    Message was edited by:
            Harald Schwenger

  • Logshipping secondary database

    Hi Team,
    In logshipping secondary database wants to access for reporing  purpose database was in standbymode
    Could any body please guide me  how can we give access for  read only purpose
    Thanks
    subu

    Hi Team,
    In logshipping secondary database wants to access for reporing  purpose database was in standbymode
    Could any body please guide me  how can we give access for  read only purpose
    Thanks
    subu
    Hi,
    There is no big deal in achieving this.You need to create a login for user and map it to database.Now important point  here is the option you select when restoring database disconnect users ( while configuring log shipping) in such case moment restore
    starts your users will be disconnected.So you should plan for this before hand.If you un check this option no restore will be performed if users are connected.
    You can set restore frequency to match users request.If you set it every 15 mins its sure to cause issue with report query.
    Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers

  • 10g Enterprise Manager is not able to connect to the database instance

    I am running a Oracle 10g database in Solaris 10 server. When i am trying to connect to the enterprise manager it says Enterprise Manager is not able to connect to the database instance.
    The database instance is open,the listener is up and the agent connection also says that it succeeded.
    The server houses two 10g databases and the EM was working properly till yesterday. Kindly Help.
    Thanks in advance.
    Ram

    Hi,
    The EM is started and if i give emctl status dbconsole
    -bash-3.00$ emctl status dbconsole
    Oracle Enterprise Manager 10g Database Control Release 10.2.0.3.0
    Copyright (c) 1996, 2006 Oracle Corporation. All rights reserved.
    http://gladiator:1158/em/console/aboutApplication
    Oracle Enterprise Manager 10g is running
    Logs are generated in directory /db8/ora10gr2/product/10.2.0/Db_4/gladiator_TROY/sysman/log
    it says that the EM is running. But when i am trying to access the URL it is in IE it says Page cannot be displayed what could be the problem for this???
    Thanks in advance.
    Ram

  • How to find the number of ODBC connections to Oracle Database

    Hi All,
    How to find the number of ODBC connections and all connections to the Database in last week. Are there any views to get this information?
    Thanks in advance,
    Mahi

    What Ed said is true that Oracle doesn't note which type of protocol is connecting to the database, however, you can see which program is accessing the database.
    For example: if you already know of a user using ODBC, you can verify as:
    select username, osuser, terminal, program from v$session where username = 'SCOTT'
    USERNAME                 OSUSER          TERMINAL   PROGRAM
    SCOTT                    IUSR_SRV231     SRV231     w3wp.exe
    SCOTT                    IUSR_SRV231     SRV231     w3wp.exe
    2 rows selected.Assuming that you can confirm the progam noted in the above (example) is the one using ODBC, then you can change the query such as:
    SQL> select username, osuser, terminal, program from v$session where program = 'w3wp.exe';
    USERNAME                 OSUSER          TERMINAL   PROGRAM
    SCOTT                    IUSR_SRV231     SRV231     w3wp.exe
    SCOTT                    IUSR_SRV231     SRV231     w3wp.exe
    2 rows selected.Just for kicks, I checked our listener.log file, but there was no reference of odbc in it either.
    Hope this helps...

  • SAP Server  has lost connection to the database!

    Hi Gurus,
    Can some please guide me on this " SAP Server  has lost connection to the database! " what need to be check.
    OS : AIX
    DB : DB2
    thanks
    vamsi

    Hello,
    1)Check if the DB is running.Issue the  following command @ the DB-level
    db2 connect to <SID>.
    2)Also check R3trans -d from the app. server and check for trans.log file for the error.
    Hope it helps.
    Regards,
    Prasanna
    Edited by: Kulkarni Prasanna on Jul 24, 2008 3:53 PM

  • Problem with upgrade due to no connection to audit database

    Hello everyone!
    Today after work I wanted to finally upgrade ZCM but run into some problems.
    We have three servers: Two primary servers and one database-server (OEM Sybase SQL Anywhere). All three are running on SLES 11.
    I want to upgrade our ZCM11.2.4MU1 to ZCM11.3a and then to 11.3.1.
    I started by upgrading the Sybase database and running dbunload according to the documentation.
    Then I continued with "sh install.sh -c" and chose "Audit Database". I selected the OEM Sybase SQL Anywhere with port 2639.
    Admin, password and database-name were unique. But I made the mistake to set the servername to the same as the zenworks-database. *sigh*
    The installation completed.
    The sybase-asa and sybase-audit-asa services couldn't run at the same time, therefore I rebooted the database-server and installed the audit database again with a unique database-name.
    Before the upgrade I could start dbisql and connect without problems to backup the database. Now I cannot connect anymore without using the additional parameter: links=tcpip{host=IPorDNSName,port=2638}
    Connecting to the Audit Database via dbisql is not possible, with the following message:
    Code:
    Could not connect to the database.
    Database server not found
    Ensure that the name in the "Server name" field is spelled correctly, that the network options on the network tab are correct and that the database server has been started.
    [Sybase][ODBC Driver][SQL Anywhere]Database server not found
    SQLCODE=-100
    SQLSTATE=08001
    Connection parameters:
    User=zenauditadmin
    Password=***
    Server=zenworks_audit_database_server
    DBN=zenworks_audit_database2
    LINKS=ShMem
    ENC=NONE
    links=tcpip{host=<ip>,port=2639}
    With that said, it is not possible to upgrade the first primary server because the setup routine is also not possible to connect to the Audit Server:
    Code:
    We were unable to create a connection to the database. Please check your
    connection information.
    Specify the existing ZENworks database and database authentication information
    for an existing user with sufficient permissions.
    The services sybase-asa and sybase-audit-asa are both running. I also restarted them a couple of times.
    zenworks_database.conf and zenworks_database_audit.conf look fine.
    Do you have any idea what I missed?
    Is the duplicate servername still somewhere existend and prevents the proper running?
    Thank you very much in advance for pointing me in any direction!

    novellchuck wrote:
    >
    > Hello everyone!
    >
    > Today after work I wanted to finally upgrade ZCM but run into some
    > problems.
    >
    > We have three servers: Two primary servers and one database-server
    > (OEM Sybase SQL Anywhere). All three are running on SLES 11.
    > I want to upgrade our ZCM11.2.4MU1 to ZCM11.3a and then to 11.3.1.
    >
    > I started by upgrading the Sybase database and running dbunload
    > according to the documentation.
    > Then I continued with "sh install.sh -c" and chose "Audit Database". I
    > selected the OEM Sybase SQL Anywhere with port 2639.
    >
    > Admin, password and database-name were unique. But I made the mistake
    > to set the servername to the same as the zenworks-database. sigh
    > The installation completed.
    > The sybase-asa and sybase-audit-asa services couldn't run at the same
    > time, therefore I rebooted the database-server and installed the audit
    > database again with a unique database-name.
    >
    > Before the upgrade I could start dbisql and connect without problems
    > to backup the database. Now I cannot connect anymore without using the
    > additional parameter: links=tcpip{host=IPorDNSName,port=2638}
    >
    > Connecting to the Audit Database via dbisql is not possible, with the
    > following message:
    >
    >
    > Code:
    > --------------------
    > Could not connect to the database.
    > Database server not found
    >
    > Ensure that the name in the "Server name" field is spelled
    > correctly, that the network options on the network tab are correct
    > and that the database server has been started. [Sybase][ODBC
    > Driver][SQL Anywhere]Database server not found SQLCODE=-100
    > SQLSTATE=08001
    > Connection parameters:
    > User=zenauditadmin
    > Password=***
    > Server=zenworks_audit_database_server
    > DBN=zenworks_audit_database2
    > LINKS=ShMem
    > ENC=NONE
    > links=tcpip{host=<ip>,port=2639}
    > --------------------
    >
    >
    > With that said, it is not possible to upgrade the first primary server
    > because the setup routine is also not possible to connect to the Audit
    > Server:
    >
    >
    > Code:
    > --------------------
    > We were unable to create a connection to the database. Please
    > check your connection information.
    >
    >
    > ************************************************** ********************
    > ******** Specify the existing ZENworks database and database
    > authentication information for an existing user with sufficient
    > permissions. --------------------
    >
    >
    > The services sybase-asa and sybase-audit-asa are both running. I also
    > restarted them a couple of times.
    > zenworks_database.conf and zenworks_database_audit.conf look fine.
    >
    > Do you have any idea what I missed?
    > Is the duplicate servername still somewhere existend and prevents the
    > proper running?
    >
    > Thank you very much in advance for pointing me in any direction!
    Oh boy... and no backup?
    Not sure how to get the sybase back working again... my first choice in
    such a case would be to make a contact to Novell, are you able to
    create an SR on this?
    Niels
    I have always liked... Cowabunga!
    If you find this post helpful, please show your appreciation by
    clicking on the star below.
    A member must be logged in before s/he can assign reputation points.

  • Problem using secondary database, sequence (and custom tuple binding)

    I get an exception when I try to open a Sequence to a database that has a custom tuple binding and a secondary database. I have a guess what the issue is (below), but it boils down to my custom tuple-binding being invoked when opening the sequence. Here is the exception:
    java.lang.IndexOutOfBoundsException
    at com.sleepycat.bind.tuple.TupleInput.readUnsignedInt(TupleInput.java:4
    14)
    at com.sleepycat.bind.tuple.TupleInput.readInt(TupleInput.java:233)
    at COM.shopsidekick.db.community.Shop_URLTupleBinding.entryToObject(Shop
    _URLTupleBinding.java:72)
    at com.sleepycat.bind.tuple.TupleBinding.entryToObject(TupleBinding.java
    :73)
    at COM.tagster.db.community.SecondaryURLKeyCreator.createSecondaryKey(Se
    condaryURLKeyCreator.java:38)
    at com.sleepycat.je.SecondaryDatabase.updateSecondary(SecondaryDatabase.
    java:546)
    at com.sleepycat.je.SecondaryTrigger.databaseUpdated(SecondaryTrigger.ja
    va:42)
    at com.sleepycat.je.Database.notifyTriggers(Database.java:1343)
    at com.sleepycat.je.Cursor.putInternal(Cursor.java:770)
    at com.sleepycat.je.Cursor.putNoOverwrite(Cursor.java:352)
    at com.sleepycat.je.Sequence.<init>(Sequence.java:139)
    at com.sleepycat.je.Database.openSequence(Database.java:332)
    Here is my code:
    // URL ID DB
    DatabaseConfig urlDBConfig = new DatabaseConfig();
    urlDBConfig.setAllowCreate(true);
    urlDBConfig.setReadOnly(false);
    urlDBConfig.setTransactional(true);
    urlDBConfig.setSortedDuplicates(false); // No sorted duplicates (can't have them with a secondary DB)
    mURLDatabase = mDBEnv.openDatabase(txn, "URLDatabase", urlDBConfig);
    // Reverse URL lookup DB table
    SecondaryConfig secondaryURLDBConfig = new SecondaryConfig();
    secondaryURLDBConfig.setAllowCreate(true);
    secondaryURLDBConfig.setReadOnly(false);
    secondaryURLDBConfig.setTransactional(true);
    TupleBinding urlTupleBinding = DataHelper.instance().createURLTupleBinding();
    SecondaryURLKeyCreator secondaryURLKeyCreator = new SecondaryURLKeyCreator(urlTupleBinding);
    secondaryURLDBConfig.setKeyCreator(secondaryURLKeyCreator);
    mReverseLookpupURLDatabase = mDBEnv.openSecondaryDatabase(txn, "SecondaryURLDatabase", mURLDatabase, secondaryURLDBConfig);
    // Open the URL ID sequence
    SequenceConfig urlIDSequenceConfig = new SequenceConfig();
    urlIDSequenceConfig.setAllowCreate(true);
    urlIDSequenceConfig.setInitialValue(1);
    mURLSequence = mURLDatabase.openSequence(txn, new DatabaseEntry(URLID_SEQUENCE_NAME.getBytes("UTF-8")), urlIDSequenceConfig);
    My secondary key creator class looks like this:
    public class SecondaryURLKeyCreator implements SecondaryKeyCreator {
    // Member variables
    private TupleBinding mTupleBinding; // The tuple binding
    * Constructor.
    public SecondaryURLKeyCreator(TupleBinding iTupleBinding) {
    mTupleBinding = iTupleBinding;
    * Create the secondary key.
    public boolean createSecondaryKey(SecondaryDatabase iSecDB, DatabaseEntry iKeyEntry, DatabaseEntry iDataEntry, DatabaseEntry oResultEntry) {
    try {
    URLData urlData = (URLData)mTupleBinding.entryToObject(iDataEntry);
    String URL = urlData.getURL();
    oResultEntry.setData(URL.getBytes("UTF-8"));
    catch (IOException willNeverOccur) {
    // Success
    return(true);
    I think I understand what is going on, and I only noticed it now because I added more fields to my custom data (and tuple binding):
    com.sleepycat.je.Sequence.java line 139 (version 3.2.44) does this:
    status = cursor.putNoOverwrite(key, makeData());
    makeData creates a byte array of size MAX_DATA_SIZE (50 bytes) -- which has nothing to do with my custom data.
    The trigger causes an call to SecondaryDatable.updateSecondary(...) to the secondary DB.
    updateSecondary calls createSecondaryKey in my SecondaryKeyCreator, which calls entityToObject() in my tuple-binding, which calls TupleInput.readString(), etc to match my custom data. Since what is being read goes for more than the byte array of size 50, I get the exception.
    I didn't notice before because my custom tuple binding used to read fewer that 50 bytes.
    I think the problem is that my tuple binding is being invoked at all at this point -- opening a sequence -- since there is no data on which it can act.

    Hi,
    It looks like you're making a common mistake with sequences which is to store the sequence itself in a database that is also used for application data. The sequence should normally be stored in separate database to prevent configuration conflicts and actual data conflicts between the sequence record and the application records.
    I suggest that you create another database whose only purpose is to hold the sequence record. This database will contain only a single record -- the sequence. If you have more than one sequence, storing all sequences in the same database makes sense and is safe.
    The database used for storing sequences should not normally have any associated secondary databases and should not be configured for duplicates.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Database much larger than expected when using secondary databases

    Hi Guys,
    When I load data into my database it is much larger than I expect it to be when I turn on secondary indexes. I am using the Base API.
    I am persisting (using TupleBindings) the following data type:
    A Key of size ~ *80 Bytes*
    A Value consisting of 4 longs ~ 4*8= *32 Bytes*
    I am persisting ~ *280k* of such records
    I therefore expect ballpark 280k * (80+32) Bytes ~ *31M* of data to be persisted. I actually see ~ *40M* - which is fine.
    Now, when I add 4 secondary database indexes - on the 4 long values - I would expect to see approximately an additional 4 * 32 * 280k Bytes -> ~ *35M*
    This would bring the total amount of data to (40M + 35M) ~ *75M*
    (although I would expect less given that many of the secondary keys are duplicates)
    What I am seeing however is *153M*
    Given that no other data is persisted that could account for this, is this what you would expect to see?
    Is there any way to account for the extra unexpected 75M of data?
    Thanks,
    Joel
    Edited by: JoelH on 10-Feb-2010 10:59
    Edited by: JoelH on 10-Feb-2010 10:59

    Hi Joel,
    Now, when I add 4 secondary database indexes - on the 4 long values - I would expect to see approximately an additional 4 * 32 * 280k Bytes -> ~ 35MA secondary index consists of a regular JE database containing key-value pairs, where the key of the pair is the secondary key and the value of the pair is the primary key. Your primary key is 80 bytes, so this would be 4 * (4 + 80) * 280k Bytes -> ~ 91M.
    The remaining space is taken by per-record overhead for every primary and secondary record, plus the index of keys itself. There are (280k * 5) records total. Duplicates do not take less space.
    I assume this is an insert-only test, and therefore the log should contain little obsolete data. To be sure, please run the DbSpace utility.
    Does this answer your question?
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for

  • HP C4180 All-in-One Printer cartridge access door problem

    It says my printer cartridge access door is open, but it is not. I've reinstalled the ink cartridges & unplugged printer to try to reset,  still no luck  Any suggestions?

  • Powerbook g4/400 power on porblems

    Ok, ive got a g4/4oo pb, it recently had its monitors power cable short and burn. So last night i used a guide to replace the monitor on my own wih a new one from my spare parts (from another powerbook g4/400 mind you) i put it all the way back toget

  • How can i open software from a school book on my macbook pro

    I am trying to open up a cd that came with my school book and it says i cannot open it because its for WINDOWS... i have a macbook pro. I really need to study from this CD - does anyone know what I can do???

  • Canon 7D - zooming on pictures is slow and shows corruption

    I recently upgraded from the Canon Rebel XT (350D) to the 7D, and thus my jpegs have increased in size from 8 to 18 megapixels. When viewing photos from the 7D in full screen mode, the images are corrupted by random colours and noise. Also, panning z

  • Quick Links provision...

    I would love to have a set of quick links where in i can add links that will quickly take me to the forum i am interested in or to the blog category i am interested in. Now, i have to go to sdn community -> blogs -> blogs by category -> SAP Process I