UNABLE TO EXECUTE THE CMDSQL SCRIPT IN A STORE PROCEDURE.

I am trying to call a .sql file from sql cmd mode.
The requirement is to pass the .sql file as parameter value to the cmd script which I have able to achieve,here is the code which is working fine .
declare @x sysname
set @x = 'C:\Users\testuser\Desktop\testing.sql'
:OUT $(TEMP)\GetServerName1.sql
PRINT ':SETVAR FilePath'+ ' ' + @x
GO
:OUT stdout
:r $(TEMP)\GetServerName1.sql
GO
:r $(FilePath)
But when I try to wrap this code in store procedure it is giving the message fatal error but when I run it without wrapping it in store proc it is doing its job with no error . When I looked into the store proc I found the code as
ALTER proc [dbo].[testing]
as
declare @x sysname
set @x = 'C:\Users\testuser\Desktop\testing.sql'
PRINT ':SETVAR FilePath'+ ' ' + @x
It seems like the sqlcmd code disappears automatically. I have no clue why it is happening. 
Can anyone help in letting me knw how to wrap the above code in store proc.
Thanks Saurav 

It is important to keep in mind that you have two entities in play here. One client and one server. The lines that start with a colon never sent to SQL Server, nor are the lines which reads "go". They are intercepted client-side. For instance :r
instructs SSMS to read a local file and out: redirects the output. And "go" breaks up the code in batches.
Erland Sommarskog, SQL Server MVP, [email protected]

