SQL Query not working in action performed event of combobox in swing

hi all..
i have to retreive from the database based on the item selected in the comboBox.......
when the program runs for the first time the data of defaultselected item is being displayed...
but when another item is selected the data is not retrieved from the database....
i am able to print the selected item but unable to query the database for the selected item
   private void resultsItemStateChanged(java.awt.event.ItemEvent evt) {                                        
// TODO add your handling code here:
        try{
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            conn = DriverManager.getConnection("jdbc:odbc:aa");
            System.out.println("you have selected me : --- >" + results.getSelectedItem().toString());
            sql="SELECT * FROM " + name + " WHERE term = ? ";
            srch2 = conn.prepareStatement(sql);
            srch2.setString(1,results.getSelectedItem().toString());
            rs2 = srch2.executeQuery();
            rs2.next();
            tarea2.setText("\n Definition:"+rs1.getString(3));
            tarea3.setText("\n Description:"+rs1.getString(4));
            tarea4.setText("\n Related Terms:"+rs1.getString(5));
            tarea5.setText("\n Hyperlinks : "+rs1.getString(6));
            tarea6.setText("\n References:"+rs1.getString(7));
            conn.close();
            rs2.close();
        } catch(Exception e){}
}    please help me to query the database for the selected item
Thanks in advance...

hi all..
i have to retreive from the database based on the item selected in the comboBox.......
when the program runs for the first time the data of defaultselected item is being displayed...
but when another item is selected the data is not retrieved from the database....
i am able to print the selected item but unable to query the database for the selected item
private void resultsItemStateChanged(java.awt.event.ItemEvent evt) {                                        
// TODO add your handling code here:
      ResultSet rs2=null;
       PreparedStatement srch2 = null;
        Connection conn1= null;
        Statement us = null;
        try{
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            conn1 = DriverManager.getConnection("jdbc:odbc:aa");
           System.out.println("you have selected me : --- >" + results.getSelectedItem().toString());
             sql="SELECT * FROM " + name + " WHERE term = ?";
            srch2 = conn.prepareStatement(sql);
            srch2.setString(1,results.getSelectedItem().toString());
            rs2 = srch2.executeQuery();
           rs2.next();
            tarea2.setText("\n"+rs1.getString(3));
            tarea3.setText("\n "+rs1.getString(4));
            tarea4.setText("\n"+rs1.getString(5));
            tarea6.setText("\n"+rs1.getString(6));
            tarea5.setText("\n"+rs1.getString(7));
          rs2.close();
          conn1.close();
        } catch(Exception e){
            System.out.println(e);
    After printing for the first time it is showing like this ...
java.sql.SQLException: ResultSet is closed
at sun.jdbc.odbc.JdbcOdbcResultSet.checkOpen(JdbcOdbcResultSet.java:6646)
at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java:257)
at more_info.resultsActionPerformed(more_info.java:301)
at more_info.access$100(more_info.java:25)
at more_info$2.actionPerformed(more_info.java:121)
at javax.swing.JComboBox.fireActionEvent(JComboBox.java:1242)
at javax.swing.JComboBox.setSelectedItem(JComboBox.java:569)
at javax.swing.JComboBox.setSelectedIndex(JComboBox.java:605)
at javax.swing.plaf.basic.BasicComboPopup$Handler.mouseReleased(BasicComboPopup.java:814)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:273)
at java.awt.Component.processMouseEvent(Component.java:6038)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
at javax.swing.plaf.basic.BasicComboPopup$1.processMouseEvent(BasicComboPopup.java:480)
at java.awt.Component.processEvent(Component.java:5803)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

