Cant get @@IDENTITY

I have a table TESTTABLE which has an identity column as its primary key. Now i have an INSERT statement which I want to execute and then get the key generated for the new row. So what I did is :
String sqlStatement = "INSERT INTO TIMECARDBATCH ( name, desc ) VALUES ( 'TOR', 'Toronto' )";
slqStatement += " SELECT @@IDENTITY";
Connection cx = null;
Statement stmt = null;
ResultSet rs = null;
int intReturnValue = -1;
try {
cx.prepareCall( sqlStatement );
stmt.execute();
rs = stmt.getResultSet();
if (rs != null) {
rs.next();
intReturnValue = rs.getInt(1);
Whats happening is that I am getting rs as null. As a result I cant get the identity generated. Any reason why this is happening?
Application Server: JBoss 3.2.3
Database: MS SQL Server 2000
JDBC Driver: MS SQL Server JDBC Driver
Thanks

Actually, if I read that right, I'd be surprised if it even works. Are you smothering exceptions?
You're trying to execute this: INSERT INTO TIMECARDBATCH ( name, desc ) VALUES ( 'TOR', 'Toronto' ) SELECT @@IDENTITY"I doubt that's legal SQL.
You can either execute two separate statements, or maybe make them part of a batch.
Also, I'm not sure why you're even using CallableStatement. It looks like you should just be using a PreparedStatement. And inside the "VALUES" part you should just have (?, ?) and then use PrepearedStatement's setString() to set those values. That keeps you out of trouble having to deal with escaping special characters.

Similar Messages

  • HT5787 i forget the security questions answers and i cant get email of resetting link in my email

    i forget the security questions answers and i cant get email of resetting link to my email

    If the email hasn't arrived after a few hours and isn't in a spam filter, you need to ask Apple to reset your security questions; ways of contacting them include phoning AppleCare and asking for the Account Security team, clicking here and picking a method for your country, and filling out and submitting this form.
    They wouldn't be security questions if they could be bypassed without Apple verifying your identity.
    (103829)

  • Cant get my. mac email to go online. Something to do with cetificates

    I cant get my email .mac email to go online. All my settings are correct. It keeps flashing up : Mail was unable to verify the identity of the server, which has a certificate issued to "mail.mac.com. The error was: An SSL error occurred while trying to read data from the server"mail.mac.com" It's driving me crazy, e-mails are coming through fine on my iphone, and the pop accounts on the same mac.

    How long ago was it working?
    Do you have another Mac with 10.6.8 or higher on it so you can get an iCloud account?

  • I forgot my security questions and cant get the link to reset them by email

    I forgot my security questions and cant get the link to reset them by email.  Can someone help me?

    You need to ask Apple to reset your security questions; this can be done by clicking here and picking a method, or if your country isn't listed, filling out and submitting this form.
    They wouldn't be security questions if they could be bypassed without Apple verifying your identity.
    (109220)

  • Iphone 4 keeps scanning then showing apple icon it wont stop. cant get any other screen

    can anyone help me im having trouble with iphone 4 it wont stop scanning then showing apple icon. i cant get the phone to do anything else.

    Hi, did you ever solve this problem?
    My 1 year old -- ha! one month out of warranty -- iPhone 4 has been having a nearly identical problem over the past few days.
    It started by dying completely so I had the battery replaced, thinking it was simply battery issue.
    It then worked again for a moment but started doing exactly what you describe, going through a reset cycle (longer than 30 seconds but who's counting). And it felt quite warm.
    Did hard reset, plugged into wall charger and MBP USB but the new battery wouldn't even get a full charge (a whopping 92% after nearly two days). It would even lose battery when plugged in if I opened an app. And all the while plugged in, if I left the phone on, it would cycle through these resets. So I turned it off to try to charge it.
    Now suddenly, it's dead again. Totally black, and hard reset does nothing. Up until two days ago there was nothing wrong whatsoever with this phone! And I hadn't even installed a new app that could be the root of the issue. No idea whatsoever what caused this.
    Any help would be much appreciated!!

  • I forgot my security question answers and i cant get the rescue email. I emaild the apple people and they cant do anything.

    I forgot my security question answers and i cant get the rescue email. I emaild the apple people and they cant do anything to fix it. the problem is i put the hundred dollar gift card on my account and now i cant use it on my mac and im really impatient now because this has been going on for a while! please if you have any answers just tell me how to fix it.

    You need to ask Apple to reset your security questions. To do this, click here and pick a method; if that page doesn't list one for your country or you're unable to call, fill out and submit this form.
    They wouldn't be security questions if they could be bypassed without Apple verifying your identity.
    (115016)

  • My macbook pro no longer connects to my TV with the mini dvi to hdmi adapter. It was working fine now I cant get it to output to the Tv. Any ideas?

    My Macbook pro no longer outputs to my vizio led tv. It was working fine now I cant get any picture. It just says no signal. It is not the hdmi or the adapter because it works fine with my other tv. Any ideas on how to resolve this would be greatly appreciated. Please be as specific as possible. Thanks. BTW--I am using the mini dvi to hdmi adapter in case that was unclear.

    Since you say that the same connectors work on your other TV is suggests that the fault is not in the connectors but your Vizio TV.  I would check the settings on the Vizio TV.  Verify that is is set to receive HDMI input.  Perhaps you or some one else has inadvertently changed them.  Pressing the wrong buttons on a remote control device can do that.  (I am assuming no changes were made in SYSTEM PREFERENCES>DISPLAYS)
    Ciao.

  • I cant get itunes on my new laptop.  My laptop says I have to remove itunes from another computer as I can only have it on 5.  Problem is that apart from my ipad, I no longer have the others as they were either broken beyond repair or lost.  Any ideas?

    I am not good with computers.  I am trying to get my iTunes onto this new laptop but it says I am only allowed to have it on 5 computers and I must take it off one to ut it on this new laptop.  Problem is, apart from my iPad, I have lost one laptop and two have been broken beyond repair so I am unable to take it off!  Anyone any ideas?  I have tried to get iTunes support but cant get past the "date of purchase" as I can only guess when I bought my ipod (2009)

    Hang on...
    You can only authorise the songs you purchase from the iTunes Store to play on five computers.
    You can download and install iTunes (the iTunes programme) onto as many computers as you wish.
    Two different things.
    Assuming therefore, that your problem is that you have authorised five computers, but now no longer have some of them, you need to de-authorise all your computers and then re-authorise the computers you still have.
    To de-authorise your computers, go to your account in the iTunes Store and look for the Deauthorise All button.

  • I tried downloading a free app and it asked for my billing information and when i entered it, it says that there was a billing problem with a previoud purchase and i have to update it. I keep updating it and it wont let me verify it and i cant get apps

    I tried downloading a free app and it asked for my billing information and when I entered it, it said that there was a billing problem with a previous purchase and I have to update it. I keep updating it and it wont let me verify it and I cant get any apps even if they are free, and I just Deleted some apps to make room for my new upate!

    The message says: "The payment method has been denied, try another method"
    I'm living in the same country and city since I was born, so I don't think the location is the problem.
    And yes, I paid with the card a meal in Burguer King today. And nothing more.

  • How do I get my new iphone restored with my old backup? my old iphone had ios5 and the replacement phone i got has ios4 and it wont let me backup my phone because it doesnt have ios4... i cant get ios5 without restoring my iphone and backing it uo

    Basically, i need all my old stuff from my iphone 4 with ios5 onto my new iphone 4.  The new phone i received only had ios4. I went to get all my contacts and backup from my old phone onto my new phone and it wont let me because my new phone is only ios4 and my backup from my old phone was in ios5.  I cant get ios5 on my phone without creating a new backup of my new phone, which has nothing on it.  If i restore it as a new phone and backup virtually nothing from my new phone, will that get rid of all my old backup stuff from my old iphone?

    Bottom line is you CANNOT restore to a phone from a backup that has a more recent iOS which is what you're trying to do.  Just can't be done.

  • How do I connect my Mac Book Pro to a projector I have the adapter but cant get anything on the screen

    How do I connect my Mac Book Pro to a projector I have the adapter but cant get anything on the screen

    Go to your "screen settings". then chose "find screen" then you vill find the prosjector.
    this will probably fix your problem.
    if this dont works can it be something wrong with your adapter.
    hope it helps

  • I cant get two monitors to work on one pc.

    Does anyone know why i cant get two monitors working on one pc?
    I have a HP P6 2000 UKM computer, running windows 7 and it has a DVI D socket as well as the standard VGA (which i am using for my primary monitor)  I have got the right DVI  to VGA adaptor and have followed various instructions to set up duel disply but every tutorial i have seen says use the multiple display option,  but the option dropdown box is not there!
    Iv'e tried two different monitors but he same problem. If my graphics card does not suport 2 monitors then why is there a DVI D socket?
    Have never had this problem in the past!
    Please help.
    Nobby

    Hi,
    Please post the exact HP product number for your PC.
    VGA is analog and DVI-D is digital.  If you have two monitors then one of them needs to support a digital video signal if you want to use two monitors
    HP DV9700, t9300, Nvidia 8600, 4GB, Crucial C300 128GB SSD
    HP Photosmart Premium C309G, HP Photosmart 6520
    HP Touchpad, HP Chromebook 11
    Custom i7-4770k,Z-87, 8GB, Vertex 3 SSD, Samsung EVO SSD, Corsair HX650,GTX 760
    Custom i7-4790k,Z-97, 16GB, Vertex 3 SSD, Plextor M.2 SSD, Samsung EVO SSD, Corsair HX650, GTX 660TI
    Windows 7/8 UEFI/Legacy mode, MBR/GPT

  • HT1420 Cant get itunes to open.Error message:"its on a locked Cant get itunes to

    Cant get itunes to open.Error message:"its on a locked disk." What does this mean??!!

    ok heres what u gotta do
    yes i know its alot of steps but if you do them right it will work.
    1.remove all active versions of itunes
    2.then restart as it asks you to do, if it doesnt ask do it your self
    3.unplug ipod
    4.remove ipod software
    5. restart
    6.install the cd the ipod came w/
    7.when it asks you if you want to upgrade itunes say yes
    8.download the file
    9.intall the newest version
    10.restart
    if you have done exactly these steps(exactly in this order)then itunes should be working now

  • Help! I can't delete my neighbors email from my iPhone 5 icloud account after I sold it to him after restoring it to factory settings.  Now he's on my iCloud account and it cannot be deleted.  Its impossible.  help. It seems the first one cant get delete

    Help Please, I sold my iphone 4 to my neighbor after I restored it to factory settings.  I just bought a new iphone 5 and decided to check out the icloud "stuff' so that I can use 'find my iphone' because I have 2 kids.  I went to check out my icloud on my imac and in the address bar put icloud.com then signed in, double clicked on mail went accounts then clicked on the gear in the right hand corner and there it was.  My neighbor had his email in the icloud and there absolutely was no way to delete his info off of my new phone.  I guess once the first person enters their info you absolutely cant get rid of it.  you can get rid of aliases but just not the original one. WHY!!  Is there any brilliant, wonderful,generous person out there that would know how to delete him from my account.  The genius bar said that they've never seen this before.  If someone can help I'm taking the info to the apple stores that I went to so that I can teach them how to do it.  Of course, I will tell them who showed me. I give you my word.

    As far as I know you can't delete the primary email address for an iCloud account.  It's assigned when the account is created.  But your neighbor wouldn't have been able to get into your iCloud account without your Apple ID and password.  Are you sure the account wasn't still on your phone when you gave it to him?
    You could migrate a copy of your data to a new iCloud account but I would still be concerned that someone else was using my old account, which presumably still has your data in it.
    I'm fairly certain that you're going to have to have iCloud support help you sort this one out as they may have the ability to make changes to an existing account that users can't.  Make an appointment with the genius bar at a nearby Apple store and have them take a look at it.  If necessary, they should be able to contact iCloud support for you.

  • On set up I am frozen on screen which ioS 6 cant get itunes to sync

    On set up I am frozen on screen which ioS 6 cant get itunes to sync and I can turn the IPAD mini on but has no apps and is un responsive. When checking with computer its downloaded my pictures from Old ipad but I can see no apps or differing screens.
    It is basically just a zombie machine with a screen with IOS6 on it. I have left it on with WIFI over night and still nothing.
    I only bought this yesterday
    Help

    In windows goto control panel>add and remove and uninstall itunes AND quicktime.
    Now go here and follow ALL steps for cleaning itunes and quicktime out (Don't download or install yet) http://docs.info.apple.com/article.html?artnum=93976
    Scan for malware with ewido http://www.ewido.com
    DISABLE ANTIVIRUS and security programs, then go here and instal "Quicktime WITHOUT itunes" http://www.apple.com/quicktime/download/standalone.html
    Reboot, disable antivirus again then goto apple.com and download/install itunes

Maybe you are looking for