Invalid call Statement method: {0} In sql server,please help me!

Connect to a sql server 2000 DB,and the table has a identity column.
Run the code below:
String strSql = "insert into attachments([FileName],FileLength,FileContent) values(?,?,?)";
PreparedStatement pstmt = connection.prepareStatement(strSql);
pstmt.setString(1,fileName);
pstmt.setInt(2,iFileLength);
pstmt.setString(3,'aaaa');
if(pstmt.executeUpdate()==1) {//succeed;
strSql = "select @@identity";//this code run good in the Query Analyzer.
ResultSet rs = pstmt.executeQuery(strSql);//exception thrown!!!!!!!!!!!!
if(rs.next()) {//succeed;
int i = rs.getInt(1);
throw a exception:Invalid call Statement method: {0}
thanks a lot!

If you really must re-use your prepared statement, then you'll have to clear the parameters associated with it.
pstmt.clearParameters();What's happening is that the statement is trying to re-apply the previously assigned parameters to a query with no placeholders.
I'd rather use an ordinary Statement in this case.
Dave

Similar Messages

  • Calling a method from another class. Please Help!!

    Here is my full program. Like I said in my last post. I am having trouble calling the baseMakesError1 method. This method is called in the subcallsbase1 method. Also, it would be of great help if you could look for any other errors with with my program. Thank you so much. I really appreciate it.
    import java.io.BufferedReader;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    public class ThomasR11
    String sy;
    public static void main(String[] args)
    System.out.println("(main): Ryan Thomas, file ThomasR11: Exceptions");
    SubRT obj3;
    SubRT obj4;
    String sX;
    String x;
    String s;
    String sY;
    try
    ThomasR11 obj1=new ThomasR11();
    catch(NullPointerException NPE)
    System.err.println("Null Pointer Exception");
    ThomasR11 obj2=new ThomasR11("Hello");
    System.out.println("This is the last statement in main");
    public ThomasR11()
    SubRT obj3= new SubRT();
    obj3.subCallsBase1();
    public ThomasR11(String sY)
    throws FileNotFoundException
    SubRT obj4= new SubRT();
    obj4.subError2();
    obj4.subError3(sY);
    private static class BaseRT
    public BaseRT()
    System.out.println("In BaseRT constructor= " + this);
    public void baseMakesError1(int value0)
    System.out.println("In BaseRT constructor, about to throw exception");
    if (value0==0)
    throw new NullPointerException("NullPointerException");
    private class SubRT extends BaseRT
    SubRT subNull;
    public SubRT()
    System.out.println("In SubRT constructor before call to aMakes an error= " +
    "\n SubRT constructor= " + this);
    public void subCallsBase1()
    try
    System.out.println("Calling the method baseMakeserror1");
    baseMakesError1(subNull);<---------------------This is where I am getting the error it says "ThomasR11.java [79:1] baseMakesError1(int) in ThomasR11.BaseRT cannot be applied to (ThomasR11.SubRT)"
    catch(NumberFormatException NFE)
    System.err.println("\nNumber Format Exception");
    catch (NullPointerException NPE)
    System.err.println(NPE.getMessage() + "\n");
    System.err.println(NPE.toString() + "\n");
    throw NPE;
    public void subError2()
    try
    BufferedReader in = new BufferedReader( new FileReader( "c:/xx/xx.xx" ) );
    catch(NullPointerException NPE)
    System.out.println("Null Pointer Exception");
    catch (FileNotFoundException FNFE)
    System.err.println("FileNotFoundException");
    public void subError3( String sX)
    try
    System.out.println("Hello");
    System.out.println (sX.length());
    catch(NullPointerException NPE)
    System.err.println("Null Pointer Exception");

    "ThomasR11.java [79:1] baseMakesError1(int) in ThomasR11.BaseRT cannot be applied to (ThomasR11.SubRT)"
    ...this error is telling out that you wrote baseMakesError1 to accept an "int" as an argument, and you are trying to pass it an instance of the ThomasR11.SubRT class. You either have to change baseMakesError1 to accept a SubRT as an argument, or change your call to pass an integer.

  • DB Adapter calling stored procedure in MS SQL Server.

    Hi
    i am calling a stored procedure in a MS SQL Server.
    I configured a Datasource for MS SQL Server driver as Oracle's MS SQL Server Driver(Type 4) Versions: 7.0 and later and provide all db details of sql server. I tested the data source and was getting success message. My BPEL code is just talking with input parameter and then calling the stored procedure in sql server. I was able to compile the code in jdeveloper and deploy to weblogic. But when i am testing the code. i am getting an error.
    <env:Fault>
    <faultcode>env:Server</faultcode>
    <faultstring>Exception occured when binding was invoked.
    Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'IDMService' failed due to: JCA Binding Component connection issue.
    JCA Binding Component is unable to create an outbound JCA (CCI) connection.
    Test:IDMService [ IDMService_ptt::IDMService(InputParameters,OutputParameters) ] : The JCA Binding Component was unable to establish an outbound JCA CCI connection due to the following issue: javax.resource.spi.IllegalStateException: [Connector:199176]Unable to execute allocateConnection(...) on ConnectionManager. A stale Connection Factory or Connection Handle may be used. The connection pool associated with it has already been destroyed. Try to re-lookup Connection Factory eis/sql/idm from JNDI and get a new Connection Handle.
    Please make sure that the JCA connection factory and any dependent connection factories have been configured with a sufficient limit for max connections. Please also make sure that the physical connection to the backend EIS is available and the backend itself is accepting connections.
    The invoked JCA adapter raised a resource exception.
    Please examine the above error message carefully to determine a resolution.</faultstring>
    <faultactor/>
    <detail>
    <exception>[Connector:199176]Unable to execute allocateConnection(...) on ConnectionManager. A stale Connection Factory or Connection Handle may be used. The connection pool associated with it has already been destroyed. Try to re-lookup Connection Factory eis/sql/idm from JNDI and get a new Connection Handle.</exception>
    </detail>
    </env:Fault>
    What is the problem with connection . How cna i rectify it.
    Thanks,
    Venu Raja

    followed the steps mentioned in meatalnk..
         JCA-12563 - Unable to Establish an Outbound JCA CCI Connection [ID 1235943.1]
    Metalink ID - 1235943.1

  • Creation of DB Adaptert for calling stored procedure in MS SQL server

    Hi,
    I need to create a DB adapter to call a stored procedure in MS SQL Server.
    I have gone thru the thread MS SQL Server database connection
    It mentions that we need to use a command line utility for generating the wsdl and xsd for calling stored procedures in MS SQL server. Please provide information where to find this utility and how to use it.
    Any links to tutorials are welcome.
    Thanks !!.
    Silas.

    Command line is required for stored procedures, if you are using the basic options you don't need to worry.
    (1) Download MS SQL Server 2005 JDBC Driver from Microsoft Site. http://msdn.microsoft.com/en-us/data/aa937724.aspx
    (2) The download is self extracting exe file. Extract this into Program Files on your machine. It should create folder as "Microsoft SQL Server 2005 JDBC Driver"
    (3) In above mentioned folder search for sqljdbc.jar copy this file into JDeveloper\JDBC\lib folder.
    (4) Open JDeveloper/jdev/bin/jdev.conf file add following entry.
    AddJavaLibPath C:/Program files/Microsoft SQL Server 2000 Driver for JDBC/lib
    While executing this step make sure that your JDeveloper is closed.
    (5) On command prompt go to J Developer folder and execute following command
    jdev -verbose
    This will open JDeveloper.
    (6) Now go to JDeveloper > Connections > Database Connections > New Database Connection
    (7) Select Third Party JDBC
    (8) Specify MS Sql Server User Name, password and Role.
    (9) In connection page specify following
    - Driver Class: com.microsoft.sqlserver.jdbc.SQLServerDriver
    - For class path browse to C:/Program files/Microsoft SQL Server 2000 Driver for JDBC/lib folder, select sqljdbc.jar add it as library.
    - Specify URL as following.
    jdbc:sqlserver://SERVERNAME:1433;databaseName=MSSQLDBNAME;
    (10) Go to Test page and test it.
    cheers
    James

  • Convert the insert statement of an MS SQL server into an oracle statement

    Hi ,
    The insert statement in the ms sql server is
    INSERT INTO #temp EXEC Procedurename @Id OUTPUT
    where table temp
    CREATE TABLE #temp(
              Id varchar(10),
              FNa varchar(40),
              LNa varchar(40),
              SId varchar(20),
              Aid varchar(20),
              Did varchar(20),
              CCNa varchar(255),
              CCId int,
              ISu char(1),
              IA char(1),
              Dir char(1),
              Ema varchar(60),
              St char(2),
              DId char(3)
    I converted the insert statement like this
    Procedurename(Id);
    LOOP
    FETCH cv_1 INTO v_temp;
    EXIT WHEN cv_1%NOTFOUND;
    INSERT INTO TEMP VALUES v_temp;
    END LOOP;
    CLOSE cv_1;
    But i am receiving PL/SQL: ORA-00947: not enough values
    Can anyone help on this?
    Thanks

    1) Are you sure that you even need a temp table? Fetching all the rows from a cursor 1-by-1 and then inserting them into a temp table (I'm assuming the Oracle table TEMP is declared as a global temporary table) would seem rather unusual and most likely pointless. In Oracle, readers don't block writers, so there is generally no need to use temp tables to hold intermediate results.
    2) If you do need to store a set of results into a table, it's going to be more efficient to do this in a single SQL statement rather than using a cursor. Something like
    INSERT INTO my_table ( <<list of columns>> )
      SELECT <<list of columns>>
        FROM <<other tables>>
       WHERE <<some conditions>>The SELECT part of the statement here is likely whatever SQL you use in declaring the cursor.
    Justin

  • How to call procedure in Java from SQL Server Database

    Hello Every Body
    i Have Question about
    How to call procedure in Java from SQL Server Database
    Thanks

    Hi,
    have you tried a Google search? I just gave it a 3 second try and already found: http://stackoverflow.com/questions/6113674/how-do-i-execute-a-ms-sql-server-stored-procedure-in-java-jsp-returning-table-d
    Frank

  • Common requirement_SSMA Runtime emulation components were not found on SQL Server, please check if Extension Pack is installed correctly

    Greetings,
    After the installation of the extension pack (local sql server and installed local) i get this warning:
    Common requirement SSMA Runtime emulation components were not found on SQL Server, please check if Extension Pack is installed correctly
    and
    Common requirement SSMA Synchronization components were not found on SQL Server, please check if Extension Pack is installed correctly.
    In the Program and Features Control panel the Feature "SSMA Extensionpack" (or similar) is installed and i see it in the startmenu.
    what's wrong here, any hints?

    Hi A. Bloise,
    Based on your description ,we need to verify that the type and version of SSMA Extension Pack. Assume that you install SSMA for Oracle Extension Pack, I recommend you check the following things.
    1. Make sure that the setup file of SSMA for Oracle Extension Pack is not corrupted. You can download it from
    Microsoft Download Center.
    2. Make sure that your computer meets the following requirements for the SSMA for Oracle Extension Pack.
        •SQL Server 2005 or higher.
        •Microsoft Windows Installer 3.1 or a later version.
        •Oracle Client 9.0 or a later version, and connectivity to the Oracle databases that you want to migrate.
        •The SQL Server Browser service must be running during installation.
    3. Make sure that  the account used to install the extension pack, is a member of the sysadmin server role on the instance of SQL Server.
    If this does not work, please contact with SSMA support team for further help:
    [email protected]
    Thanks,
    Lydia Zhang

  • SQL experts please help for a query

    I have following table1.
    What query can give the result as given below, SQL experts please help on this.
    TABLE1
    Event DATETIME
    in 2/JAN/2010
    out 2/JAN/2010
    in 13/JAN/2010
    out 13/JAN/2010
    in 5/JAN/2010
    out 5/JAN/2010
    RESULT REQUIRED FROM THE SQL QUERY
    COL1_IN COL2_OUT
    2/JAN/2010 2/JAN/2010
    13/JAN/2010 13/JAN/2010
    5/JAN/2010 5/JAN/2010

    I tried to help, but this puzzles me.
    Why is this not returning pre-selected set of rows, why it's doing some merge join cartezian ?
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
    PL/SQL Release 10.2.0.4.0 - Production
    CORE    10.2.0.4.0      Production
    TNS for Linux: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    SQL> select * from table1;
    EVENT      DATETIME
    in         2/JAN/2010
    out        2/JAN/2010
    in         13/JAN/2010
    out        13/JAN/2010
    in         5/JAN/2010
    out        5/JAN/2010
    6 rows selected.
    SQL> explain plan for
      2  with a as
    (select datetime from table1 where event='in'),
    b as
    (select datetime from table1 where event='out')
    select  a.datetime COL1_IN ,b.datetime COL2_OUT from a,b ;
    Explained.
    SQL> set wrap off
    SQL> set linesize 200
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 185132177
    | Id  | Operation            | Name   | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT     |        |     9 |   288 |     8   (0)| 00:00:01 |
    |   1 |  MERGE JOIN CARTESIAN|        |     9 |   288 |     8   (0)| 00:00:01 |
    |*  2 |   TABLE ACCESS FULL  | TABLE1 |     3 |    48 |     3   (0)| 00:00:01 |
    |   3 |   BUFFER SORT        |        |     3 |    48 |     5   (0)| 00:00:01 |
    |*  4 |    TABLE ACCESS FULL | TABLE1 |     3 |    48 |     2   (0)| 00:00:01 |
    PLAN_TABLE_OUTPUT
    Predicate Information (identified by operation id):
       2 - filter("EVENT"='in')
       4 - filter("EVENT"='out')
    Note
       - dynamic sampling used for this statement
    21 rows selected.
    SQL> with a as
    (select datetime from table1 where event='in'),
    b as
    (select datetime from table1 where event='out')
    select  a.datetime COL1_IN ,b.datetime COL2_OUT from a,b ;
    COL1_IN         COL2_OUT
    2/JAN/2010      2/JAN/2010
    2/JAN/2010      13/JAN/2010
    2/JAN/2010      5/JAN/2010
    13/JAN/2010     2/JAN/2010
    13/JAN/2010     13/JAN/2010
    13/JAN/2010     5/JAN/2010
    5/JAN/2010      2/JAN/2010
    5/JAN/2010      13/JAN/2010
    5/JAN/2010      5/JAN/2010
    9 rows selected.
    SQL>

  • I have a big problem :( why is it i cant update my ipod touch 2g into ios 4! im using the latest version of itunes and everytime i click "update" it stucks on the "contacting server" please help :( i want to update it now

    i have a big problem why is it i cant update my ipod touch 2g into ios 4! im using the latest version of itunes and everytime i click "update" it stucks on the "contacting server" please help i want to update it now

    Maybe here:
    iTunes for Windows: iTunes cannot contact the iPhone, iPad, or iPod software update server

  • I updated my pages app on my ipad and when I tried to open a document it says the file format is invalid. None of my documents are opening pleaser help!

    I updated my pages app on my ipad and when I tried to open a document it says the file format is invalid. None of my documents are opening pleaser help!!!!

    Try this. It worked for me.
    I discovered the same problem.  I had an older version of Pages on my iPad. After updating it to the latest version all my previous documents created in pages for the iPad were rendered unreadable and a message stated that they were an invalid format.  Why for the life of me would a program that was created by Apple and sense updated not be able to read previous versions...well that's a whole other sad story.  Any way I discovered how to fix it but it would require that you had backup your iPad on a computer and not emptied your trash. If this sounds good than here is how you fix it... And it worked for me.
    These steps will enable you to reinstall a previous version of the Pages app so you can be able to read and edit older documents.
    FIRST: if you did backup your iPad using your computer and did not empty your trash, GOTO the trash and look for PAGES 1.4 (or other number) ipa ( that's the file extension) ie PAGES 1.4 ipa.
    SECOND: move that file out of the trash and onto your desktop.  Once you do this, double click on it and a box will come up stating a newer version has been found and do you want to revert back to older version. ANSWER YES. It will than automatically place and overwrite the older version back into the file on iTunes that contains the rest of your backed up apps.
    THIRD: and this is where it is important that your backup would have to have been on your computer. I'm not sure if backup on the cloud will work.  iCloud backup at your own risk And here's why. Before you restore you will need to remove the latest version of Pages off your iPad by doing the usual : holding down the home button until the apps wiggle and remove by pressing on X on app.  Removing off your iPad will also delete all your documents but if you have a previous backup on your computer those documents will be stored safely on itunes and will return.
    FORTH: plug your iPad into your computer and allow it to sync so iTunes will recognize it. Once iTunes is up and you can see that it recognizes your iPad, GOTO "FILE/DEVICES/RESTORE FROM BACKUP."  ******* DO NOT CLICK ON BACKUP***** click on RESTORE FROM BACKUP. This will reinstall all previous settings and documents that were their when you backuped PLUS the older version of Pages that you placed back from the above steps. Let it run through all the setups ( this could take up to 20 minutes...depending on amount of data and photos and apps).
    FIFTH: Once everything is reinstalled a message will popup on your computer stating "to leave iPad plugged in until iTunes recognizes it again" ( it's basically rebooting itself).  Once done (leave iPad plugged in still) GOTO iPad and follow the steps. IMPORTANT:  iPad will ask you if you want to SET IT UP AS A NEW IPAD, BACK UP FROM THE CLOUD or BACK UP FROM ITUNES.....press SET UP AS NEW IPAD. Follow all of the steps required. Once complete GOTO iTunes on computer, look for "IPAD" plus a little arrow ( should be on upper right corner of iTunes window, click on it ( this will safely disconnect your iPad from iTunes) . Now unplug iPad from computer and go to your iPad and look for the older version of Pages. It should be there along with all your old documents ( readable and editable too).
    Hope this helps. Good luck.

  • In Siri, I can call by my voice, but why I can not use Siri voice call in my country (Laos), just can call only us phone number; my country we use like 3 number for option call, 8 numbers for call friend but Siri cannot use this please help us, thanks

    In Siri, I can call by my voice, but why I can not use Siri voice call in my country (Laos), just can call only us phone number; my country we use like 3 number for option call, 8 numbers for call friend but Siri cannot use this please help us, thanks
    And please help me can type Laos font in it like andrio phone.

    Hi Cozumel,
    Thanks for posting. I'm sorry you're having problems with your bills. I can take a look at this for you. Drop me an email with your account details and a link to this thread for reference. You'll find the address in my profile.
    Cheers
    David
    BTCare Community Mod
    If we have asked you to email us with your details, please make sure you are logged in to the forum, otherwise you will not be able to see our ‘Contact Us’ link within our profiles.
    We are sorry but we are unable to deal with service/account queries via the private message(PM) function so please don't PM your account info, we need to deal with this via our email account :-)

  • I have a few wedding projects(1-2 hours)I am trying to export at full hd quality,than burn in idvd.After rendering for 8hrs I receive error code that states "file is too big". Please help? compressing tips without losing quality?

    I have a few wedding projects(1-2 hours)I am trying to export at full hd quality,than burn in idvd. After rendering for 8hrs I receive error code that states "file is too big". Please help? compressing tips without losing quality? or any other exporting alternatives?

    Hey Z,
    Thank you for the tip on exporting by media browser (large) from imovie. But of course, if it's not one thing it's another. Now that I figured how to export a large file from imovie, I have an idvd issue. I followed the instructions for burning from idvd and changing the encoding to professional quality and the burn speed to x4, but I am receiving an error that states the following,
    Your project exceeds the maximum content duration. To burn your DVD, change the encoder setting in the Project Info window.
    Project:
    - total project duration: 79:04 minutes
    - total project capacity: 4.327 GB (max. available: 4.172 GB)
    Menus:
    - number of menus in project: 1 menus
    - total menu duration: 0:39 minutes
    - total menu capacity: 37.370 MB
    Movies:
    - total movies duration: 78:25 minutes
    - total movies capacity: 4.291 GB
    I have searched in the idvd forum for similar issues and I am stumped at this point. I have tried deleting the encoding assets and re launching idvd with the changed preferences, and still the same error. I know you mentioned something about free hard drive space available, and I have very little left. 4GB to be exact due to massive hours of non-edited footage. I am not sure if this is why, but I do not recall ever needing free space to burn memory onto a separate dvd. I would be more than happy if I am wrong, and it would be a quick fix. Otherwise, the technical nightmare continues. It's all a learning process and your expertise is greatly appreciated! Thanks in advance.

  • Wlserver.exe error occur while start the web logic server-please help

    hi
    Iam getting wlserver.exe error when I start the web logic server-please help. and I cant able to start the web logic server.
    Thannks in Advance,
    Cheers,
    bala...

    Could you please mail the errors and the WLS Version and service pack as well.
    - Ramkumar

  • I am unable to register my debit card after creating my apple ID. Whenever i click enter after filling all the debit card details, it shows that, "your payement method has been declined". Please help me people, why is it so.?

    I am unable to register my debit card after creating my apple ID. Whenever i click "continue" after filling all the debit card details, it shows that, "Your payement method has been declined". Please help me people, why is it so.? Also, i would ike to tell that my bank is, Union Bank Of India and it facilitates the auto conversion, rupee to dollar.. I think there is a different problem. Please help me guys.!!

    The card must be issued in the same country as the store you are trying to use. If you're trying to sign up for the US Apple Store, it must be a US card with a US billing address. If you're trying to sign up in India, it must be an Indian card with an Indian billing address.
    Apple will run a small charge, which will be credited back, to make sure the card is valid. If it is a debit card and you do not have enough in the account to cover the authorization, it will be declined.
    It is possible the currency conversion you mentioned may be causing a problem. Contact the issuing bank if you are sure you have enough in the account and you are signing up for the correct store.

  • I'm trying to set up my new iPhone 5s from a backup of my previous iPhone, when trying to enter my Facebook login info in settings I keep getting the following error message : error signing in could not communicate with server, please help !

    I'm trying to set up my new iPhone 5s from a backup of my previous iPhone, when trying to enter my Facebook login info in settings I keep getting the following error message : error signing in could not communicate with server, please help !

    Can you access other apps? Can you acess the internet? Can you access applications that use internet besides facebook?
    If answer is yes to all of these; contact Facebook.

Maybe you are looking for

  • I want to use Hebrew fonts in Illustrator CC 2014

    Hello - I have installed Illustrator CC 2014 in both the English and English/Hebrew versions and still can't seem to get my Hebrew fonts to work. No matter what I try, any verbiage I type is still showing as roman characters. Any tips or advice?

  • Error Logging

    I have created an error logging procedure for my application and i am using it in all my procedures. WHEN OTHERS THEN sp_log_error(...); RAISE; However, I want it to log the exception only in case the exception has been raised in the current proc and

  • Fusion Middleware - Installing Forms & Reports Developer in separate server

    Hi, I installed Forms & Reports Server (without developer tools) on one server. Now I want to install only Forms and Reports developer in another server. Can anybody tell me how to achieve this or from where I can get some reference document particul

  • Touch screen problems while recharging.

    I bought yesterday a 2nd hand iPhone 3G, today I noticed that when the phone is recharging the touch doesn't work good, its still usable but its kinda choppy and not accurate at all. When i plug the phone out, stop recharging, the touch goes back to

  • Error message when using DOMParser.parse(file)

    When I try to use the DOMParser.parse(file) to parse an invalid XML file against a XML schema, with the schema_validation feature set on, error message saying the XML file is invalid because it violates some constraints set in the schema. But I canno