Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Database > Oracle ASP
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Oracle ASP Using ASP with Oracle databases. For Oracle discussions not specific to ASP, please see the Oracle forum. For more ASP discussions, please see the ASP forum category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Oracle ASP section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 6th, 2006, 05:44 AM
Registered User
Join Date: Apr 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sporadic problem with Oracle selecting SEQUENCE ID

I have a web application which is running both in a development server and a staging server (hosted by someone else). I'm experiencing very sporadic problems with inserting new rows into all the tables on the staging server. Apparently, nothing has been changed at all on both servers, and I have not experience anything like what's happening on the staging server. I include the code segment (with some output for troubleshooting) below:

    on error resume next

    dim db, query, rs
    set db = getConnection()

    query  = "SELECT MY_SEQ.nextval AS nextid FROM dual"
    set rs = db.CreateDynaset(query, 0)

    if Err.Number > 0 then
        Response.write "2. " & Err.Description & "<br>"
    end if

    dim nextId : nextId = cint(rs.fields("nextid").value)

    if Err.Number > 0 then
         Response.write "3. " & query & "<br>"
        Response.write "4. " & Err.Description & "<br>"
    end if

    query  = "SELECT * FROM MY_TABLE"
    set rs = db.dbCreateDynaset(query, 0)

    if Err.Number > 0 then
        Response.write "5. " & query & "<br>"
        Response.write "6. " & Err.Description & "<br>"
    end if

        rs.fields("user_id").value                   = nextId

    if Err.Number > 0 then
        Response.write "7. " & Err.Description & "<br>"
    end if


    if Err.Number > 0 then
    end if
And this is what I got:

3. SELECT MY_SEQ.nextval AS nextid FROM dual
4. Object required
6. Object required
7. SQL execution error, ORA-01400: cannot insert NULL into ("MY_DB"."MY_TABLE"."USER_ID")
BTW, I'm using Oracle OO4O with database pool on IIS 5.0 on the staging server. Hope it helps.

This is what I have in the global.asa file:

<object runat="server" scope="application" id="OraSession" progid="OracleInProcServer.XOraSession"></object>
<script language="vbscript" runat="server">
sub application_onStart
     oraSession.createDatabasePool 1, 40, 200, "database", "username/password", 0
end sub
And this is what I have in my getConnection function:

function getConnection
    dim dbName : dbName = "database"
    dim dbCredentials : dbCredentials = "username/password"
    dim db : set db = oraSession.getDatabaseFromPool(0)
    set getConnection = db
end function
The thing is, this used to work, but now it doesn't, although once in a while I do get to get it working correctly. So everything is extremely sporadic and unstable.

I have a corresponding edit page, which does a UPDATE instead of AddNew, and that doesn't give me any problems, which leads me to believe it has to do with getting the ID from SEQUENCE.

I am pulling my hair out now, and have no idea how to troubleshoot this further or what I might have overlooked. Would appreciate if any experts can help me out.



Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
problem selecting listview item method Visual C++ 0 July 7th, 2006 04:06 PM
problem in selecting the item from drop down list swati_joshi ASP.NET 1.0 and 1.1 Basics 1 March 27th, 2006 01:24 AM
Problem with selecting data between two dates serf SQL Language 1 January 18th, 2006 01:16 PM
Oracle Sequence No , Date format ssertial BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 2 January 23rd, 2005 06:01 AM
Sequence grant in Oracle rekha_jsr Oracle 1 January 3rd, 2005 12:50 AM

All times are GMT -4. The time now is 09:23 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.