Similar Messages

  • Unable to execute the substitution variable in calc scripts in essbase 11.1

    Unable to execute the substitution variable in calc scripts in essbase 11.1.3
    FIX(&CURRVERSION,COLA)
    Unit=units*Listprice;
    dataexport "file" "," "E:\NEW.TXT";
    ENDFIX
    Error: 1200471 Error parsing formula for FIX STATEMENT (line 1): expression expected before [)]
    This is error it throws when executing the calculation script
    I wonder whether its a problem with substitution variable i want to know wat went wrong inside the fix statement
    I have created substitution variable use maxl
    Installed the essbase in custom manner and standlone mode nt register with the shared services ,
    Is this problem with the custom installation of essbase
    Regards
    shenna

    If you remove the substitution variable and replace it with the actual value (whatever that is), does the code work? That will tell you if the issue is around the substitution variable or not.
    John -- First you race Glenn, then you race me -- and you always win. :)
    Regards,
    Cameron Lackpour

  • An unknown error occurred while executing the PowerShell script:

    Hello all,
    Not the most descriptive title, granted. I'm hoping this may prompt the next version toprovide additional valuable content.
    Kindly requesting any help on this problem. I'm running VMM 2012 R2 version 3.2.7668
    When I try to look at properties of an existing Private Cloud, I get this error, only if I "look" at certain attributes. If I stay away from the specific attributes, everything is hunky dory. For reasons unknown, after I get this error, I have
    to exit and go back into VMM in order to get anything else to run.
    The text in the error dialogue box is not entirely applicable because I was connected to the VMM server and will connect again, when I exit/relaunch.
    An unknown error occurred while executing the PowerShell script:
    The connection to the VMM management server scvmm2.mmmmmm.com was lost.
    Ensure that scvmm2.mmmmmm.com is online and that you can access the server remotely from your computer. Then connect to scvmm2.mmmmmm.com and try the command again using the new connection. Or, you can ensure that the Virtual Machine Manager service is started
    on scvmm2.mmmmmm.com. Then connect to scvmm2.mmmmmm.com and try the command again using the new connection. If the command fails again because of a connection failure, restart the Virtual Manager service and then try the operation again.
    Try the operation again. If the issue persists, contact Microsoft Help and Support.
    ID: 27235
    This is what I get in Events
    Warning 4/9/2015 3:27:04 PM PowerShell (Microsoft-Windows-PowerShell) 4100 Executing Pipeline
    Log Name:      Microsoft-Windows-PowerShell/Operational
    Source:        Microsoft-Windows-PowerShell
    Date:          4/9/2015 3:27:04 PM
    Event ID:      4100
    Task Category: Executing Pipeline
    Level:         Warning
    Keywords:      None
    User:          mmmmmm\paufra
    Computer:      tools-francis.mmmmmm.com
    Description:
    Error Message = The connection to the VMM management server scvmm2.mmmmmm.com was lost. (Error ID: 1610)
    Ensure that scvmm2.mmmmmm.com is online and that you can access the server remotely from your computer. Then connect to scvmm2.mmmmmm.com and try the command again using the new connection. Or, you can ensure that the Virtual Machine Manager service is started
    on scvmm2.mmmmmm.com. Then connect to scvmm2.mmmmmm.com and try the command again using the new connection. If the command fails again because of a connection failure, restart the Virtual Manager service and then try the operation again.
    Fully Qualified Error ID = 1610,Microsoft.SystemCenter.VirtualMachineManager.Cmdlets.GetSCReplicationGroupCmdlet
    Recommended Action = Ensure that scvmm2.mmmmmm.com is online and that you can access the server remotely from your computer. Then connect to scvmm2.mmmmmm.com and try the command again using the new connection. Or, you can ensure that the Virtual Machine Manager
    service is started on scvmm2.mmmmmm.com. Then connect to scvmm2.mmmmmm.com and try the command again using the new connection. If the command fails again because of a connection failure, restart the Virtual Manager service and then try the operation again.
    Context:
            Severity = Warning
            Host Name = Default Host
            Host Version = 4.0
            Host ID = 94963cd4-5979-4786-9da2-c8814de8c7c3
            Host Application = C:\Program Files\Microsoft System Center 2012 R2\Virtual Machine Manager\Bin\VmmAdminUI.exe
            Engine Version = 4.0
            Runspace ID = 359d7a46-3752-4929-8c09-0de4152d10e4
            Pipeline ID = 16
            Command Name = Get-SCReplicationGroup
            Command Type = Cmdlet
            Script Name =
            Command Path =
            Sequence Number = 91
            User = mmmmmm\paufra
            Shell ID = Microsoft.PowerShell
    User Data:
    Event Xml:
    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
      <System>
        <Provider Name="Microsoft-Windows-PowerShell" Guid="{A0C1853B-5C40-4B15-8766-3CF1C58F985A}" />
        <EventID>4100</EventID>
        <Version>1</Version>
        <Level>3</Level>
        <Task>106</Task>
        <Opcode>19</Opcode>
        <Keywords>0x0</Keywords>
        <TimeCreated SystemTime="2015-04-09T22:27:04.993655700Z" />
        <EventRecordID>285</EventRecordID>
        <Correlation ActivityID="{48059811-1A63-41E1-9057-7498D0E4FC20}" />
        <Execution ProcessID="2344" ThreadID="4076" />
        <Channel>Microsoft-Windows-PowerShell/Operational</Channel>
        <Computer>tools-francis.mmmmmm.com</Computer>
        <Security UserID="S-1-5-21-4008432563-1984933819-4238309236-2721" />
      </System>
      <EventData>
        <Data Name="ContextInfo">        Severity = Warning
            Host Name = Default Host
            Host Version = 4.0
            Host ID = 94963cd4-5979-4786-9da2-c8814de8c7c3
            Host Application = C:\Program Files\Microsoft System Center 2012 R2\Virtual Machine Manager\Bin\VmmAdminUI.exe
            Engine Version = 4.0
            Runspace ID = 359d7a46-3752-4929-8c09-0de4152d10e4
            Pipeline ID = 16
            Command Name = Get-SCReplicationGroup
            Command Type = Cmdlet
            Script Name =
            Command Path =
            Sequence Number = 91
            User = mmmmmm\paufra
            Shell ID = Microsoft.PowerShell
    </Data>
        <Data Name="UserData">
        </Data>
        <Data Name="Payload">Error Message = The connection to the VMM management server scvmm2.mmmmmm.com was lost. (Error ID: 1610)
    Ensure that scvmm2.mmmmmm.com is online and that you can access the server remotely from your computer. Then connect to scvmm2.mmmmmm.com and try the command again using the new connection. Or, you can ensure that the Virtual Machine Manager service is started
    on scvmm2.mmmmmm.com. Then connect to scvmm2.mmmmmm.com and try the command again using the new connection. If the command fails again because of a connection failure, restart the Virtual Manager service and then try the operation again.
    Fully Qualified Error ID = 1610,Microsoft.SystemCenter.VirtualMachineManager.Cmdlets.GetSCReplicationGroupCmdlet
    Recommended Action = Ensure that scvmm2.mmmmmm.com is online and that you can access the server remotely from your computer. Then connect to scvmm2.mmmmmm.com and try the command again using the new connection. Or, you can ensure that the Virtual Machine Manager
    service is started on scvmm2.mmmmmm.com. Then connect to scvmm2.mmmmmm.com and try the command again using the new connection. If the command fails again because of a connection failure, restart the Virtual Manager service and then try the operation again.
    </Data>
      </EventData>
    </Event>

    Hi Sir,
    First , please try to run the VMM configuration analyzer on that computer :
    http://www.microsoft.com/en-us/download/details.aspx?id=41555
    In addition , please try to use "VMMTrace" mentioned in following article to collect trace log and find some useful information :
    http://blogs.technet.com/b/jonjor/archive/2011/01/07/vmmtrace-simplified-scvmm-tracing.aspx
    Best Regards,
    Elton Ji
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected] .

  • Unable to execute the sdt request java_ee operation

    Hi Experts,
    We are performing EHP1 SPS 3 upgrade from SP 14 stack in one of our dual stack system. During Configuration phase, ABAP Configuration is successfully completed but when it is going to Java part it is showing below error:
    unable to execute the SDT request Java_EE operation configure on hostname avggstoh instance 02.
    Initialization os sync events failed See following messages:
    Preparing execution of modules INIT, EXTRACT, CONFIG, SHADOW_SECSTORE failed. See previous messages.
    Java upgrade tool is running, but not started by this request handler. Please stop tool and try again.
    We reset the installation so many times and tried again, but it always shows same error at same phase.
    Even we have restarted the whole host in case some port was used. But it also did not help. For me it seems to problem on this host as one other portal system on same host has this error during EHP upgrade.
    While same upgrade was finished successfully on other systems on different host.
    If anybody has some hint related to this problem, then please let me know. Your help will be highly appreciated.
    Thanks
    Sunny Pahuja

    hi,
    ya we resolved it successfully. in our case a lot of systems are installed on same host. And we found that our one of system was using the port 6240 which generally used by SAPehpi to connect to JSPM.
    We shutted down the system and tried to restart the upgrade and it finished successfully. And even we did not faced this problem again in any of systems installed on this host.
    So, please check all ports are free which are used by SAPehpi.
    Thanks
    Sunny

  • Unable to execute the SDT request Java_EE operation configure on hostname

    Hi Experts,
    We are performing EHP1 upgrade in one of our dual stack system. During Configuration phase, ABAP Configuration is successfully completed but when it is going to Java part it is showing below error:
    unable to execute the SDT request Java_EE operation configure on hostname avggstoh instance 02.
    Initialization os sync events failed See following messages:
    Preparing execution of modules INIT, EXTRACT, CONFIG, SHADOW_SECSTORE failed. See previous messages.
    Java upgrade tool is running, but not started by this request handler. Please stop tool and try again.
    We reset the installation so many times and tried again, but it always shows same error at same phase.
    Kindly help on this issue.
    Thanks
    HAri

    Hi harish,
    How did u manage to reset when u stop the installation in unix..
    i just encountered this error when i have stopped all the upgrade process & did not reeset properly.
    Please provide me steps ,,how did u manage to reset so that i can cross check & advice u on that
    regards,
    rahul.

  • AutoConfig could not successfully execute the following scripts afcpnode.cm

    When i run the autoconfig, it end up with following error message:
    [AutoConfig Error Report]
    The following report lists errors AutoConfig encountered during each
    phase of its execution. Errors are grouped by directory and phase.
    The report format is:
    <filename> <phase> <return code where appropriate>
    [SETUP PHASE]
    AutoConfig could not successfully execute the following scripts:
    Directory: d:\oracle\prodcomn\admin\install\PROD_oraprod
    afcpnode.cmd INSTE8_SETUP 1
    [PROFILE PHASE]
    AutoConfig could not successfully execute the following scripts:
    Directory: d:\oracle\prodcomn\admin\install\PROD_oraprod
    afcpgsm.cmd INSTE8_PRF 1
    AutoConfig is exiting with status 2
    this error is comming after running the FNDCPASS utility to change apps and other schema password. i also changed the password for sys and system and remote_login_passwordfile parameter is set to exclusive. This error is comming on application node. On Database node there is no error.
    Thanls and Regards

    Is this problem is linked with apps user's password length because it is 17 char long and may be apps password variable is not that much longI could not find any reported bugs/notes about the password length, only a bug (5859062) about the domain name length.
    Note: 418403.1 - AUTOCONFIG FAILURE AFCPNODES.SQL DOMAIN NAME LONGER THAN 30 CHARACTERS
    https://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=418403.1

  • AutoConfig could not successfully execute the following scripts bisdblrp.cm

    When i run the autoconfig, it end up with following error message:
    AutoConfig could not successfully execute the following scripts:
    Directory: E:\oracle\fincomn\admin\install\FIN_ora-fin
    bisdblrp.cmd INSTE8_APPLY -1
    this error is comming after running the FNDCPASS utility to change apps and other schema password. i also changed the password for sys and system and remote_login_passwordfile parameter is set to exclusive.
    AutoConfig is exiting with status 1
    regards

    There are many reported Metalink notes about bisdblrp.sh (bisdblrp.cmd), here are some links:
    Note: 397773.1 - bisdblrp.sh failed with ORA-01031: insufficient privileges while running Autoconfig
    https://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=397773.1
    Note: 431079.1 - Bisdblrp.sh Fails With ORA-06502 Error
    https://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=431079.1
    Note: 417073.1 - Bisdblrp.Sh Fails During Clone Autoconfig
    https://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=417073.1
    Note: 360679.1 - Adautocfg errors on bisdblrp.sh - buffer too small ora-06502
    https://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=360679.1
    So, checking AutoConfig log file should be helpful in revealing more details about the error.

  • AutoConfig could not successfully execute the following scripts adsvalsn.cm

    When i run the autoconfig, it end up with following error message:
    AutoConfig could not successfully execute the following scripts:
    Directory: E:\oracle\fincomn\admin\install\FIN_ora-fin
    adsvalsn.cmd INSTE8_APPLY -1
    AutoConfig is exiting with status 1
    And because of this error autoconfig takes more than an hour to complete. please help me
    regards

    - Do not run AutoConfig command from any terminal clients
    - Make sure the apps listener is down when you run AutoConfig
    In addition, you may review the following notes:
    Note: 218089.1 - Autoconfig FAQ
    https://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=218089.1
    Note: 393788.1 - Autoconfig Gives Installation Failed And Then Hangs
    https://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=393788.1
    Note: 260365.1 - Adconfig.cmd Hangs When Starting Apps Listener
    https://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=260365.1

  • Unable to execute the following sql statement in Jdev10g -- custom sql quer

    Hi All,
    I have requirement where I need to execute the below Query String through Jdev10g to Sql Server 2005.
    Query string -- select * from table where #InputString
    << Input String -- col3 like 'col%' and col1 like 'col2%' ...... >>
    Here the Input string will be generated by the client and the results will be transferred back to the client. Can any one help how to do this? Input string would like
    col1 like 'col%' and col2 like 'col2%' and so on.. and this is dynamic which can be changed in runtime like col3 like 'col3%' and col1 like 'col1%' and so on..
    I have tokenized the string and assinged the values and executed the custom string through Input parameters for all the fileds instead of only search string .. since table having so many null fields not receiving the exact row counts and records.. hence I have to pass only the Input string as I mentioned like Query String.. If some body got the same concern please let me know..
    Your help would be greatly appreciated..
    Thanks & Regards,
    Khasim

    Hi All,
    Even though the answer is a bit tedious by formulating the where clause with all fields and dynamic parameters, I achieved the goal. But we do have another option to use orcl:query-database in the transformation. But this one give tedious results when you are trying to achieve multiple rows from this. If some one have a better idea to utilize this query-database function, you are most welcome.
    Thanks & Regards,
    Khasim

  • Unable to execute the query after transpoting to Quality in BI7.0

    Hi Friends,
    We are facing problem while executing the query in BI 7.0 after transporting to Quality system.
    Whenever we are clicking on the query in Analyser after transporting to quality, it is throwing an error like "Program error in class SAPMSSY1 method : UNCAUGHT_EXCEPTION" and " system error in program SAPLRRI2 and form DIM_FAC_SRDATE-02" and it is disconnecting from BI system.
    The transport went successfully to quality system.
    Please do the needful regarding the above errors.
    Thanks
    Rama

    Hello,
    I resolved the problem. I removed all the variables in the query did another "Query Check" and the error message was clearer.
    There were missing infobjects in the Multi-Provider.  When I fixed this the error was gone.
    Thanks.

  • Unable to execute the Report

    Hi All,
    There is issue, pls help me , when i am executing VL06 in foreground it is working properly and when i am executing in background for the same data system is showing no list (No Output)
    What may be the possible reason? pls help me in wayforward
    Regards

    Hi,
    i dont know whether you understood my query perfectly or not?
    i am trying to execute a query...
    if i execute in English, it says "No texts were maintained in language E for variable"
    but if i execute  the query in client's Language, its executing perfectly..
    i dont see naything in SE63, pls be more clear
    so please advice on this
    regds

  • Internet service Request .. Unable to execute the Internet service

    Hi gurus,
    System MYSAP ERP 2005 ECC 6.0
    I am trying to create a new ISR for my scenario. I am following the ISR cook for the same. I cretae an Internet service mentioned. But when I try to execute the internet service that I created, it says that my internet service does not exist in my
    URL http://xxxx.corp.yyyy.com:8000/sap/bc/gui/sap/its/ZOVT/! call was terminated because the corresponding service is not available.
    I went to SICF and navigated the path and saw that my Internet service weas not avialable there. In the previous versions when i worked on external ITS there was not other setting requried when I created a new Internet service . I just had to publish it and it was able to be executed. Is it different in ECC.60? do i need to create an entry in SICF? There was no entry avialable for my Service ZOVT in SICF even after I published it.
    Please advise.
    regards
    Sam
    Message was edited by:
    sameer chilama

    Hi Sammer,
    yes you need to create service in SICF..After that you also need to connect the service to respective application which you can do it through service options on double clicking the newly created service and provide the GUI link at settings tabe..
    The same should be called up in SE80 with the respective settings...now publish it internal as webgui/its. (ECC 6 internal ITS)..
    Thanks

  • Error while executing the perl script txkChkFormsDeployment.pl

    I run adstrtal.sh after update EBS from 12.1.1 to 12.1.3, when execute adformsctl.sh , it prompt the following error
    We have determined that you need to redeploy Forms (using txkChkFormsDeployment.pl).
    But could not do it automatically for you, due to some issues.
    For details refer the log files.
    Follow Note: 397174.1 to redeploy Forms manually.
    I try to run perl %FND_TOP%\bin\txkrun.pl -script=CfgOC4JApp, which tell me the blow info
    *** OPERATION is reload ***
    Execute SYSTEM command : /d01/oracle/PROD/apps/tech_st/10.1.3/opmn/bin/opmnctl reload
    /d01/oracle/PROD/apps/tech_st/10.1.3/opmn/bin/opmnctl: line 1150: /nfs/bld/d26/PRDXBLD9/apps/tech_st/10.1.3/opmn/bin/opmn: No such file or directory
    opmnctl: opmn is not running.
    =================================================
    **************** IMPORTANT NOTE *****************
    =================================================
    Script failed to deploy formsapp.ear.
    Follow Note: 397174.1 for deployment of formsapp.ear manually.
    ERROR DESCRIPTION:
    (*******FATAL ERROR*******
    PROGRAM : /d01/oracle/PROD/apps/apps_st/appl/fnd/12.0.0/patch/115/bin/txkChkFormsDeployment.pl(/d01/oracle/PROD/apps/apps_st/appl/fnd/12.0.0/bin/txkrun.pl)
    TIME : Mon Jul 25 15:55:38 2011
    FUNCTION: TXK::RunScript::unDeployOC4JInstance [ Level 1 ]
    ERRORMSG: Application undeployment failed.
    what can I do?
    thanks

    ================================
    Inside unDeployOC4JInstance()...
    ================================
    Undeplolying Application : "forms" from OC4J instance: "forms"
    Execute SYSTEM command : /d01/oracle/PROD/apps/tech_st/10.1.3/jdk/bin/java -jar /d01/oracle/PROD/apps/tech_st/10.1.3/j2ee/home/admin_client.jar deployer:oc4j:opmn://ebs.upway.cn:6500/forms oc4jadmin ******* -undeploy forms
    Failed at "Could not get DeploymentManager".
    This is typically the result of an invalid deployer URI format being supplied, the target server not being in a started state or incorrect authentication details being supplied.
    More information is available by enabling logging -- please see the Oracle Containers for J2EE Configuration and Administration Guide for details.
    Application undeployment failed.
    Stopping FORMS oc4j...

  • Unable to execute the cmp using the weblogic

    I was trying to execute cmp using weblogic server7.0.
    It a simple program,
    The remote interface-
    import javax.ejb.*;
    import java.rmi.RemoteException;
    public interface SportTeam extends EJBObject{
    public void setOwnerName(String ownerName) throws RemoteException;
    public String getOwnerName() throws RemoteException;
    public void setFranchiseName(String franchiseName) throws RemoteException;
    public String getFranchiseName() throws RemoteException;
    }The home interface
    import javax.ejb.*;
    import java.rmi.RemoteException;
    import java.util.Collection;
    public interface SportTeamHome extends EJBHome{
    SportTeam create(String sport,String nickName)throws RemoteException,CreateException;
    SportTeam create(String sport,String nickName,String ownerName,String franchisePlayer)throws RemoteException,CreateException;
    SportTeam findByPrimaryKey(SportTeamPK sportTeam) throws RemoteException,FinderException;
    Collection findByOwnerName(String ownerName) throws RemoteException,FinderException;
    }The bean
    import javax.ejb.*;
    import javax.naming.*;
    import java.rmi.RemoteException;
    import java.sql.*;
    import java.util.*;
    public abstract class SportTeamEJB implements EntityBean{
    public SportTeamPK ejbCreate(String sport,String nickName) throws CreateException {
    setSport(sport);
    setNickName(nickName);
    setOwnerName(null);
    setFranchiseName(null);
    return null;
    public void ejbPostCreate(String sport,String nickName){}
    public SportTeamPK ejbCreate(String sport,String nickName,String ownerName,String franchiseName) throws CreateException {
    setSport(sport);
    setNickName(nickName);
    setOwnerName(ownerName);
    setFranchiseName(franchiseName);
    return null;
    public void ejbPostCreate(String sport,String nickName,String ownerName,String franchiseName){}
    public void ejbLoad(){}
    public void ejbStore(){}
    public void ejbRemove(){}
    public void ejbActivate(){}
    public void ejbPassivate(){}
    public void setEntityContext(EntityContext ctx){}
    public void unsetEntityContext(){}
    abstract public String getSport();
    abstract public void setSport(String sport);
    abstract public String getNickName();
    abstract public void setNickName(String nickName);
    abstract public String getOwnerName();
    abstract public void setOwnerName(String ownerName);
    abstract public String getFranchiseName();
    abstract public void setFranchiseName(String franchiseName);
    }the client side program
    import java.rmi.RemoteException;
    import javax.ejb.*;
    import javax.naming.*;
    import javax.rmi.PortableRemoteObject;
    import java.util.Properties;
    import java.util.Collection;
    import java.util.Iterator;
    public class TestClient{
    public static void main(String[] args){
    try{
         Properties prop=new Properties();
         prop.setProperty(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
         prop.setProperty(Context.PROVIDER_URL,"t3://localhost:7001");
         InitialContext initial=new InitialContext(prop);
         Object objref=initial.lookup("CMPSportBean");
         SportTeamHome home=(SportTeamHome)PortableRemoteObject.narrow(objref,SportTeamHome.class);
         System.out.println("Creating a row.");
         home.create("basketball","Kings","Joe Maloof","Jason Williams");
         System.out.println("Looking up by primary key...");
         SportTeam team=home.findByPrimaryKey(new SportTeamPK("basketball","Kings"));
         System.out.println("Current franchise player:");
         System.out.println(team.getFranchiseName());
         System.out.println("Looking by by owner...");
         Collection col=home.findByOwnerName("Joe Maloof");
         if(     0 == col.size()     ){
              System.out.println("Found no such owner");
         }else {
              Iterator iter=col.iterator();
              while(iter.hasNext()){
              Object objref2=iter.next();
              SportTeam teamRef2=(SportTeam) PortableRemoteObject.narrow(objref2,SportTeam.class);
              System.out.println("Owner name:"+ teamRef2.getOwnerName());
    team.remove();
    }catch(RemoveException re){
         re.printStackTrace();
    }catch(NamingException ne){
         ne.printStackTrace();
    }catch(CreateException ce){
         ce.printStackTrace();
    }catch(FinderException fe){
         fe.printStackTrace();
    }catch(RemoteException re){
                  re.printStackTrace();
    }The primary key class
    //package sportBean.cmp;
    import java.io.Serializable;
    public class SportTeamPK implements Serializable{
    public String sport;
    public String nickName;
    public SportTeamPK(){}
    public SportTeamPK(String sport,String nickName){
    this.sport =sport;
    this.nickName=nickName;
    public String getSport(){
    return sport;
    public String getNickName(){
    return nickName;
    public int hashCode(){
    return (sport+nickName).hashCode();
    public boolean equals(Object other){
         if( (other == null) ||! (other instanceof SportTeamPK) ){
            return false;
         SportTeamPK otherPK=(SportTeamPK)other;
         return sport.equals(otherPK.sport) && nickName.equals(otherPK.nickName);
    The program has complied successfully .
    The META-INF directory has been created automatically
    the ejb-jar.xml file
    <!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
    <!-- Generated XML! -->
    <ejb-jar>
      <enterprise-beans>
        <entity>
          <ejb-name>CMPSportBean</ejb-name>
          <home>SportTeamHome</home>
          <remote>SportTeam</remote>
          <ejb-class>SportTeamEJB</ejb-class>
          <persistence-type>Container</persistence-type>
          <prim-key-class>SportTeamPK</prim-key-class>
          <reentrant>False</reentrant>
          <abstract-schema-name>SportEJB</abstract-schema-name>
          <cmp-field>
            <field-name>sport</field-name>
          </cmp-field>
          <cmp-field>
            <field-name>nickName</field-name>
          </cmp-field>
          <cmp-field>
            <field-name>ownerName</field-name>
          </cmp-field>
          <cmp-field>
            <field-name>franchiseName</field-name>
          </cmp-field>
          <query>
            <query-method>
              <method-name>findByOwnerName</method-name>
              <method-params>
                <method-param>java.lang.String</method-param>
              </method-params>
            </query-method>
            <ejb-ql><![CDATA[SELECT OBJECT(o) FROM SportEJB AS o WHERE o.ownerName=?1]]></ejb-ql>
          </query>
        </entity>
      </enterprise-beans>
      <assembly-descriptor>
      </assembly-descriptor>
    </ejb-jar>the weblogic-ejb-jar.xml file
    <!DOCTYPE weblogic-ejb-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic 7.0.0 EJB//EN' 'http://www.bea.com/servers/wls700/dtd/weblogic-ejb-jar.dtd'>
    <!-- Generated XML! -->
    <weblogic-ejb-jar>
      <weblogic-enterprise-bean>
        <ejb-name>CMPSportBean</ejb-name>
        <entity-descriptor>
          <pool>
          </pool>
          <entity-cache>
            <max-beans-in-cache>1000</max-beans-in-cache>
            <idle-timeout-seconds>600</idle-timeout-seconds>
            <read-timeout-seconds>600</read-timeout-seconds>
            <cache-between-transactions>False</cache-between-transactions>
          </entity-cache>
          <persistence>
            <persistence-use>
              <type-identifier>WebLogic_CMP_RDBMS</type-identifier>
              <type-version>6.0</type-version>
              <type-storage>META-INF/weblogic-cmp-rdbms-jar.xml</type-storage>
            </persistence-use>
          </persistence>
          <entity-clustering>
          </entity-clustering>
        </entity-descriptor>
        <transaction-descriptor>
          <trans-timeout-seconds>2</trans-timeout-seconds>
        </transaction-descriptor>
        <jndi-name>CMPSportBean</jndi-name>
      </weblogic-enterprise-bean>
    </weblogic-ejb-jar>the weblogic-cmp-rdbms-jar.xml file
    <!DOCTYPE weblogic-rdbms-jar PUBLIC  '-//BEA Systems, Inc.//DTD WebLogic 7.0.0 EJB RDBMS Persistence//EN' 'http://www.bea.com/servers/wls700/dtd/weblogic-rdbms20-persistence-700.dtd'>
    <!-- Generated XML! -->
    <weblogic-rdbms-jar>
      <weblogic-rdbms-bean>
        <ejb-name>CMPSportBean</ejb-name>
        <data-source-name>myjdbcjndi</data-source-name>
        <table-map>
          <table-name>sportsteams</table-name>
          <field-map>
            <cmp-field>ownerName</cmp-field>
            <dbms-column>ownername</dbms-column>
          </field-map>
          <field-map>
            <cmp-field>franchiseName</cmp-field>
            <dbms-column>franchisename</dbms-column>
          </field-map>
          <field-map>
            <cmp-field>nickName</cmp-field>
            <dbms-column>nickname</dbms-column>
          </field-map>
          <field-map>
            <cmp-field>sport</cmp-field>
            <dbms-column>sport</dbms-column>
          </field-map>
        </table-map>
        <weblogic-query>
          <query-method>
            <method-name>findByOwnerName</method-name>
            <method-params>
              <method-param>java.lang.String</method-param>
            </method-params>
          </query-method>
        </weblogic-query>
        <check-exists-on-method>False</check-exists-on-method>
      </weblogic-rdbms-bean>
      <create-default-dbms-tables>True</create-default-dbms-tables>
    </weblogic-rdbms-jar>I tried to write config.xml file
    <JDBCDataSource
       Name=" "
       JNDIName="myjdbcjndi"
       PoolName="MyJDBC Connection Pool"
       Targets="myserver"
    />
    <JDBCConnectionPool
       Name="MyJDBC Connection Pool"
       Targets="myserver"
        URL="jdbc:odbc:test"
        DriverName="sun.jdbc.odbc.JdbcOdbcDriver"
        InitialCapacity="1"
        MaxCapacity="10"
    />When i tried to deploy, it showed me errors-
    weblogic.management.ApplicationException: activate failed forcmp
    Start server side stack trace:
    weblogic.management.ApplicationException: activate failed forcmp
    Module Name: cmp, Error: Exception activating module: EJBModule(cmp,status=PREPARED)
    Unable to deploy EJB: CMPSportBean from cmp:
    weblogic.ejb20.WLDeploymentException: The DataSource with the JNDI name: myjdbcjndi could not be located. Please ensure that the DataSource has been deployed successfully and that the JNDI name in your EJB Deployment descriptor is correct.
         at weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.setup(RDBMSPersistenceManager.java:138)
         at weblogic.ejb20.manager.BaseEntityManager.setupPM(BaseEntityManager.java:211)
         at weblogic.ejb20.manager.BaseEntityManager.setup(BaseEntityManager.java:181)
         at weblogic.ejb20.manager.DBManager.setup(DBManager.java:162)
         at weblogic.ejb20.deployer.ClientDrivenBeanInfoImpl.activate(ClientDrivenBeanInfoImpl.java:945)
         at weblogic.ejb20.deployer.EJBDeployer.activate(EJBDeployer.java:1296)
         at weblogic.ejb20.deployer.EJBModule.activate(EJBModule.java:349)
         at weblogic.j2ee.J2EEApplicationContainer.activateModule(J2EEApplicationContainer.java:1592)
         at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:1029)
         at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:1016)
         at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:1112)
         at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:732)
         at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:24)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
    TargetException:
    Unable to deploy EJB: CMPSportBean from cmp:
    weblogic.ejb20.WLDeploymentException: The DataSource with the JNDI name: myjdbcjndi could not be located. Please ensure that the DataSource has been deployed successfully and that the JNDI name in your EJB Deployment descriptor is correct.
         at weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.setup(RDBMSPersistenceManager.java:138)
         at weblogic.ejb20.manager.BaseEntityManager.setupPM(BaseEntityManager.java:211)
         at weblogic.ejb20.manager.BaseEntityManager.setup(BaseEntityManager.java:181)
         at weblogic.ejb20.manager.DBManager.setup(DBManager.java:162)
         at weblogic.ejb20.deployer.ClientDrivenBeanInfoImpl.activate(ClientDrivenBeanInfoImpl.java:945)
         at weblogic.ejb20.deployer.EJBDeployer.activate(EJBDeployer.java:1296)
         at weblogic.ejb20.deployer.EJBModule.activate(EJBModule.java:349)
         at weblogic.j2ee.J2EEApplicationContainer.activateModule(J2EEApplicationContainer.java:1592)
         at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:1029)
         at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:1016)
         at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:1112)
         at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:732)
         at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:24)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
         at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:1035)
         at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:1016)
         at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:1112)
         at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:732)
         at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:24)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
    End server side stack trace
    Module Name: cmp, Error: Exception activating module: EJBModule(cmp,status=PREPARED)
    Unable to deploy EJB: CMPSportBean from cmp:
    weblogic.ejb20.WLDeploymentException: The DataSource with the JNDI name: myjdbcjndi could not be located. Please ensure that the DataSource has been deployed successfully and that the JNDI name in your EJB Deployment descriptor is correct.
         at weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.setup(RDBMSPersistenceManager.java:138)
         at weblogic.ejb20.manager.BaseEntityManager.setupPM(BaseEntityManager.java:211)
         at weblogic.ejb20.manager.BaseEntityManager.setup(BaseEntityManager.java:181)
         at weblogic.ejb20.manager.DBManager.setup(DBManager.java:162)
         at weblogic.ejb20.deployer.ClientDrivenBeanInfoImpl.activate(ClientDrivenBeanInfoImpl.java:945)
         at weblogic.ejb20.deployer.EJBDeployer.activate(EJBDeployer.java:1296)
         at weblogic.ejb20.deployer.EJBModule.activate(EJBModule.java:349)
         at weblogic.j2ee.J2EEApplicationContainer.activateModule(J2EEApplicationContainer.java:1592)
         at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:1029)
         at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:1016)
         at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:1112)
         at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:732)
         at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:24)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
    TargetException:
    Unable to deploy EJB: CMPSportBean from cmp:
    weblogic.ejb20.WLDeploymentException: The DataSource with the JNDI name: myjdbcjndi could not be located. Please ensure that the DataSource has been deployed successfully and that the JNDI name in your EJB Deployment descriptor is correct.
    Start server side stack trace:
    weblogic.ejb20.WLDeploymentException: The DataSource with the JNDI name: myjdbcjndi could not be located. Please ensure that the DataSource has been deployed successfully and that the JNDI name in your EJB Deployment descriptor is correct.
         at weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.setup(RDBMSPersistenceManager.java:138)
         at weblogic.ejb20.manager.BaseEntityManager.setupPM(BaseEntityManager.java:211)
         at weblogic.ejb20.manager.BaseEntityManager.setup(BaseEntityManager.java:181)
         at weblogic.ejb20.manager.DBManager.setup(DBManager.java:162)
         at weblogic.ejb20.deployer.ClientDrivenBeanInfoImpl.activate(ClientDrivenBeanInfoImpl.java:945)
         at weblogic.ejb20.deployer.EJBDeployer.activate(EJBDeployer.java:1296)
         at weblogic.ejb20.deployer.EJBModule.activate(EJBModule.java:349)
         at weblogic.j2ee.J2EEApplicationContainer.activateModule(J2EEApplicationContainer.java:1592)
         at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:1029)
         at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:1016)
         at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:1112)
         at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:732)
         at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:24)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
    End server side stack trace
         <<no stack trace available>>
         <<no stack trace available>>
    I tried to put the file into the directory structure.
    I kept the class files into the WEB-INF/classess
    I could'nt understand whats wrong with it.
    Please help me it is urgent, if i could understand it i can proceed further

    Hi,
    I had the same error as you. I'm agree with arvind_India (previous). You must :
    1. Define a correct Connection Pool (warning: deploy it on your managed server).
    2. Test your connection Pool on your managed server.
    3. Create a DataSource from your connection Pool.
    4. Deploy your DataSource on your managed server.
    5. Verify the JNDI TREE of your managed server (Now, the JNDI name of your dataSource must appair).
    6. Deploy your Entity Bean (the error has disapeared).
    David (Paris-France).

  • Changes are not reflecting while executing the SAP script from report

    HI,
    In SAP-script we are nmaking changes in form in client 130
    it is showing the changes in 140 client but while excuting the report the same are not reflecting in the output.
    Thanks in Advance
    Naveen M

    Hello.
    Scripts are mandant depentant. So you must copy from 130 to 140 for changes take efect.
    Do it in transaction SE71 in mandant 140, first screen, in the menu options.
    And never forget to activate it in all mandants.
    Best regards.
    Valter Oliveira.

Maybe you are looking for

  • 10.4 client problem with OSX Server 10.5.8

    I have an late 2009 X_server with OSX 10.5.8 running, have binding to AD and enabled system as OD master. I have added an ad user to an od group and set a prefernce in the DOC to add the Group folder to the doc. On my MBP mostly all goes well except

  • How to increase the size of panel

    Hi All, I am trying to increase the size of the panel using setPrefferedSize, but it is no change in size of the panel. Is there any other factors which will effect the size of the panel. Any help is greatly appreciated. Thanks in advance, Roja.

  • EAX splash screen only - not able to start the main menu Zen Xtra 3

    I have purchased this six months ago. Warranty expired. When I turned the mp3 player, the EAX logo appears but does not do anything. I tried to setup using the clip. But no luck. Any suggestions... Thanks

  • Two operating systems in one computer - Running a program

    Hi. I have just installed two operating systems in my Thinkpad: windows 8 and windows 7. Is that possible to run a program, say Photoshop, MS Office, installed in windows 8 OS while I am running windows 7? I do not want to reinstall all the programs

  • Open File with Flex Builder

    Hi all, I want to view the workspace Source Code of Life cycle ES.