Binary Values unreadable - Database corrupt?

Hi,
I'm experiencing a really weird problem here, I have a table with some varchar columns and two binary columns. What I do now, is to select data from it via Python with the following select statement:
select * from torder where customerid=1624 order by torderid desc
What happens is, that only for this customerid some binary data is missing, they contain an empty string. If I do the select like this:
select * from torder where customerid=1624 order by torderid
It does work, the data is there. With this, it works too:
select * from torder order by torderid desc
So it seems, the combination of "customerid=1624" and "desc" somehow corrupts the results.
What's furthermore interesting is, that when I delete the last inserted row of the result, it works, and if I add a new one, it's broken again.
I could not check if the error is Python-related or not, as I found no way to retrieve/display the binary data in sqlcli, as it displays only something like 0x8002637A6F70652E6931 , but I doubt that this has something to do with Python.
Any clues of how to fix this?
My database version is Kernel    7.6.06   Build 003-121-202-135 | X32/LINUX 7.6.06   Build 003-121-20
2-135
Previously, I had 7.6.03 and updated it to the above version, hoping that this would fix the problem, but it did not.
Best Regards,
Hermann Himmelbauer

Ok, first many thanks for your quick reply. I did not answer at first as the problem magically went away. But unfortunately the problem is back today.
<p/>
The DDL statements look the following, there are no indexes on the table:
<p/>
<pre>
CREATE TABLE torder (
        torderid INTEGER NOT NULL DEFAULT SERIAL,
        creation_date TIMESTAMP,
        transfer_date TIMESTAMP,
        signed_date TIMESTAMP,
        signed_with VARCHAR(3) CHECK (signed_with in ('TAN', 'BKU', 'MAN') OR signed_with IS NULL),
        revocation_date TIMESTAMP,
        done_date TIMESTAMP,
        formdata LONG BYTE NOT NULL,
        trans_function VARCHAR(30) NOT NULL CHECK (trans_function in ('do_bank_transfer', 'do_bank_collection',
                                'do_cheque_transfer', 'do_cash', 'do_cashdraw')),
        trans_type VARCHAR(30) NOT NULL CHECK (trans_type in ('national','sepa','international')),
        applet_location VARCHAR(35),
        errors_text VARCHAR(100),
        errors LONG BYTE,
        customerid INTEGER,
        dbuserid INTEGER,
        torder_periodicid INTEGER,
        PRIMARY KEY (torderid),
         FOREIGN KEY(customerid) REFERENCES kunde (kundeid),
         FOREIGN KEY(dbuserid) REFERENCES dbuser (dbuserid),
         FOREIGN KEY(torder_periodicid) REFERENCES torder_periodic (torder_periodicid)
</pre>
<p/>
The insert statements look the following (They are copied out of the SQLAlchemy SQL log), one can see that the binary values are inserted here:
<p/>
<pre>
INFO:sqlalchemy.engine.base.Engine.0x...d110:INSERT INTO torder (creation_date, transfer_date, signed_date, si
gned_with, revocation_date, done_date, formdata, trans_function, trans_type, applet_location, errors_text, err
ors, customerid, dbuserid, torder_periodicid) VALUES (now(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
INFO:sqlalchemy.engine.base.Engine.0x...d110:['20091027113506345604', None, None, None, None, '\x80\x02}q\x01(
U\x0bcharges_forq\x02U\x04bothq\x03U\x05dcodeq\x04U\x0588888q\x05U\x0ccurrency_isoq\x06U\x03EURq\x07U\x06valut
aq\x08K\x00U\x11foreign_acc_name1q\tU\x11Foreign Account 2q\nU\x0cacc_payer_noq\x0bX\t\x00\x00\x00999111110q\x
0cU\ttextlinesq\r]q\x0e(U\x0c1st transferq\x0fU\tMultilineq\x10U\x0bFor testingq\x11eU\x06amountq\x12cdecimal\
nDecimal\nq\x13U\x071000.00\x85Rq\x14U\x0cacc_benef_noq\x15X\t\x00\x00\x00888111110q\x16U\x11foreign_acc_name2
q\x17U\x0bfor Testingq\x18u.', 'do_bank_transfer', 'national', 'url:test_transfer', None, None, None, None, No
ne]
</pre>
<p/>
All rows are inserted with binary data, so it's never NULL and it's also never set to an empty string ('').
<p/>
But when reading back the rows, some binary values are an empty string.
<p/>
The following Python code illustrates the problem:
<pre>
import sapdb.dbapi
def true_false_result(result):
    if result:
        return 'Bug begins'
    else:
        return 'Bug ends'
def check_bincols(bdb, sqlcmd):
    print "----
    print "QUERY: %s" % sqlcmd
    print "----
    bdbc = bdb.cursor()
    bdbe = bdbc.execute(sqlcmd)
    bug_occured = False
    stored_bin_result = False
    while 1:
        row = bdbe.fetchone()
        if row is None:
            break
Now check if the binary data results to an empty string,
This should never happen (= the database bug)
        bin_result = (row[7]() == '')
        if bin_result != stored_bin_result:
            bug_occured = True
            print "Toggle to %s at torderid %s" % (
                true_false_result(bin_result),
                row[0])
            stored_bin_result = bin_result
    if not bug_occured:
        print "No Bug for this query"
    bdbe.close()
    bdbc.close()
#bdb.close()
if __name__ == '__main__':
    bdb = sapdb.dbapi.connect('USER', 'PASS', 'DBNAME', 'LOCALHOST')
First try the original query, which results in a bug
    sqlcmd = 'select * from torder where customerid=1624 order by torderid desc'
    check_bincols(bdb, sqlcmd)
This query normally is bugfree
    sqlcmd = 'select * from torder where customerid=1624 order by torderid'
    check_bincols(bdb, sqlcmd)
This query has a bug, too
    sqlcmd = 'select * from torder order by torderid desc'
    check_bincols(bdb, sqlcmd)
But this one not
    sqlcmd = 'select * from torder order by torderid'
    check_bincols(bdb, sqlcmd)
This triggers the bug, too, which is curious as there's practically no ordering
    sqlcmd = 'select * from torder where customerid=1624 order by customerid desc'
    check_bincols(bdb, sqlcmd)
So, it seems that the bug occurs only when using "DESC" for descending
ordering.
</pre>
<p/>
The output of this program is:
<p/>
<pre>
QUERY: select * from torder where customerid=1624 order by torderid desc
Toggle to Bug begins at torderid 1355
Toggle to Bug ends at torderid 582
QUERY: select * from torder where customerid=1624 order by torderid
No Bug for this query
QUERY: select * from torder order by torderid desc
No Bug for this query
QUERY: select * from torder order by torderid
No Bug for this query
QUERY: select * from torder where customerid=1624 order by customerid desc
Toggle to Bug begins at torderid 1355
Toggle to Bug ends at torderid 582
</pre>
<p/>
So, it can be seen that the problem occurs ONLY when using descending ordering. Moreover it's interesting that the result for "select * from torder order by torderid desc" is sometimes buggy, sometimes not, which seems to be related if someone inserted some more rows or not. What's furthermore interesting is the last query, as there the order is applied to "customerid", which is the very same for every row, so there is no ordering and the bug occurs here, too.
<p/>
All this happens on my production instance. I have a testing environment, where I imported the very same data set (same database version etc.) and there is no such problem (for now), so it's quite complicated to nail down the problem further as I cannot easily disrupt the availability of the production instance.
<p/>
All I could do for now is not to use the "DESC" command and reorder the data in my application, but that is really suboptimal as I have to keep all results in memory.
<p/>
Any help is really appreciated!
<p/>
Best Regards,<BR>
Hermann Himmelbauer
<p>
Update: I tried the same query with the following code with C++ / SQLDBC (I modified one of the SQLDBC examples):
<p>
<pre>
First you have to include SQLDBC.h
#include "SQLDBC.h"
#include <stdio.h>
typedef struct ConnectArgsT {
    char * username;
    char * password;
    char * dbname;
    char * host;
} ConnectArgsT;
static void parseArgs (ConnectArgsT * connectArgs, int argc, char **argv);
using namespace SQLDBC;
Let start your program with a main function
int main(int argc, char *argv[])
   ConnectArgsT connectArgs;
   parseArgs (&connectArgs, argc, argv);
   char errorText[200];
Every application has to initialize the SQLDBC library by getting a
reference to the ClientRuntime and calling the SQLDBC_Environment constructor.
   SQLDBC_IRuntime *runtime;
   runtime = SQLDBC::GetClientRuntime(errorText, sizeof(errorText));
   if (!runtime) {
     fprintf(stderr, "Getting instance of the ClientRuntime failed %s", errorText);
     return (1);
   SQLDBC_Environment env(runtime);
Create a new connection object and open a session to the database.
   SQLDBC_Connection *conn = env.createConnection();
   SQLDBC_Retcode rc;
   rc = conn->connect(connectArgs.host, connectArgs.dbname,
                      connectArgs.username, connectArgs.password);
   if(SQLDBC_OK != rc) {
     fprintf(stderr, "Connecting to the database failed %s", conn->error().getErrorText());
     return (1);
   printf("Sucessfull connected to %s as user %s\n",
          connectArgs.dbname, connectArgs.username);
Create a new statment object and execute it.
   SQLDBC_Statement *stmt = conn->createStatement();
   rc = stmt->execute("select * from torder where customerid=1624 order by torderid desc");
   if(SQLDBC_OK != rc) {
     fprintf(stderr, "Execution failed %s", stmt->error().getErrorText());
     return (1);
Check if the SQL command return a resultset and get a result set object.
   SQLDBC_ResultSet *result;
   result = stmt->getResultSet();
   if(!result) {
     fprintf(stderr, "SQL command doesn't return a result set %s", stmt->error().getErrorText());
     return (1);
Position the curors within the resultset by doing a fetch next call.
   while (1) {
     rc = result->next();
     if(SQLDBC_OK != rc) {
       break;
       //fprintf(stderr, "Error fetching data %s", stmt->error().getErrorText());
       //return (1);
     char szString[30];
     char szString1[3000];
     SQLDBC_Length ind;
Get a string value from the column.
     rc = result->getObject(1, SQLDBC_HOSTTYPE_ASCII, szString, &ind, sizeof(szString));
     if(SQLDBC_OK != rc) {
       fprintf(stderr, "Error getObject %s", stmt->error().getErrorText());
       return (1);
     rc = result->getObject(8, SQLDBC_HOSTTYPE_ASCII, szString1, &ind, sizeof(szString1));
     if(SQLDBC_OK != rc) {
       fprintf(stderr, "Error getObject %s", stmt->error().getErrorText());
       return (1);
     printf("%s %s\n", szString, szString1);
Finish your program with a returncode.
   return 0;
static void parseArgs (ConnectArgsT * connectArgs, int argc, char **argv)
setting defaults for demo database
    connectArgs->username = (char*)"USER";
    connectArgs->password = (char*)"PASS";
    connectArgs->dbname = (char*)"MYDB";
    connectArgs->host = (char*)"localhost";
use values from command line
    if (argc > 4) {
        connectArgs->host = argv [4];
    if (argc > 3) {
        connectArgs->dbname = argv [3];
    if (argc > 2) {
        connectArgs->password = argv [2];
    if (argc > 1) {
        connectArgs->username = argv [1];
</pre>
<p/>
This works!! So it seems, that the problem is related to the Python module, which is interesting, as adding "DESC" should not be any difference to it. I personally suspect that there are some memory leaks in the code, which result in this strange behavior.
<p/>
Any suggestions?<p/>
Best Regards<br>
Hermann Himmelbauer
Edited by: Hermann Himmelbauer on Oct 28, 2009 12:51 PM
Edited by: Hermann Himmelbauer on Oct 28, 2009 12:55 PM

Similar Messages

  • Binary values corrupted in Content Manager

    Hello,
    When I copy and paste (or move) a content that has a property binary, in the second instance (the copy) these properties are corrupted. When I try to access to these properties, I receive the next exception:
    com.bea.content.RepositoryException: No binary value could be found for property.
    I'm working with WLPortal 10.3.
    Is this a bug of Portal?
    Is there any way to do this and the data are not corrupted?
    Thanks.

    When I copy or move there isn't exception, but when I access to the binary property of copy, it log this exception:
    An error occurred while attempting to download the file. Use the browser back button to continue working.
    com.bea.content.RepositoryException: No binary value could be found for property. Repository: catsrv Repository Property ID: 510536002/Docu_relacionada.archivo/510540053 at com.bea.content.manager.internal.InternalNodeOpsBean.getPropertyBytes(InternalNodeOpsBean.java:1853) at com.bea.content.manager.internal.InternalNodeOpsBean.getPropertyBytes(InternalNodeOpsBean.java:2023) at com.bea.content.manager.internal.NodeOpsEJB_ihurl6_ELOImpl.getPropertyBytes(NodeOpsEJB_ihurl6_ELOImpl.java:181) at com.bea.content.manager.internal.NodeOpsImpl.getPropertyBytes(NodeOpsImpl.java:748) at com.bea.content.federated.internal.NodeManagerImpl.getStream(NodeManagerImpl.java:990) at com.bea.portal.tools.content.controls.ContentNodeControlImpl.getStream(ContentNodeControlImpl.java:281) at com.bea.portal.tools.content.controls.ContentNodeControlBean.getStream(ContentNodeControlBean.java:1223) at content.node.nodeSelected.download.DownloadContentController.begin(DownloadContentController.java:184) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.beehive.netui.pageflow.FlowController.invokeActionMethod(FlowController.java:879) at org.apache.beehive.netui.pageflow.FlowController.getActionMethodForward(FlowController.java:809) at org.apache.beehive.netui.pageflow.FlowController.internalExecute(FlowController.java:478) at org.apache.beehive.netui.pageflow.PageFlowController.internalExecute(PageFlowController.java:306) at global.internal.AbstractBaseController.internalExecute(AbstractBaseController.java:360) at org.apache.beehive.netui.pageflow.FlowController.execute(FlowController.java:336) at org.apache.beehive.netui.pageflow.internal.FlowControllerAction.execute(FlowControllerAction.java:52) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.access$201(PageFlowRequestProcessor.java:97) at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor$ActionRunner.execute(PageFlowRequestProcessor.java:2044) at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors.wrapAction(ActionInterceptors.java:91) at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processActionPerform(PageFlowRequestProcessor.java:2116) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processInternal(PageFlowRequestProcessor.java:556) at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.process(PageFlowRequestProcessor.java:853) at org.apache.beehive.netui.pageflow.AutoRegisterActionServlet.process(AutoRegisterActionServlet.java:631) at org.apache.beehive.netui.pageflow.PageFlowActionServlet.process(PageFlowActionServlet.java:158) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42) at com.bea.jsptools.servlet.PagedResultServiceFilter.doFilter(PagedResultServiceFilter.java:82) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42) at com.bea.p13n.servlets.PortalServletFilter.doFilter(PortalServletFilter.java:336) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42) at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:503) at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:251) at org.apache.beehive.netui.pageflow.internal.DefaultForwardRedirectHandler.forward(DefaultForwardRedirectHandler.java:128) at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.doForward(PageFlowRequestProcessor.java:1801) at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processPageFlowRequest(PageFlowRequestProcessor.java:741) at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processInternal(PageFlowRequestProcessor.java:474) at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.process(PageFlowRequestProcessor.java:853) at org.apache.beehive.netui.pageflow.AutoRegisterActionServlet.process(AutoRegisterActionServlet.java:631) at org.apache.beehive.netui.pageflow.PageFlowActionServlet.process(PageFlowActionServlet.java:158) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42) at com.bea.jsptools.servlet.PagedResultServiceFilter.doFilter(PagedResultServiceFilter.java:82) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42) at com.bea.portal.tools.servlet.http.HttpContextFilter.doFilter(HttpContextFilter.java:60) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42) at com.bea.p13n.servlets.PortalServletFilter.doFilter(PortalServletFilter.java:336) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3502) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(Unknown Source) at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2186) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2092) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201) at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

  • Insert Large Binary Values

    Hi all.,
    I want to insert a very large binary value of about 40000 character into database table i have tried by using clob datatype and blob datatype but all my efforts where ended in vain..
    So can any one help me on this......
    Thanks In advance

    You should use the dbms_lob package.
    RTM first, then ask.

  • Moved to Server 2012 getting Access Database Corruption

    We moved our company file shares to a new Windows 2012 server and are now having issues with Access databases becoming corrupted when accessed by multiple clients at the same time.  Does anyone have any ideas on what could be causing this?  We
    were not having any issues with this on the 2008 or 2003 servers these were on previously.

    We migrated from a Windows 2008 file server cluster with four nodes to a Windows 2012 R2 file cluster with two nodes. 
    After the migration to the new file server cluster our customers running Windows 7 SP1 started reporting Access Database corruption and slow file access. 
    However, if the SAME Access Database file was hosted on a Windows 2012 R2 file server NOT in a cluster there was no corruption. 
    I will not bore you with all the tests we ran while trying to determine the cause but here is what we did to fix the issue.
     The solution was provided via an open case with Microsoft.
    1. Create the following registry entries on all Windows 2012 R2 Servers in the new file server CLUSTER and reboot.
    Key:  HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters
    Value:  DisableLeasing
    Type:  DWORD
    Data:  0x1

  • Directory Server 6.2 - Possible Database Corruption

    We have become aware of a bug in Directory Server 6.2 only that could cause database corruption. We have a hotfix for this issue, and if you are running Directory Server 6.2 and run into this problem then you should contact Sun Support and ask for the fix for the following bug
    6642430: DB corruption (zero&rsquo;d pages) when performing db2ldif against large 20GB ldif file.
    The sunsolve record for this bug can be found at [http://sunsolve.sun.com/search/document.do?assetkey=1-1-6642430-1].
    NOTE: This issue does not affect Directory Server 6.0 or 6.1 release so you only need this fix if you are running Directory Server 6.2.
    After you have the hotfix for this issue on Directory Server 6.2 and have applied the hotfix, then you will have to re-initialize the database from an LDIF backup to fully correct the corruption issue. Simply applying the hotfix will not fix the database if the database is already corrupted. Database corruption can be present though not detected with data in binary formats. You must therefore rebuild the database by importing an LDIF backup.
    Directory Server Enterprise Edition 6.2 is no longer available for download and Directory Server Enterprise Edition 6.3, which includes a fix for this issue, will be available for download early April. When upgrading to Directory Server 6.3 from 6.2 (not needed if you are on 6.0 or 6.1), make sure you export the database (db2ldif) prior to the upgrade and then re-import the database after the upgrade to fully re-initialize the database and to ensure that no corruption issues remain.
    Recommended patch or upgrade procedures:
    <ol><li>     Shut down each directory server instance, as described in [Starting, Stopping, and Restarting a Directory Server Instance|http://docs.sun.com/app/docs/doc/820-2491/6ne3dhd8u?a=view#bcaan].
    </li>
    <li>     Perform an LDIF export of the database, as described in [Backing Up to LDIF|http://docs.sun.com/app/docs/doc/820-2491/6ne3dhdio?a=view#ganwh].
    </li>
    <li>     Install the [hotfix for bug 6642430|http://sunsolve.sun.com/search/document.do?assetkey=1-1-6642430-1] on Directory Server 6.2, or upgrade your Directory Server 6.2 instance to Directory Server 6.3 once Directory Server 6.3 is available for download (early April). You will need to login to Sunsolve in order to
         see this bug description.
    </li>
    <li>     Re-initialize the database from the LDIF exported in step 2, as described in [Importing Data From an LDIF File|http://docs.sun.com/app/docs/doc/820-2491/6ne3dhdj4?a=view#ganwc].
         If you are running replicated instances of Directory Server, make sure you read [Restoring Replicated Suffixes|http://docs.sun.com/app/docs/doc/820-2491/6ne3dhdjc?a=view#bcajf] as well.
    </li>
    </ol>
    Edited by: KevinLeMay on Mar 28, 2008 4:48 AM

    The entry was not imported most likely because it's parent isn't in the database yet. Are entries above this in another backend ? If so try importing that backend first. Also, that dn is so long, that it exhausted the buffer which is used to write messages in the access log. This is why, there's nothing after "which".
    What is the exact reason why a export and import is necessary? Or is it only necessary if
    the database is already corrupt? Is there a way to check that?The database corruption could be silent. So a binary backup/restore when going from 6.2 to 6.3 is not recommended and the LDIF route must be used.

  • Assigning a hex value to a variable and getting binary value of a variable.

    I try to develop java programs and I need to do a conversion unicode to EBCDIC and vice versa.
    How can I assign hex values to variables to build UTF-EBCDIC and EBCDIC-UTF table and get hex or binary value of data to compare it to value of in the table?
    I did a conversion like this with PL/1 before. I do not know how can I do it with Java. Because I am new to Java.
    Thank you in advance.

    I will run java code in mainframe and java uses
    unicode for data in default and mainframe environment
    is EBCDIC. So I have to translate the data from
    unicode to ebcdic.I said I think String supports EBCDIC encoding...
    String ebcdic = new String(ebcdicBytes, "Cp500");
    http://java.sun.com/j2se/1.4.2/docs/guide/intl/encoding.doc.html

  • Returning sql statement instead of values from database

    hi am reading value from database but my problem is am get sql statement values instead of values in database
    my code is
    java:337)

    There is no doubt: you get what you want:
        return s_getValue;
    bye
    TPD

  • Need to convert a binary value into decimal

    Hi i need to convert a binary value which i would be getting as a string object to a decimal value......need code for the same

    Check Integer.parseInt
    http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Integer.html#parseInt(java.lang.String,%20int)

  • Unable to access values from database in login page..

    Hey all,
    Friends I have a login.jsp page and I want if i enter username and password then it will be accessed from database and after verifying the details it will open main.jsp.I made a database as "abc" and created DSN as 1st_login having table 1st_login. But the problem is that I am unable to access values from database.
    So Please help me.
    Following is my code:
    <HTML>
    <body background="a.jpg">
    <marquee>
                        <CENTER><font size="5" face="times" color="#993300"><b>Welcome to the"<U><I>XYZ</I></U>" of ABC</font></b></CENTER></marquee>
              <br>
              <br>
              <br>
              <br><br>
              <br>
         <form name="login_form">
              <CENTER><font size="4" face="times new roman">
    Username          
              <input name="username" type="text" class="inputbox" alt="username" size="20"  />
              <br>
         <br>
              Password          
              <input type="password" name="pwd" class="inputbox" size="20" alt="password" />
              <br/>
              <input type="hidden" name="option" value="login" />
              <br>
              <input type="SUBMIT" name="SUBMIT" class="button" value="Submit" onClick="return check();"> </CENTER>
              </td>
         </tr>
         <tr>
              <td>
              </form>
              </table>
    <%
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection connection = DriverManager.getConnection("jdbc:odbc:1st_login");
    Statement statement = connection.createStatement();
    String query = "SELECT username, password FROM 1st_login WHERE username='";
    query += request.getParameter("username") + "' AND password='";
    query += request.getParameter("password") + "';";
    ResultSet resSum = statement.executeQuery(query);
    //change: you gotta move the pointer to the first row of the result set.
    resSum.next();
    if (request.getParameter("username").equalsIgnoreCase(resSum.getString("username")) && request.getParameter("password").equalsIgnoreCase(resSum.getString("password")))
    %>
    //now it must connected to next page..
    <%
    else
    %>
    <h2>You better check your username and password!</h2>
    <%
    }catch (SQLException ex ){
    System.err.println( ex);
    }catch (Exception er){
    er.printStackTrace();
    %>
    <input type="hidden" name="op2" value="login" />
         <input type="hidden" name="lang" value="english" />
         <input type="hidden" name="return" value="/" />
         <input type="hidden" name="message" value="0" />
         <br>
              <br><br>
              <br><br>
              <br><br><br><br><br>
              <font size="2" face="arial" color="#993300">
         <p align="center"> <B>ABC &copy; PQR</B>
    </BODY>
    </HTML>
    and in this code i am getting following error
    C:\Project\SRS\build\generated\src\org\apache\jsp\loginjsp.java:93: cannot find symbol_
    C:\Project\SRS\build\generated\src\org\apache\jsp\loginjsp.java:93: cannot find symbol_
    C:\Project\SRS\build\generated\src\org\apache\jsp\loginjsp.java:94: cannot find symbol_
    C:\Project\SRS\build\generated\src\org\apache\jsp\loginjsp.java:95: cannot find symbol_
    4 errors
    C:\Project\SRS\nbproject\build-impl.xml:360: The following error occurred while executing this line:
    C:\Project\SRS\nbproject\build-impl.xml:142: Compile failed; see the compiler error output for details.
    BUILD FAILED (total time: 6 seconds)

    As long as you're unable to compile Java code, please use the 'New to Java' forum. This is really trival.
    To ease writing, debugging and maintenance, I highly recommend you to write Java code in Java classes rather than JSP files. Start learning Servlets.

  • How to get string value from database table using Visual Studio 2005?

    Hi,
    Im developing plugin in illustrator cs3 using visual studio 2005. I need to get the values eneterd in database. Im able to get the integer values. But while getting string values it is returning empty value.
    Im using the below code to get the values from database table
    bool Table::Get(char* FieldName,int& FieldValue)
        try
            _variant_t  vtValue;
            vtValue = m_Rec->Fields->GetItem(FieldName)->GetValue();
            FieldValue=vtValue.intVal;
        CATCHERRGET
        sprintf(m_ErrStr,"Success");
        return 1;
    Im using the below code to get the values.
    AIErr getProjects()
        char buf[5000];
        int i;   
        std::string  catName;
        ::CoInitialize(NULL);
        Database db;
        Table tbl;
        errno_t err;
        err = fopen(&file,"c:\\DBResult.txt","w");
        fprintf(file, "Before Connection Established\n");
        //MessageBox(NULL,CnnStr,"Connection String",0);
        if(!db.Open(g->username,g->password,CnnStr))
            db.GetErrorErrStr(ErrStr);
            fprintf(file,"Error: %s\n",ErrStr);
        fprintf(file, "After Connection Established\n");
    if(!db.Execute("select ProjectID,ProjectName from projectsample",tbl))
            db.GetErrorErrStr(ErrStr);
            fprintf(file,"Error: %s\n",ErrStr);
        int ProjectID;
        int UserID;
        int ProjectTitle;
        char ProjectName[ProjectNameSize];
        if(!tbl.ISEOF())
            tbl.MoveFirst();
        ProjectArrCnt=0;
        for(i=0;i<128;i++)
            buf[i]='\0';
            int j=0;
        while(!tbl.ISEOF())
            if(tbl.Get("ProjectID",ProjectID))
                fprintf(file,"Project ID: %d ",ProjectID);
                ProjectInfo[ProjectArrCnt].ProjectID = ProjectID;
                sprintf(buf,"%d",ProjectID);
                //MessageBox(NULL, buf,"f ID", 0);
                j++;
            else
                tbl.GetErrorErrStr(ErrStr);
                fprintf(file,"Error: %s\n",ErrStr);
                break;
            //if(tbl.Get("ProjectTitle",ProjectName))
            if(tbl.Get("ProjectName",ProjectName))
                MessageBox(NULL,"Inside","",0);
                fprintf(file,"ProjectTitle: %s\n",ProjectName);
                //catName=CategoryName;
                ProjectInfo[ProjectArrCnt].ProjectName=ProjectName;
                //sprintf(buf,"%s",ProjectName);
                MessageBox(NULL,(LPCSTR)ProjectName,"",0);
            else
                tbl.GetErrorErrStr(ErrStr);
                fprintf(file,"Error: %s\n",ErrStr);
                break;
            ProjectArrCnt++;
            //MessageBox(NULL, "While", "WIN API Test",0);
            tbl.MoveNext();
        //MessageBox(NULL, ProjectInfo[i].ProjectName.c_str(),"f Name", 0);
        ::CoUninitialize();
        //sprintf(buf,"%s",file);
        //MessageBox(NULL,buf,"File",0);
        fprintf(file, "Connection closed\n");
        fclose(file);
        for(i=0;i<ProjectArrCnt;i++)
            sprintf(buf,"%i",ProjectInfo[i].ProjectID);
            //MessageBox(NULL,buf,"Proj ID",0);
            //MessageBox(NULL,ProjectInfo[i].ProjectName.c_str(),"Project Name",0);
        return 0;
    In the above code im geeting project D which is an integer value. But not able to get the project name.
    Please some one guide me.

    As I said in the other thread, this really isn't the place to ask questions about a database API unrelated to the Illustrator SDK. You're far more like to find people familliar with your problem on a forum that is dedicated to answering those kinds of questions instead.

  • How can i get the random values from database?

    Hi,
    i want to get random values from database.
    I try my best find no solution
    plz give solution in either sql query or java method.
    thanks in advance.

    try this:
    Give a numeric row-id to each row of database.
    say (1-100) for 100 rows
    In the program use random function to get random number between 0 and 1. this value u multiply with 100(or total number of rows) and take integer value of it . u then perform sql query to select the a row which matches randomly genarated value with row-id assigned to each row of database
    madhu

  • SelectOneChoice not showing all values from database

    Hi!
    I have to put a list of values in my select one choice. When I do the query in database, all the values are selected. But, with the same query on JPQL, the select on choice do not show all values in database. Anyone can help me, please?
    P.S.: I am using SelectOneChoice with SelectItems, in JDeveloper 11g
    Code:
    <af:selectOneChoice id="selAction" value="#{row.idCmd}"
    unselectedLabel="&lt;Selecione>">
    <af:forEach var="alertTypeNode"
    items="#{bindings.actionFindAll.iteratorBinding.allRowsInRange}">
    <af:selectItem value="#{alertTypeNode.dataProvider.idCmd}"
    label="#{alertTypeNode.dataProvider.nmCmd}"
    id="si1"/>
    </af:forEach>
    </af:selectOneChoice>

    In your page binding check the rangesize setting for the executable you use - set it to -1.

  • Fetching values from database into a drop down box

    in my JSP page there are 3 drop down boxes for date of birth......
    what i need is i want to get the values from database into that drop down box when i access the JSP page.......
    session is there....'m getting all other values.......
    I will attach the JSP page.....
    Please help me...........
    Thanks in Advance......
    <%@ taglib uri='/WEB-INF/taglib/struts-bean.tld' prefix='bean'%>
    <%@ taglib uri='/WEB-INF/taglib/struts-logic.tld' prefix='logic'%>
    <%@ taglib uri='/WEB-INF/taglib/dyna.tld' prefix='dyna'%>
    <%@ taglib uri='/WEB-INF/taglib/struts-html.tld' prefix='html'%>
    <!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">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title><bean:message key="page_title"/></title>
    <link href="<bean:message key="context"/>/CSS/default.css" rel="stylesheet" type="text/css" />
    <script src="<bean:message key="context"/>/js/AC_RunActiveContent.js" type="text/javascript"></script>
    <link href="<bean:message key="context"/>/CSS/screen.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <%!
    Membership mShip = null;
    %>
    <script language="javascript" >
    function checkDate(Form){
    var d;
    d = Form.year.value+"-"+Form.month.value+"-"+Form.day.value;
    alert("Date is:"+d);
    Form.dob.value = d;
    </script>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td>
         <jsp:include flush="true" page="../templates/header.jsp"/>     </td>
    </tr>
    <tr>
    <td class="menuTD">     
         <jsp:include flush="true" page="../templates/menu.jsp"/>     </td>
    </tr>
    <tr>
    <td class="sub_menuTR"> </td>
    </tr>
    <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td class="column" valign="top" width="170"><jsp:include flush="true" page="../templates/left_panel.jsp"/></td>
    <td valign="top" align="left">
              <dyna:message error="error" warning="warning" message="message"/>
              <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="80%" valign="top" align="left">
                   <%
                   if(session != null){
                   mShip = (Membership)session.getAttribute("member");
                   %>
                        <form action="updateContactDetails.dy" method="post" name="form1">
                        <input type="hidden" name="m" value="<%=request.getParameter("m")%>" />
                             <table width="100%" border="0">
                             <tr>
                                  <td>First Name</td>
                                  <td><input name="first_name" type="text" id= "first_name" value = "<bean:write name = "member" property = "first_name" />" /></td>
                             </tr>
                             <tr>
                                  <td>Last Name </td>
                                  <td><input name="last_name" type="text" id="last_name" value = "<bean:write name = "member" property = "last_name" />" > </td>
                             </tr>
                             <tr>
                                  <td>Address</td>
                                  <td><input name="address1" type="text" id="address1" value = "<bean:write name = "member" property = "address1" />" ></td>
                             </tr>
                             <tr>
                                  <td> </td>
                                  <td><input name="address2" type="text" id="address2" value = "<bean:write name = "member" property = "address2" />" ></td>
                             </tr>
                             <tr>
                                  <td>Suburb/City </td>
                                  <td><input name="city" type="text" id="city" value= "<bean:write name = "member" property = "city" />" ></td>
                             </tr>
                             <tr>
                                  <td>State/Territory</td>
                                  <td><input type="text" name="state" value = "<bean:write name = "member" property = "state" />" ></td>
                             </tr>
                             <tr>
                                  <td>Postcode</td>
                                  <td><input type="text" name="postcode" value = "<bean:write name = "member" property = "postcode" />" ></td>
                             </tr>
                             <tr>
                                  <td>Contact Phone</td>
                                  <td><input type="text" name="home_phone" value = "<bean:write name = "member" property = "home_phone" />" ></td>
                             </tr>
                             <tr>
                                  <td>Mobile</td>
                                  <td><input type="text" name="mobile" value = "<bean:write name = "member" property = "mobile" />" ></td>
                             </tr>
                             <tr>
                                  <td>Date of birth</td>
                                  <td nowrap="nowrap"><select name="day">
    <option>Day</option>
    <option value="01">1</option>
    <option value="02">2</option>
    <option value="03">3</option>
    <option value="04">4</option>
    <option value="05">5</option>
    <option value="06">6</option>
    <option value="07">7</option>
    <option value="08">8</option>
    <option value="09">9</option>
    <option value="10">10</option>
    <option value="11">11</option>
    <option value="12">12</option>
    <option value="13">13</option>
    <option value="14">14</option>
    <option value="15">15</option>
    <option value="16">16</option>
    <option value="17">17</option>
    <option value="18">18</option>
    <option value="19">19</option>
    <option value="20">20</option>
    <option value="21">21</option>
    <option value="22">22</option>
    <option value="23">23</option>
    <option value="24">24</option>
    <option value="25">25</option>
    <option value="26">26</option>
    <option value="27">27</option>
    <option value="28">28</option>
    <option value="29">29</option>
    <option value="30">30</option>
    <option value="31">31</option>
    </select>
                                  <select name="month">
                                       <option>Month</option>
                                       <option value="01">January</option>
                                       <option value="02">February</option>
                                       <option value="03">March</option>
                                       <option value="04">April</option>
                                       <option value="05">May</option>
                                       <option value="06">June</option>
                                       <option value="07">July</option>
                                       <option value="08">August</option>
                                       <option value="09">September</option>
                                       <option value="10">October</option>
                                       <option value="11">November</option>
                                       <option value="12">Decembber</option>
                                  </select>
                                       <select name="year" onChange = "checkDate(this.form);" >
                                       <option>Year</option>
                                       <option value="1957">1957</option>
                                       <option value="1956">1956</option>
                                       <option value="1955">1955</option>
                                       <option value="1954">1954</option>
                                       <option value="1955">1955</option>
                                       <option value="1956">1956</option>
                                       <option value="1957">1957</option>
                                       <option value="1958">1958</option>
                                       <option value="1959">1959</option>
                                       <option value="1960">1960</option>
                                       <option value="1961">1961</option>
                                       <option value="1962">1962</option>
                                       <option value="1963">1963</option>
                                       <option value="1964">1964</option>
                                       <option value="1965">1965</option>
                                       <option value="1966">1966</option>
                                       <option value="1967">1967</option>
                                       <option value="1968">1968</option>
                                       <option value="1969">1969</option>
                                       <option value="1970">1970</option>
                                       <option value="1971">1971</option>
                                       <option value="1972">1972</option>
                                       <option value="1973">1973</option>
                                       <option value="1974">1974</option>
                                       <option value="1975">1975</option>
                                       <option value="1976">1976</option>
                                       <option value="1977">1977</option>
                                       <option value="1978">1978</option>
                                       <option value="1979">1979</option>
                                       <option value="1980">1980</option>
                                       <option value="1981">1981</option>
                                       <option value="1982">1982</option>
                                       <option value="1983">1983</option>
                                       <option value="1984">1984</option>
                                       <option value="1985">1985</option>
                                       <option value="1986">1986</option>
                                       <option value="1987">1987</option>
                                       <option value="1988">1988</option>
                                       <option value="1989">1989</option>
                                       <option value="1990">1990</option>
                                       <option value="1991">1991</option>
                                       <option value="1992">1992</option>
                                       <option value="1993">1993</option>
                                       <option value="1994">1994</option>
                                       <option value="1995">1995</option>
                                       <option value="1996">1996</option>
                                       <option value="1997">1997</option>
                                       <option value="1998">1998</option>
                                       <option value="1999">1999</option>
                                       <option value="2000">2000</option>
                                       <option value="2001">2001</option>
                                       <option value="2002">2002</option>
                                       <option value="2003">2003</option>
                                       <option value="2004">2004</option>
                                       <option value="2005">2005</option>
                                       <option value="2006">2006</option>
                                       <option value="2007">2007</option>
                             </select ></td></tr>
                             <tr>
                                  <td><input type="hidden" name = "dob" /> </td>
                                  <td nowrap="nowrap"><input type="submit" value="Submit" /></td>
                             </tr>
                             </table>
                        </form>
                   </td>
    <td width="40"></td>
    <td width="200" valign="top">
                   <div id="headlines">
    <jsp:include flush="true" page="../templates/profile.jsp"/>
    </div>
                   </td>
    </tr>
    </table>
              </td>
    <td> </td>
    </tr>
    </table></td>
    </tr>
    <tr>
    <td><jsp:include flush="true" page="../templates/footer.jsp"/></td>
    </tr>
    </table>
    </body>
    </html>

    i think normally u will get data from databsae as objects.they are like java beans having getter and setter methods.so you create a collection of those objects like collect all the objects coming from database into an arraylist or....
    suppose you want to populate the dropdown box with say "username" from database object s, your code will look like that
    <html:select property="name">
    <html:options collection="databaseList" property="username" />
    </html:select>
    "databaseList" is collection(say.. ArrayList) of objects you are getting from database.this dropdown will contain all the "usernames" you are getting from database.

  • Assigning a binary value to an integer

    Hi, I am trying to assign a binary value in my program to an integer. In some assembly languages you would do the following:
    mov a, 00010101b
    for binary and for hex:
    mov a, 0E2h
    In java, you can assign a hex value with:
    int a=0x3F;
    What should I do to assign a binary value? Is it possible?
    Regards... Martin Schmiedel

    The static method parseInt in the java.lang.Integer class can be used to convert a String representing a binary number into its decimal integer value. In addition to the string representing the number, you also pass in an integer representing the radix, which for binary would be 2, hex would be 16, etc. So for example:
    int x = Integer.parseInt("00010110", 2);
    Is that what you're trying to do? Cheers,
    Chris

  • Trying to install Photo Shop CS3 Extended on Windows 8 and keep getting database corrupted

    Hi, I am trying to install my Adobe Photoshop CS3 Extended on my new Windows 8 OS 64 Bit computer. The CD does not have a scratch on it, it is like new. I get the error database is corrupted. Contact Adobe Support.
    I went to the Adobe website and downloaded the updated installer, same error. I tried running the installer in Windows XP compatibility mode, it looks like it installed, but when I run I get database corrupted.
    I could really use some help.

    Error "...Installer Database is Corrupt..." when you install Adobe Creative Suite 3 products

Maybe you are looking for

  • Redeploy process with HumanWorkflow always failed

    Hello, I need urgent help with OracleBpel server. The problem is when I try to redploy process with HumanWorkflow - deployment always failed with message: Caused by: oracle.oc4j.rmi.OracleRemoteException: An exception occurred during transaction comp

  • PRINTING ISSUES - NEWBIE

    Hello everyone, I am new to the forum and looking for some assistance. I am writing a lottery program for school where i need to be able to print a ticket showing the number played, for how much and all the stuff that goes in the ticket. Basically, a

  • Skype to Go in Hawaii

    Dear reader in order to get a Skype to Go Number I added credit to my account. That worked well. The problem occurred when I wanted to actually set up the number. I'm in Hawaii and it seems there is no possibility to set up a number here? It is very

  • How to view Exchange 2007 Public folders, calender on iphone

    How to view Exchange 2007 public folders mainly the calenders on the iphone?

  • Survey Repository XSLT files

    Hello friends To change the submit button functionality in Survey I am trying to change the CRM_SVY_GENERATE_SURVEY_TEMPLATE.XSLT file can any one let me know how can i do this as its not allowing to replacing the file or edit it. And i have imported