Similar Messages

  • Inline transform for Sql Query not working in SAP MII 12.1 Version 12.1.8 B

    Hi All,
    I applied an xslt for an sql query which returns an xml file.
    I used inline transform icon in sql query to load an xsl file which has to return me a string
    Any idea why is not working for me..?
    My Sample XML file:
                                     <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="/XMII/CM/BatchDisposition/BatchQueueManagement/StyleSheets/ProductXsl.xsl"?>
    <Rowsets DateCreated="2011-05-05T07:27:45" EndDate="2011-05-05T07:27:45" StartDate="2011-05-05T06:27:45" Version="12.1.8 Build(20)">
         <Rowset>
              <Columns>
                   <Column Description="ProductName" MaxRange="1" MinRange="0" Name="ProductName" SQLDataType="12" SourceColumn="ProductName"/>
              </Columns>
              <Row>
                   <ProductName>Asprin 100mg Tablets 12 x10 strip</ProductName>
              </Row>
              <Row>
                   <ProductName>Asprin 300mg Tablets 12 x10 strip</ProductName>
              </Row>
              <Row><ProductName>Ibprooven 200mg Tablets 12 x 10 strip</ProductName></Row>
              <Row><ProductName>RipTide 50mg Tablets 40 x10 strip</ProductName></Row>
              <Row><ProductName>Seroquel 200mg Tablets 6 x10 strip</ProductName></Row>
              <Row><ProductName>Seroquel 400mg Tablets 12 x10 strip</ProductName></Row>
         </Rowset>
    </Rowsets>
    My Sample XSl File:
                                    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
         <xsl:text>["</xsl:text>
         <xsl:for-each select="Rowsets/Rowset/Row">
              <xsl:value-of select="ProductName"/>
              <xsl:if test="position() &lt; last()">
                   <xsl:text>","</xsl:text>
                    </xsl:if>
              <xsl:if test="position()=last()">
                           <xsl:text>"]</xsl:text>
                    </xsl:if>
         </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>
    Any Suggestions  are Welcome:
    Thanks

    Something like this should work...
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
         <xsl:template match="/">
              <Rowsets DateCreated="{Rowsets/@DateCreated}" Version="{Rowsets/@Version}" StartDate="{Rowsets/@StartDate}" EndDate="{Rowsets/@EndDate}">
                   <xsl:copy-of select="/Rowsets/FatalError"/>
                   <xsl:copy-of select="/Rowsets/Messages"/>
                   <Rowset>
                   <Columns>
                        <Column Description="Mycol1" MaxRange="1" MinRange="0" Name="Mycol1" SQLDataType="12" SourceColumn="Mycol1" />
                   </Columns>
                   <Row>
                   <Mycol1>
                   <xsl:text>["</xsl:text>
                        <xsl:for-each select="/Rowsets/Rowset/Row">
                             <xsl:value-of select="." />
                             <xsl:choose>
                                  <xsl:when test="position() &lt; last()"><xsl:text>","</xsl:text></xsl:when>
                                  <xsl:otherwise><xsl:text>"]</xsl:text></xsl:otherwise>
                             </xsl:choose>
                        </xsl:for-each>
                   </Mycol1>
                   </Row>
                   </Rowset>
              </Rowsets>
         </xsl:template>
    </xsl:stylesheet>

  • SQL Query Not working

    Hi All,
    Please help with the error ORA-00923: FROM keyword not found where expected.
    I am trying to execute the following SQL query.
    SELECT
    CASE
    WHEN (Grouping("PRICECATEGORY"."PriceCategoryName")=1) THEN "PriceCatTotal"
    ELSE "PRICECATEGORY"."PriceCategoryName"
    END AS "PRICECATEGORY"."PriceCategoryName",
    CASE
    WHEN (Grouping("LINEITEM"."LineDescription")=1) THEN "LineTotal"
    ELSE "LINEITEM"."LineDescription"
    END AS "LINEITEM"."LineDescription" ,
    *"INVOICE"."InvoiceDate",*
    Sum("TRANSACTION"."TotalPrice") as "TotalPrice",
    Sum("INVOICE_CHILD"."QUANTITY") as "Quantity"
    FROM "LINEITEM","INVOICE","TRANSACTION","PRICECATEGORY", "INVOICE_CHILD"
    WHERE "TRANSACTION"."InvoiceID"="INVOICE"."InvoiceNumber"
    and      "TRANSACTION"."PriceCategoryID"="PRICECATEGORY"."PriceCategoryID"
    and      "INVOICE_CHILD"."INVOICEID"="INVOICE"."InvoiceID"
    and      "PRICECATEGORY"."PriceCategoryID"="TRANSACTION"."PriceCategoryID"
    and      "TRANSACTION"."PriceCategoryID"="PRICECATEGORY"."PriceCategoryID"
    and      "PRICECATEGORY"."PriceCategoryID"="TRANSACTION"."PriceCategoryID"
    and      "LINEITEM"."LINEITEMID"="TRANSACTION"."LineItemID"
    and      "LINEITEM"."PRICECATEGORYID"="PRICECATEGORY"."PriceCategoryID"
    and     "INVOICE"."InvoiceDate" >= :STARTDATE and "INVOICE"."InvoiceDate" <= to_date(:ENDDATE,'DD-MON-YY')+1
    GROUP BY "PRICECATEGORY"."PriceCategoryName", "LINEITEM"."LineDescription" WITH ROLLUP
    I am using a from keyword at the right place and all the aliases are properly used.
    Please advice.
    Regards,
    Sandeep Reddy

    Jaydip and Jeff are correct:
    <li>Jaydip points out that <tt>"PRICECATEGORY"."PriceCategoryName"</tt> and <tt>"LINEITEM"."LineDescription"</tt> are not valid column alias names. They must be unqualified, nonquoted/quoted identifiers.
    <li>Jeff indicates that <tt>WITH ROLLUP</tt> is not Oracle SQL syntax, and provides a sample of the required ROLLUP/CUBE clauseOracle SQL <tt>ROLLUP/CUBE clause</tt>.
    Additionally, <tt>TRANSACTION</tt> is an Oracle keyword and therefore a poor choice as a database identifier: change the name of this table as soon as possible.
    You're having this problem because not all "SQL" is created equal. Your OdeToCode source appears to be a site dealing with Microsoft technologies (SQL Server in this case). Unless you are very familiar with Oracle and SQL Server and the inherent differences between them you'd be advised to stick to purely Oracle resources (I know I do). There are plenty of good Oracle resources out there.
    You'll also find it a lot easier to write, read and spot problems in SQL and PL/SQL code if you avoid using quoted identifiers (please tell us the database objects don't have case-sensitive names?) and use short table aliases rather than full table names. And we'll find it easier to help you on this forum if you post code samples wrapped in \...\wrapped in <tt>\...\</tt> tags.

  • SQL query not working well

    Hi,
    I made a small table with 5 rows and want to make them an sql consult using rownum
    so I'm running
    select * from mytable where rownum = 1;and it gives me the first row but if I change the 1 for a 2 or 3 or 4 or 5 it's says that theres nothing :S
    why?????????????????????
    but if i change for between 1 and 5 it gave me the 4 rows :S :S
    why???????????????????

    AlanWms wrote:
    try this:
    SELECT *
    FROM (
    SELECT bne.*, rownum myrow
    FROM BAN_EVENTOS_CONFIRMACION bne WHERE ROWNUM <=5)
    WHERE myrow = 2;
    Wrong!!! Rows in table are not stored in any specific order. Rows are fetched based on execution plan. So if execution plan changed query will retrieve same rows but they can be fetched in a different order. Bottom line only ORDER BY guarantees order. Without ORDER BY there is no sense to talk about first row, second row, last row or any row position.
    SY.

  • SQL Query not working for column names with spaces

    Hi People..
    We have a strange situation wherein, the column name in the database table has a space inbetween like "Constant Name". While we write a JDBC statement code with the select query we get an exception for invalid syntax. It will help us in a great way if you have anything to inform us on this..
    Thanks
    Prabz

    Using case sensitive names and names with spaces in it is not a good practice.
    However, I believe the SQL standard accounts for this with quoted identifiers. I believe the syntax is
    . select "My Field1", "My Field2"
    . from "My Table'
    Have also seen the following although it might be MS Access specific.
    . select [My Field1], [My Field2]
    . from [My Table]

  • Help SQL Query (Not working as it should)

    Hello everybody,
    I'm using JDeveloper 12.1.2.0.0 . I'm doing a bidirectional comunication using 3 tables, with bindings between them (and using HR schema).
    In my example, i have something like:
    Departments, Employees and SalaryByJobs (i created this table where it shows the departmentd id, employee id, job, salary).
    Whenever i click on one OR more departments, the employees table update by putting on the table, the employees that belong to the selected department and the salaryByjob put the jobs by employees selected on the employees table.
    So it's something like this:
    Departments selected -> employees selected -> salarybyjbobs of those employees.
    My Employees query (in the view) has the following code:
    SELECT Employees.COMMISSION_PCT,
           Employees.DEPARTMENT_ID,
           Employees.EMAIL,
           Employees.EMPLOYEE_ID,
           Employees.FIRST_NAME,
           Employees.HIRE_DATE,
           Employees.JOB_ID,
           Employees.LAST_NAME,
           Employees.MANAGER_ID,
           Employees.PHONE_NUMBER,
           Employees.SALARY
    FROM  EMPLOYEES Employees
    WHERE ( DEPARTMENT_ID IN (select * from THE(select cast( in_list(:variavel3) as mytableType ) from dual ) a))
    Since i use bindings, the employees table don't show anything in the beginning, so i added this parte to my employees query: OR nvl(:variavel3,0) = 0
    But now, whenever i try to select more than one row, it gives me invalid numbers and i don't understand why..
    It's only more one line of code and it's not in the bean.
    Can anyone help me?
    Ps - The bean goes department by department, appends the departments with "," and for each department, gets the employees that belongs to them.
    My best regards,
    Frederico Barracha.

    The expression NVL(:variavel3,0)=0 is not correct. The datatype of the return value of the NVL function is considered equal to the datatype of the 1st argument (i.e to the datatype of the bind variable :variavel3). You said that this variable contained a comma-separated list of IDs, so the variable's datatype is VARCHAR2. As far as you are comparing the NVL-expression to a number, you get "Invalid number" exception, because Oracle is expecting a numeric datatype at the left side of the comparison operator.
    In order to avoid the "Invalid number" exception you can modify the expression using one of the following options:
    :variavel3 IS NULL
    NVL( :variavel3, '*' ) = '*'
    NVL( :variavel3, '0' ) = '0'
    The 1st option if the simplest and the most clear one.
    Dimitar

  • Oracle date parameter query not working?

    http://stackoverflow.com/questions/14539489/oracle-date-parameter-query-not-working
    Trying to run the below query, but always fails even though the parameter values matches. I'm thinking there is a precision issue for :xRowVersion_prev parameter. I want too keep as much precision as possible.
    Delete
    from CONCURRENCYTESTITEMS
    where ITEMID = :xItemId
    and ROWVERSION = :xRowVersion_prev
    The Oracle Rowversion is a TimestampLTZ and so is the oracle parameter type.
    The same code & query works in Sql Server, but not Oracle.
    Public Function CreateConnection() As IDbConnection
    Dim sl As New SettingsLoader
    Dim cs As String = sl.ObtainConnectionString
    Dim cn As OracleConnection = New OracleConnection(cs)
    cn.Open()
    Return cn
    End Function
    Public Function CreateCommand(connection As IDbConnection) As IDbCommand
    Dim cmd As OracleCommand = DirectCast(connection.CreateCommand, OracleCommand)
    cmd.BindByName = True
    Return cmd
    End Function
    <TestMethod()>
    <TestCategory("Oracle")> _
    Public Sub Test_POC_Delete()
    Dim connection As IDbConnection = CreateConnection()
    Dim rowver As DateTime = DateTime.Now
    Dim id As Decimal
    Using cmd As IDbCommand = CreateCommand(connection)
    cmd.CommandText = "insert into CONCURRENCYTESTITEMS values(SEQ_CONCURRENCYTESTITEMS.nextval,'bla bla bla',:xRowVersion) returning ITEMID into :myOutputParameter"
    Dim p As OracleParameter = New OracleParameter
    p.Direction = ParameterDirection.ReturnValue
    p.DbType = DbType.Decimal
    p.ParameterName = "myOutputParameter"
    cmd.Parameters.Add(p)
    Dim v As OracleParameter = New OracleParameter
    v.Direction = ParameterDirection.Input
    v.OracleDbType = OracleDbType.TimeStampLTZ
    v.ParameterName = "xRowVersion"
    v.Value = rowver
    cmd.Parameters.Add(v)
    cmd.ExecuteNonQuery()
    id = CType(p.Value, Decimal)
    End Using
    Using cmd As IDbCommand = m_DBTypesFactory.CreateCommand(connection)
    cmd.CommandText = " Delete from CONCURRENCYTESTITEMS where ITEMID = :xItemId and ROWVERSION = :xRowVersion_prev"
    Dim p As OracleParameter = New OracleParameter
    p.Direction = ParameterDirection.Input
    p.DbType = DbType.Decimal
    p.ParameterName = "xItemId"
    p.Value = id
    cmd.Parameters.Add(p)
    Dim v As OracleParameter = New OracleParameter
    v.Direction = ParameterDirection.Input
    v.OracleDbType = OracleDbType.TimeStampLTZ
    v.ParameterName = "xRowVersion_prev"
    v.Value = rowver
    v.Precision = 6 '????
    cmd.Parameters.Add(v)
    Dim cnt As Integer = cmd.ExecuteNonQuery()
    If cnt = 0 Then Assert.Fail() 'should delete
    End Using
    connection.Close()
    End Sub
    Schema:
    -- ****** Object: Table SYSTEM.CONCURRENCYTESTITEMS Script Date: 1/26/2013 11:56:50 AM ******
    CREATE TABLE "CONCURRENCYTESTITEMS" (
    "ITEMID" NUMBER(19,0) NOT NULL,
    "NOTES" NCHAR(200) NOT NULL,
    "ROWVERSION" TIMESTAMP(6) WITH LOCAL TIME ZONE NOT NULL)
    STORAGE (
    NEXT 1048576 )
    Sequence:
    -- ****** Object: Sequence SYSTEM.SEQ_CONCURRENCYTESTITEMS Script Date: 1/26/2013 12:12:48 PM ******
    CREATE SEQUENCE "SEQ_CONCURRENCYTESTITEMS"
    START WITH 1
    CACHE 20
    MAXVALUE 9999999999999999999999999999

    still not comming...
    i have one table each entry is having only one fromdata and one todate only
    i am running below in sql it is showing two rows. ok.
      select t1.U_frmdate,t1.U_todate  ,ISNULL(t2.firstName,'')+ ',' +ISNULL(t2.middleName ,'')+','+ISNULL(t2.lastName,'') AS NAME, T2.empID  AS EMPID, T2.U_emp AS Empticket,t2.U_PFAcc,t0.U_pf 
       from  [@PR_PRCSAL1] t0 inner join [@PR_OPRCSAL] t1
       on t0.DocEntry = t1.DocEntry
       inner join ohem t2
       on t2.empID = t0.U_empid  where  t0.U_empid between  '830' and  '850'  and t1.U_frmdate ='20160801'  and  t1.u_todate='20160830'
    in commond promt
      select t1.U_frmdate,t1.U_todate  ,ISNULL(t2.firstName,'')+ ',' +ISNULL(t2.middleName ,'')+','+ISNULL(t2.lastName,'') AS NAME, T2.empID  AS EMPID, T2.U_emp AS Empticket,t2.U_PFAcc,t0.U_pf 
       from  [@PR_PRCSAL1] t0 inner join [@PR_OPRCSAL] t1
       on t0.DocEntry = t1.DocEntry
       inner join ohem t2
       on t2.empID = t0.U_empid  where  t0.U_empid between  {?FromEmid} and  {?ToEmid} and t1.U_frmdate ={?FDate} and  t1.u_todate={?TDate}
    still not showing any results..

  • What will you do if any SQL is not working.in oracle 10g...apps 11.5.10.2

    What will you do if any SQL is not working. in oracle 10g....apps 11.5.10.2

    928714 wrote:
    yes sir.If you help me in answering my questions i wll be very thankful to you sir.
    tnx,I haven't a clue.
    As you have been advised in many of your posts, go study the documentation for whichever specific topic you are interested in.
    For me to answer your questions, I would need to go get that documentation.
    Then I would need to read that documentation.
    Then I would need to write a forum post that interprets what I think I learned from that documentation.
    It is so very much faster if YOU go do that instead of posting to a forum and expecting others to do it. You will remember what you study for a lot longer time if you teach yourself.

  • SQL query not calculating

    SQL query not calculating
    gross_amount is giving the value of extended_amount and the gross_price_rc is giving the value of unit_selling_price
    select customer_trx_line_id,
    ( extended_amount / 1- (decode(decode(attribute6,null,0)+decode(attribute7,null,0)+decode(attribute8,null,0)+decode(attribute9,null,0)/100,null,0,1,0))) GROSS_AMOUNT,
    ( unit_selling_price /1-(decode(decode(attribute6,null,0)+decode(attribute7,null,0)+decode(attribute8,null,0)+decode(attribute9,null,0)/100,null,0,1,0))) gross_price_rc
    from ra_customer_trx_lines_all
    where attribute6 is not null or attribute7 is not null or attribute8 is not null or attribute9 is not null
    whats the isuue here??
    Thanks

    decode(attribute7,null,0)Looking at it again, this always returns 0 or NULL, so it not really surprising
    DECODE
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions040.htm#i1017437
    CASE
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/expressions004.htm#i1033392

  • Why this character \ it is not working in action scrip?

    Hi...
    Why this character \ it is not working in action scrip? And
    how can I solve it?
    on (release) {
    text.text = text.text + "l"
    Please your help ASAP
    thank you

    yea, that's true, but I don't think that is the problem.. I
    use it every once in a while, and it doesn't break the script.
    "I’m trying to make bush button if i press it, the
    action script it well write the text in text area and I’m
    using Flash MX 2004"
    This statement makes
    zero sense.. please clean it up and make it understandable,
    and tell what version of Actionscript you are publishing to.

  • Cancel Query not working

    Problem Summary
    Cancel Query not working on 11.5.10
    Problem Description
    While finding orders, window pops up the cancel query but when user tries to click the cancel button, query does not cancel.

    jemar98 wrote:
    Problem Summary
    Cancel Query not working on 11.5.10
    Problem Description
    While finding orders, window pops up the cancel query but when user tries to click the cancel button, query does not cancel.Please post the details of the application release, database version and OS.
    Was this working before? If yes, any changes been done recently?
    Please review (Canceling Long Running Queries in Oracle Applications 11i [ID 138159.1]) and make sure you complete all the steps.
    Thanks,
    Hussein

  • Force encryption on SQL Server not working?

    Hello Everyone,
    I'm running SQL Server 2008 64-bit. I've installed a self-signed cert on the box and set  "Force Encryption"  and restarted SQL server. 
    I setup a client machine to trust the authority of the cert installed on the server. When I connect to that SQL server from SSMS from a client machine and select the "encrypt connection" option in the client Connection properties, SSMS correctly complains
    that the cert on the server does not match the computer name I asked to log into . This is because, although the cert is trusted, the dns name dos not match the CN in the cert <- Perfect, exactly what I am expecting.
    When I connect to the same SQL server from the same client but  UNCHECK "encrypt connection" on the client, I'm able to login. Considering I've checked the "Force Encryption" on the server, the server should have rejected the connection. Why not?
    Ameer Deen

    Hi all,
    We are implementing a Merge Synchronization solution which involves three SQL Servers located on three Azure locations worldwide and one on-premises location. We need to secure communications between all servers. We are evaluating the encryption of all server
    communications through SSL:
    http://technet.microsoft.com/en-us/library/ms191192.aspx
    When we configure one server (let’s call it server A) to accept only encrypted connections (with Force Encryption=Yes) we still can connect from other server (let’s call it server B) that do not have the certificate installed. We would expect the server
    B to fail in the attempt of connect as server A should only accept encrypted communications and those should need the certificated to encrypt/decrypt everything (commands and data).
    We have also review the following forum post that is very similar to this one:
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/bde679d9-ff83-4fa7-b402-42e336a97106/force-encryption-on-sql-server-not-working
    In all cases the Microsoft answer is:
    “When the
    Force Encryption option for the Database Engine is set to YES, all communications between client and server is encrypted no matter whether the “Encrypt
    connection” option (such as from SSMS) is checked or not. You can check it using the following DMV statement”
    When we run the provided DMV statement to check if encryption is enabled:
    -- To check whether connections are encrypted between server and clients
    SELECT encrypt_option
    FROM sys.dm_exec_connections
    We get “TRUE”. So theoretically encryption is enabled.
    Then:
    Why can we run SQL statements against server A from server B (with SSMS) without any certificate?
    Are we wrong when we expect server A to refuse any client that do not have the right certificate?
    How can server B, without any certificate, decrypt the data encrypted by server A?
    Our intention is to encrypt all server in the same way so all of them will accept only encrypted communications. We are assuming that the Merge Agent will be able to communicate with the Publisher and the Subscriber through this encrypted environment. May
    anyone please confirm ti?
    Thanks for your help.
    Best Regards
    Benjamin Moles

  • Sql is not working after changing from MsAccess into sql server

    Following Sql  is not working after changing from MsAccess into sql server. 
    sum(trn.sales) as sales,
    sum(trn.cost) as cost,
    sales - cost as profit // Here is not working . can we not use sales a column. Please advise
    from trn
    Kind Regards
    pol
    polachan

    It will not work if use two different column from the table or column  from two  different table
    Example
    sum(trn.sales * trn.rate) as salesAmount,
    sum(trn.cost) as cost,
    sum(trn.salesAmount)-sum(trn.cost) as profit ----- Here is not working . can we not use sales a column. Please advise
    from trn
    Regards
    polachan

  • Oracle 8i - PL/SQL sub query not working in PROC, but works ins SQL

    I have read about certain things not working in 8i and I think this is one of them, but I was wondering if anyone had a work around. In the place of the SELECT SYSDATE FROM DUAL, I have a table look up, where I am going to look up the OCN of the corresponding VENDOR_ID ( a column in the original query ). I am doing it in a decode statement because if the first condition in the decode statement is met, that's it. But if not, it needs to look up the OCN number in this other table. Simple enough, conceptually. I thought of a view but that necessitates a SELECT statement, too. Anyway, here is the code with the appropriate text bolded:
    CREATE OR REPLACE PROCEDURE tstINS_RATE_ROUTE_RECORDS_PROC (GET_CUR_PERIOD IN DATE) IS
         CUR_PERIOD DATE;
         BEGIN
         CUR_PERIOD := GET_CUR_PERIOD;
         Insert into RATE_ROUTE (
           CVBI_KEY
         , VENDOR_ID
         , OCN
         , ST_CD
         , PERIOD
         , MDFY_DT )
         Select
           C.CVBI_KEY
         , C.VENDOR_ID
         <b>, decode( c.send_lca, 'YES', 'XXX', (SELECT SYSDATE FROM DUAL) )</b>
         , decode( c.send_lca, 'YES', 'XX', SUBSTR(C.ZLOC,5,2) )
         , CUR_PERIOD
         , TO_CHAR(SYSDATE)
         FROM
           rpt_ds1_cnt_cat c
         , cogs_resource cr
         , cogs_t1activity ct1
         , rpt_ds1_aloc_zloc_reverse_vw az
         where (C.CVBI_KEY = CR.CVBI_KEY (+)
         and  CR.PERIOD = CUR_PERIOD)
         AND  (C.CVBI_KEY = CT1.CVBI_KEY (+)
         and CT1.PERIOD = CUR_PERIOD)
         and (az.master_route_name=c.aloc||'-'||c.zloc OR az.reversed=c.aloc||'-'||c.zloc)
         END; -- INS_RATE_ROUTE_RECORDS_PROC

    have read about certain things not working in 8i and I think this is one of them,Yes as I said scalar sub-queries were also not recognized within PL/SQL in 8i.
    Re: PLS-00103: Encountered the symbol "SELECT" when expecting one of the fo
    I was wondering if anyone had a work around.Write a function that returns the value. You may incur a performance penalty from a context switch to PL/SQL, but it may be balanced by the decode optimization you are attempting.

  • My first PL/SQL block not working with using Select query within begin

    I am new to PL/SQL , just started with basics of BLOCKS .
    I am having a query here in executing a block .
    When i am doing a insert oprtation in Blocks Begin method everything is working fine , but when ever i tried to do select operation , some error is being thrown .
    First of all This is my Table :
    select from try :*
    KEY      VALUE
    Key     Value
    Key1     Value1
    Key2     Value2
    Key3     Value3
    ======================
    This is the code which is not working : Please see the code and tell me what is the problem .
    DECLARE
    v_KEY    VARCHAR2(20);
    v_VALUE   VARCHAR2(20);
    BEGIN
    select key into v_KEY FROM try where v_value='Value' ;
    dbms_output.put_line(v_KEY);
    END;
    When i run this code , it is saying Data Not Found on this line " select key into v_KEY FROM try where v_value='Value' ;"
    wheer when i run tis individually it worked fine :
    select KEY FROM try where VALUE='Value' ;"
    please share your ideas .as why it isn't running ??
    Edited by: user10503747 on Sep 20, 2010 3:16 AM

    Hi,
    user10503747 wrote:
    I am new to PL/SQL , just started with basics of BLOCKS .
    I am having a query here in executing a block .
    When i am doing a insert oprtation in Blocks Begin method everything is working fine , but when ever i tried to do select operation , some error is being thrown .
    First of all This is my Table :
    select from try :*
    KEY      VALUE
    Key     Value
    Key1     Value1
    Key2     Value2
    Key3     Value3
    ======================
    This is the code which is not working : Please see the code and tell me what is the problem .
    DECLARE
    v_KEY    VARCHAR2(20);
    v_VALUE   VARCHAR2(20);
    BEGIN
    select key into v_KEY FROM try where v_value='Value' ;
    dbms_output.put_line(v_KEY);
    END;
    When i run this code , it is saying Data Not Found on this line " select key into v_KEY FROM try where v_value='Value' ;"
    wheer when i run tis individually it worked fine :
    select KEY FROM try where VALUE='Value' ;"
    please share your ideas .as why it isn't running ??
    Edited by: user10503747 on Sep 20, 2010 3:16 AMInstead of:
    {code}
    select key into v_KEY FROM try where v_value='Value' ;
    {code}
    perhaps you meant something like:
    {code}
    v_value := 'Value1';
    select key into v_KEY FROM try where v_value=Value ; -- No quotes
    {code}
    Until you assign a vlue to a variable, like v_value, it is NULL, so your original statement was equivalent to
    {code}
    select KEY FROM try where NULL='Value' ;
    {code}
    In PL/SQL, a SELECT ... INTO statement must return exactly one row, or else you will get an error (either NO_DATA_FOUND or TOO_MANY_ROWS). This is different from SQL, where a query cn return any number of rows, including 0, without raising an error.

Maybe you are looking for

  • Error while installing BO XI3.1

    Hi, We are installing BOXI3.1 on LINUX 64 bit server. we had already installed oracle 10g for repository database on AIX 64 bit. We have also installed oracle selec client 64 biton Linux server. While installing BO we are stuck after selecting the op

  • Very poor quality when exporting slideshow

    I am using a Canon 5D, and when I view the images in Full screen. They are gorgeous. I created a slideshow. When I play the slideshow in Aperture - again they are gorgeous and crisp, however when I export these images to a Quicktime movie they look b

  • Font Arial CE is lost after changing to FM9.0

    After updating FramMaker form 7.0 to 9.0 I had to change a polish manual, but the message "Can't find the font Arial CE" (in principal) occurs. In all other programs I can find and use Arial CE. Can pls. somebody tell me how to solve this problem?

  • Monitoring using Hyperic

    In order to get all Virtual Machines monitored through Hyperic vAPP, do we need to install agent on all the VM's? How can we start the monitoring of ESXI hosts and Vcenter using Hyperic?

  • Unable to download the trial version of Illustrator CC

    I was able to download other tiral versions such as Photoshop CC, InCopy CC, InDesign CC, Acrpbat XI Pro, and Extension Manager CC. However, Illustrator CC seems to be the problem. It goes up to about 42~45% and just stops, saying that theres a probl