Connecting JDBC Single Row Query to SQL Server 2008

Hello,
I am new to workbench and am having a very dificult time accessing a database and running a query on it. I have searched a lot on the internet for suggestion on how to accomplish this but nothing has worked. The LiveCycle was intaled on the same server that the SQL Server is sintalled, and was installed by an administrator who is no longer at our company. So I am trying to have the user input an account number into the form I have created, then take that account number and use an xpath expression to query the database and extract the information for that account. Could anyone please help me set this up.
I Changed my my-db2-ds.xml to the following:
<local-tx-datasource>
  <jndi-name>SQLDB_IMACS</jndi-name>
  <connection-url>jdbc:sqlserver://CBS-SQL-001;databaseName=DB_IMACS;integratedSecurity=tru e;</connection-url>
  <driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
</local-tx-datasource>
and I get the following error message:
Exception: Could not create connection; - nested throwable: (org.jboss.resource.JBossResourceException: Failed to register driver for: com.microsoft.sqlserver.jdbc.SQLServerDriver; - nested throwable: (java.lang.ClassNotFoundException: No ClassLoaders found for: com.microsoft.sqlserver.jdbc.SQLServerDriver)); - nested throwable: (org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (org.jboss.resource.JBossResourceException: Failed to register driver for: com.microsoft.sqlserver.jdbc.SQLServerDriver; - nested throwable: (java.lang.ClassNotFoundException: No ClassLoaders found for: com.microsoft.sqlserver.jdbc.SQLServerDriver)))
I have the following file sqljdbc.jar in my Adobe LiveCycle ES2\jboss\server\lc_turnkey\lib\ folder.
If you could please let me know what I can do to connect that would be very useful.
Thanks,
sgarciacode19

You will need to use the UNPIVOT operator:
DECLARE @example TABLE
Id int NOT NULL IDENTITY(1,1),
Quantity1 int,
Quantity2 int,
Quantity3 int
INSERT INTO @example VALUES (1000, 2000, 3000), (4000, 5000, 6000);
SELECT * FROM @example;
SELECT Id, Quantity, QuantityType
FROM @example
UNPIVOT
Quantity FOR QuantityType IN (Quantity1, Quantity2, Quantity3)
) AS u;
Output:
(2 row(s) affected)
Id Quantity1 Quantity2 Quantity3
1 1000 2000 3000
2 4000 5000 6000
(2 row(s) affected)
Id Quantity QuantityType
1 1000 Quantity1
1 2000 Quantity2
1 3000 Quantity3
2 4000 Quantity1
2 5000 Quantity2
2 6000 Quantity3
(6 row(s) affected)

Similar Messages

  • How to merge three columns values to single row values in sql server 2008

    Hi Frds.....
    I have three quantity in my table.
    Quantity1,quantity2,quantity3
    this three quantity have different values
    ex:
    quantity1 = 1000,quantity2=2000,quantity3=3000
    the three column combine 2 display in single row values. this values display in one by one.
    ex: quantity
         1000
         2000
         3000

    You will need to use the UNPIVOT operator:
    DECLARE @example TABLE
    Id int NOT NULL IDENTITY(1,1),
    Quantity1 int,
    Quantity2 int,
    Quantity3 int
    INSERT INTO @example VALUES (1000, 2000, 3000), (4000, 5000, 6000);
    SELECT * FROM @example;
    SELECT Id, Quantity, QuantityType
    FROM @example
    UNPIVOT
    Quantity FOR QuantityType IN (Quantity1, Quantity2, Quantity3)
    ) AS u;
    Output:
    (2 row(s) affected)
    Id Quantity1 Quantity2 Quantity3
    1 1000 2000 3000
    2 4000 5000 6000
    (2 row(s) affected)
    Id Quantity QuantityType
    1 1000 Quantity1
    1 2000 Quantity2
    1 3000 Quantity3
    2 4000 Quantity1
    2 5000 Quantity2
    2 6000 Quantity3
    (6 row(s) affected)

  • Converting MDX query into SQL Server 2008

    We have MDX query based OLAP CUbes.
    To reduce MDX based dependenies, we have to convert MDX based cube to sql server 2008 based queries.
    For this I need expert advise to convert below query to sql server 2008 based query :
    CREATE MEMBER CURRENTCUBE.Measures.[Ack Lost]
                        AS 'Sum(PeriodsToDate([Time].[Year], [Time].CurrentMember ), [Measures].[Lost])',
                        FORMAT_STRING = "#,#",
                        VISIBLE = 1;

    Hi Sachin,
    According to your description, you need to convert the MDX query to T-SQL query, right?
    Your MDX query is calculated measure that return the total value from the first sibling and ending with the given member. In T-SQL query we can use the query as Yogisha provided to achieve the same requirement. Now you need to a tool to convert all the MDX
    related SSAS cube queries to MS SQL Server 2008 based queries.
    Although MDX has some similarities with T-SQL these languages are in many ways different. Beginning to learn and comprehend SQL Server Analysis Services (SSAS) MDX queries can be difficult after one has spent years writing queries in T-SQL. Currently, there
    is no such a tool to convert a MDX query to T-SQL query since the structure difference between MDX and T-SQL. So you need to convert them manually, please refer to the links below to see the details.
    http://www.mssqltips.com/sqlservertip/2916/comparison-of-queries-written-in-tsql-and-sql-server-mdx/
    https://sqlmate.wordpress.com/2013/11/12/t-sql-vs-mdx-2/
    http://technet.microsoft.com/en-us/library/aa216779(v=sql.80).aspx
    Regards,
    Charlie Liao
    TechNet Community Support

  • Require help with Pivot table query in SQL Server 2008

    Hi,
    I have a query regarding converting columns to rows in SQL Server 2008. Please look at the table below. 
    I need the output to look something like this :
    The columns for the children can be dynamic or fixed ( max of 6 children) based on the Family_ID.  For Example: A family can have 1 child or more than 1 child.
    Not sure how to go about it. Would appreciate your help :)

    Looks like you need dynamic pivot on multiple columns. I have two articles on this topic, start from this one
    T-SQL:
    Dynamic Pivot on Multiple Columns
    It has reference to my other blog post.
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • Error during database connection to the database : MS SQL Server 2008 R2

    Hi All,
    I am working with ABAP Proxy to Rec JDBC( Integrating XI with MS SQL Server 2008 R2). I am using SAP PI 7.0
    I am getting error in RWB at communication channel monitoring :
    Error during database connection to the database URL 'jdbc:microsoft:sqlserver://10.1.92.111:1433;database=XONTUSERVENTURA_ORG_TEST' using the JDBC driver 'com.microsoft.jdbc.sqlserver.SQLServerDriver': 'com.sap.aii.adapter.jdbc.sql.DriverManagerException: Cannot establish connection to URL 'jdbc:microsoft:sqlserver://10.1.92.111:1433;database=XONTUSERVENTURA_ORG_TEST': SAPClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver'
    I have given Connection details at Rec JDBC Communication channel as :
    JDBC Driver as : com.microsoft.jdbc.sqlserver.SQLServerDriver
    Connection : jdbc:sqlserver://10.1.92.111:1433;database=XONTUSERVENTURA_ORG_TEST.
    Please help me in this regard. I really appreciate your valuable information and time.
    Thanks and Regards,
    Ayub.
    Edited by: Ayubsajjid on Feb 15, 2012 8:49 AM

    Hi All,
    Thanks for all your valuable inputs on my question...
    As per all your inputs, we have to install/Deploy the below required jar files in the aii_af_jmsproviderlib.sda file
    ojdbc14.jar
    msbase.jar
    mssqlserver.jar
    msutil.jar
    Can you please tell me from where we will exact this .jar file, bcoz we have search lotzz but we helpless.
    We install from this link http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=21599--> we download sqljdbc_3.0.1301.101_enu  file >sqljdbc_3.0>enu-->in that I find sqljdbc.jar and sqljdbc4.jar files only . I cant above said .jar files.
    Please help me.
    Regards,
    Ayub.

  • Get definition of an index from query in SQL Server

    Hi,
    I need to get definition of an index using query in SQL Server 2008 as we can get definition of a stored procedure using sp_helptext command.
    Thanks In advance,
    Jitesh

    I have worked on the script and updated the script as per my need. Now I am able to generate the script for a specific index. Here is the script:-
    CREATE PROCEDURE ScriptCreateDropIndexes_SP
     @TableName                    SYSNAME
    ,@SchemaName                SYSNAME            = 'dbo'
    ,@SORT_IN_TEMPDB            VARCHAR(3)        = 'OFF'
    ,@DROP_EXISTING                VARCHAR(3)        = 'OFF'
    ,@STATISTICS_NORECOMPUTE    VARCHAR(3)        = 'OFF'
    ,@ONLINE                    VARCHAR(3)        = 'OFF'
    ,@Index_Name                NVARCHAR(1000)
    ,@is_Create int = 0
    AS
    Parameters
    @Schemaname                    - SchemaName to which the table belongs to. Default value 'dbo'.
    @Tablename                    - TableName for which the Indexes need to be scripted.
    @SORT_IN_TEMPDB                - Runtime value for SORT_IN_TEMPDB option in create index.
                                  Valid Values ON \ OFF. Default = 'OFF'
    @DROP_EXISTING                - Runtime value for DROP_EXISTING option in create index.
                                  Valid Values ON \ OFF. Default = 'OFF'
    @STATISTICS_NORECOMPUTE        - Runtime value for STATISTICS_NORECOMPUTE option in create index.
                                  Valid Values ON \ OFF. Default = 'OFF'
    @ONLINE                        - Runtime value for ONLINE option in create index.
                                  Valid Values ON \ OFF. Default = 'OFF'
        SET NOCOUNT ON
            IF @SORT_IN_TEMPDB NOT IN ('ON','OFF')
            BEGIN
                RAISERROR('Valid value for @SORT_IN_TEMPDB is ON \ OFF',16,1)
                RETURN
            END
            IF @DROP_EXISTING NOT IN ('ON','OFF')
            BEGIN
                RAISERROR('Valid value for @DROP_EXISTING is ON \ OFF',16,1)
                RETURN
            END
            IF @STATISTICS_NORECOMPUTE NOT IN ('ON','OFF')
            BEGIN
                RAISERROR('Valid value for @STATISTICS_NORECOMPUTE is ON \ OFF',16,1)
                RETURN
            END
            IF @ONLINE NOT IN ('ON','OFF')
            BEGIN
                RAISERROR('Valid value for @ONLINE is ON \ OFF',16,1)
                RETURN
            END
            DECLARE @IDXTable TABLE   
                 Schema_ID        INT
                ,Object_ID        INT
                ,Index_ID        INT
                ,SchemaName        SYSNAME
                ,TableName        SYSNAME
                ,IndexName        SYSNAME
                ,IsPrimaryKey   BIT
                ,IndexType        INT
                ,CreateScript    VARCHAR(MAX)    NULL
                ,DropScript        VARCHAR(MAX)    NULL
                ,ExistsScript    VARCHAR(MAX)    NULL
                ,Processed        BIT                NULL
        INSERT INTO @IDXTable
             Schema_ID         
            ,Object_ID         
            ,Index_ID         
            ,SchemaName         
            ,TableName         
            ,IndexName         
            ,IsPrimaryKey   
            ,IndexType  
        SELECT ST.Schema_id
              ,ST.Object_id
              ,SI.Index_id
              ,SCH.Name
              ,ST.Name
              ,SI.Name
              ,SI.is_primary_key
              ,SI.Type
          FROM SYS.INDEXES SI
          JOIN SYS.TABLES  ST
            ON SI.Object_ID = ST.Object_ID
          JOIN SYS.SCHEMAS SCH
            ON SCH.schema_id = ST.schema_id
         WHERE SCH.Name = 'dbo'
           AND ST.Name  = 'group_master'
           AND SI.name = 'uq_group_master__parent_id'
           AND SI.Type IN (1,2,3)
      DECLARE @SchemaID        INT
      DECLARE @TableID        INT
      DECLARE @IndexID        INT
      DECLARE @isPrimaryKey BIT
      DECLARE @IndexType    INT
      DECLARE @CreateSQL    VARCHAR(MAX)
      DECLARE @IndexColsSQL VARCHAR(MAX)
      DECLARE @WithSQL VARCHAR(MAX)
      DECLARE @IncludeSQL VARCHAR(MAX)
      DECLARE @WhereSQL      VARCHAR(MAX)
      DECLARE @SQL        VARCHAR(MAX)
      DECLARE @DropSQL        VARCHAR(MAX)
      DECLARE @ExistsSQL        VARCHAR(MAX)
      DECLARE @IndexName    SYSNAME
      DECLARE @TblSchemaName SYSNAME
      SELECT @TblSchemaName = QUOTENAME(@Schemaname) + '.' + QUOTENAME(@TableName)
      SELECT @CreateSQL = ''  
      SELECT @IndexColsSQL = ''  
      SELECT @WithSQL = ''  
      SELECT @IncludeSQL = ''  
      SELECT @WhereSQL = ''  
        WHILE EXISTS(SELECT 1
                       FROM @IDXTable
                      WHERE CreateScript IS NULL)
        BEGIN
            SELECT TOP 1 @SchemaID = Schema_ID
                  ,@TableID  = Object_ID
                  ,@IndexID  = Index_ID
                  ,@isPrimaryKey = IsPrimaryKey
                  ,@IndexName     = IndexName
                  ,@IndexType     = IndexType
              FROM @IDXTable
             WHERE CreateScript IS NULL
               AND SchemaName = @SchemaName
               AND TableName  = @TableName
             ORDER BY Index_ID
            IF @isPrimaryKey = 1
            BEGIN
                SELECT @ExistsSQL = ' EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N''' + @TblSchemaName + ''') AND name = N''' + @IndexName + ''')'  
                SELECT @DropSQL =   ' ALTER TABLE '+ @TblSchemaName + ' DROP CONSTRAINT [' + @IndexName + ']'
            END
            ELSE
            BEGIN
                SELECT @ExistsSQL = ' EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N''' + @TblSchemaName + ''') AND name = N''' + @IndexName + ''')'  
                SELECT @DropSQL =  ' DROP INDEX [' + @IndexName  + '] ON ' + @TblSchemaName
            END
            IF @IndexType IN (1,2)
            BEGIN
                    SELECT @CreateSQL = CASE  
                                        WHEN SI.is_Primary_Key = 1 THEN  
                                            'ALTER TABLE ' + @TblSchemaName
    + ' ADD  CONSTRAINT [' + @IndexName + '] PRIMARY KEY ' + SI.type_desc
                                        WHEN SI.Type IN (1,2) THEN  
                                            ' CREATE ' + CASE SI.is_Unique
    WHEN 1 THEN ' UNIQUE ' ELSE '' END + SI.type_desc + ' INDEX ' + QUOTENAME(SI.Name) + ' ON ' + @TblSchemaName
                                        END
                          ,@IndexColsSQL =  ( SELECT SC.Name + ' '  
                                     + CASE SIC.is_descending_key
                                       WHEN 0 THEN ' ASC '  
                                       ELSE 'DESC'
                                       END +  ','
                                FROM SYS.INDEX_COLUMNS SIC
                                JOIN SYS.COLUMNS SC
                                  ON SIC.Object_ID = SC.Object_ID
                                 AND SIC.Column_ID = SC.Column_ID
                              WHERE SIC.OBJECT_ID = SI.Object_ID
                                AND SIC.Index_ID  = SI.Index_ID
                                AND SIC.is_included_column = 0
                              ORDER BY SIC.Key_Ordinal
                               FOR XML PATH('')
                            ,@WithSQL =' WITH (PAD_INDEX  = ' + CASE SI.is_padded WHEN 1 THEN 'ON' ELSE 'OFF' END + ',' + CHAR(13) +
                                       ' IGNORE_DUP_KEY = ' + CASE SI.ignore_dup_key WHEN 1
    THEN 'ON' ELSE 'OFF' END + ',' + CHAR(13) +
                                       ' ALLOW_ROW_LOCKS = ' + CASE SI.Allow_Row_Locks WHEN
    1 THEN 'ON' ELSE 'OFF' END + ',' + CHAR(13) +
                                       ' ALLOW_PAGE_LOCKS = ' + CASE SI.Allow_Page_Locks WHEN
    1 THEN 'ON' ELSE 'OFF' END + ',' + CHAR(13) +
                                       CASE SI.Type WHEN 2 THEN 'SORT_IN_TEMPDB = ' + @SORT_IN_TEMPDB
    +',DROP_EXISTING = ' + @DROP_EXISTING + ',' ELSE '' END +  
                                       CASE WHEN SI.Fill_Factor > 0 THEN ' FILLFACTOR =
    ' + CONVERT(VARCHAR(3),SI.Fill_Factor) + ',' ELSE '' END +
                                       ' STATISTICS_NORECOMPUTE  = ' + @STATISTICS_NORECOMPUTE
    + ', SORT_IN_TEMPDB = ' + @SORT_IN_TEMPDB +
                                       ', ONLINE = ' + @ONLINE  + ') ON ' + QUOTENAME(SFG.Name)
                            ,@IncludeSQL =  ( SELECT QUOTENAME(SC.Name) +  ','
    FROM SYS.INDEX_COLUMNS SIC
    JOIN SYS.COLUMNS SC
    ON SIC.Object_ID = SC.Object_ID
    AND SIC.Column_ID = SC.Column_ID
                                              WHERE SIC.OBJECT_ID
    = SI.Object_ID
    AND SIC.Index_ID  = SI.Index_ID
    AND SIC.is_included_column = 1
                                              ORDER BY SIC.Key_Ordinal
                                               FOR
    XML PATH('')
                            ,@WhereSQL  = SI.Filter_Definition
                      FROM SYS.Indexes SI
                      JOIN SYS.FileGroups SFG
                        ON SI.Data_Space_ID =SFG.Data_Space_ID
                     WHERE Object_ID = @TableID
                       AND Index_ID  = @IndexID
                       SELECT @IndexColsSQL = '(' + SUBSTRING(@IndexColsSQL,1,LEN(@IndexColsSQL)-1) + ')'
                       IF LTRIM(RTRIM(@IncludeSQL)) <> ''
                            SELECT @IncludeSQL   = ' INCLUDE (' + SUBSTRING(@IncludeSQL,1,LEN(@IncludeSQL)-1) + ')'
                       IF LTRIM(RTRIM(@WhereSQL)) <> ''
                           SELECT @WhereSQL        = ' WHERE (' + @WhereSQL + ')'
            END
            IF @IndexType = 3
            BEGIN
                    SELECT @CreateSQL = ' CREATE ' + CASE  
    WHEN SI.Using_xml_index_id IS NULL THEN ' PRIMARY '  
    ELSE '' END  
    + SI.type_desc + ' INDEX ' + QUOTENAME(SI.Name) + ' ON ' + @TblSchemaName
                          ,@IndexColsSQL =  ( SELECT SC.Name + ' '  
                                     +  ','
                                FROM SYS.INDEX_COLUMNS SIC
                                JOIN SYS.COLUMNS SC
                                  ON SIC.Object_ID = SC.Object_ID
                                 AND SIC.Column_ID = SC.Column_ID
                              WHERE SIC.OBJECT_ID = SI.Object_ID
                                AND SIC.Index_ID  = SI.Index_ID
                                AND SIC.is_included_column = 0
                              ORDER BY SIC.Key_Ordinal
                               FOR XML PATH('')
                            ,@WithSQL =' WITH (PAD_INDEX  = ' + CASE SI.is_padded WHEN 1 THEN 'ON' ELSE 'OFF' END + ',' + CHAR(13) +
                                       ' ALLOW_ROW_LOCKS = ' + CASE SI.Allow_Row_Locks WHEN
    1 THEN 'ON' ELSE 'OFF' END + ',' + CHAR(13) +
                                       ' ALLOW_PAGE_LOCKS = ' + CASE SI.Allow_Page_Locks WHEN
    1 THEN 'ON' ELSE 'OFF' END + ',' + CHAR(13) +
                                       CASE SI.Type WHEN 2 THEN 'SORT_IN_TEMPDB = OFF,DROP_EXISTING
    = OFF,' ELSE '' END +  
                                       CASE WHEN SI.Fill_Factor > 0 THEN ' FILLFACTOR =
    ' + CONVERT(VARCHAR(3),SI.Fill_Factor) + ',' ELSE '' END +
                                       'SORT_IN_TEMPDB = OFF ' + ') '  
                            ,@IncludeSQL = ' USING XML INDEX [' + (SELECT Name
    FROM SYS.XML_Indexes SIP
    WHERE SIP.Object_ID = SI.Object_ID
    AND SIP.Index_ID = SI.Using_XML_Index_ID)  + '] FOR PATH '
                      FROM SYS.XML_Indexes SI
                     WHERE SI.Object_ID = @TableID
                       AND SI.Index_ID  = @IndexID
                       SELECT @IndexColsSQL = '(' + SUBSTRING(@IndexColsSQL,1,LEN(@IndexColsSQL)-1) + ')'
            END
               SELECT @CreateSQL = @CreateSQL  
                                   + @IndexColsSQL + CASE WHEN @IndexColsSQL <> '' THEN CHAR(13) ELSE ''
    END
                                   + ISNULL(@IncludeSQL,'') + CASE WHEN @IncludeSQL <> '' THEN CHAR(13) ELSE
    '' END
                                   + ISNULL(@WhereSQL,'') + CASE WHEN @WhereSQL <> '' THEN CHAR(13) ELSE
    '' END  
                                   --+ @WithSQL  
                UPDATE @IDXTable
                   SET CreateScript = @CreateSQL
                      ,DropScript   = @DropSQL
                      ,ExistsScript = @ExistsSQL
                 WHERE Schema_ID = @SchemaID
                   AND Object_ID = @TableID
                   AND Index_ID  = @IndexID
         END    
       -- PRINT REPLICATE('-',100)
      --  PRINT 'DROP Indexes'
      --  PRINT REPLICATE('-',100)
      if @is_Create = 0
      begin
        UPDATE @IDXTable
            SET Processed = 0
         WHERE SchemaName = @SchemaName
              AND TableName  = @TableName
         WHILE EXISTS(SELECT 1
                       FROM @IDXTable
                      WHERE ISNULL(Processed,0) = 0  
                            AND SchemaName = @SchemaName
                           AND TableName  = @TableName )
        BEGIN
            SELECT @SQL = ''
            SELECT TOP 1 @SchemaID = Schema_ID
                  ,@TableID  = Object_ID
                  ,@IndexID  = Index_ID
                  ,@SQL = 'IF ' + ExistsScript + CHAR(13) + DropScript + CHAR(13)
              FROM @IDXTable
             WHERE ISNULL(Processed,0) = 0
               AND SchemaName = @SchemaName
                  AND TableName  = @TableName
             ORDER BY IndexType DESC,Index_id DESC
             PRINT @sql
             UPDATE @IDXTable
                 SET Processed = 1
              WHERE Schema_ID = @SchemaID
                AND Object_ID = @TableID
                AND Index_ID  = @IndexID
        END
        end
        --PRINT REPLICATE('-',100)
       --PRINT 'Create Indexes'
       -- PRINT REPLICATE('-',100)
         if @is_Create = 1
         begin
        UPDATE @IDXTable
            SET Processed = 0
         WHERE SchemaName = @SchemaName
              AND TableName  = @TableName
         WHILE EXISTS(SELECT 1
                       FROM @IDXTable
                      WHERE ISNULL(Processed,0) = 0  
                            AND SchemaName = @SchemaName
                           AND TableName  = @TableName )
        BEGIN
            SELECT @SQL = ''
            SELECT TOP 1 @SchemaID = Schema_ID
                  ,@TableID  = Object_ID
                  ,@IndexID  = Index_ID
                  ,@SQL = 'IF NOT ' + ExistsScript + CHAR(13) + CreateScript + CHAR(13)
              FROM @IDXTable
             WHERE ISNULL(Processed,0) = 0
               AND SchemaName = @SchemaName
                  AND TableName  = @TableName
             ORDER BY IndexType DESC,Index_id DESC
             PRINT @sql
             UPDATE @IDXTable
                 SET Processed = 1
              WHERE Schema_ID = @SchemaID
                AND Object_ID = @TableID
                AND Index_ID  = @IndexID
        END
        end

  • Getting error while connecting Sharepoint WFE to another Sql Server 2008

    Hello All,
    I am trying to connect a sharepoint wfe to another Sql server 2008 and getting error. This is what I am trying to do.
    #Disconnecting present database serer
    Disconnect-SPConfigurationDatabase
    #Connecting to another database server
    Connect-SPConfigurationDatabase -DatabaseServer "ServerName" -DatabaseName "SharePoint_Config_nameabcd" -Passphrase $SecuredPassphrase
    Getteing below error
    Connect-SPConfigurationDatabase : Cannot open database "SharePoint_Config_nameabcd" requested by the login. The login failed.
    Login failed for user 'domain\username'.
    At line:1 char:32
    + Connect-SPConfigurationDatabase <<<<  -DatabaseServer "ServerName" -Database
    Name "SharePoint_Config_nameabcd" -Passphrase $SecuredPassphrase  + CategoryInfo : InvalidData:(Microsoft.Share... urationDatabase:SPCmdletConnectSPConfigurationDatabase) [Connect-SPConfigurationDatabase], SqlException+ FullyQualifiedErrorId
    : Microsoft.SharePoint.PowerShell.SPCmdletConnectS PConfigurationDatabaffsadss FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletConnectS PConfigurationDatabase
    Please advise to resolve the error.

    Hi,
    We have not heard from you in a couple of days.
    Just checking in to see if the information was helpful. Whether your issue is solved.
    Have a great day!
    Best Regards,
    Lisa Chen
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Isse with using Grouping Sets in SQL Server 2008 R2

    Hi,
    I created a query in SQL Server 2012 using grouping sets that works fine.  When I try to use the same query in SQL Server 2008 I get an error ("Inccorrect syntax near SETS").
    I researched using grouping sets in 2008 and didn't see any issue with my query.  What is different in grouping sets 2008 vs 2012?
    SELECT tl.ClientRegionCd as [Client Region Code] , tl.ClientRegionDesc as [Region Name], count(tl.CompleteICN) as [Trauma Letters Sent]
    from TORT_Trauma_Letters tl
    Where CONVERT(VARCHAR(26), tl.SecondNoticeSent, 23) between '2014-06-12' and '2014-06-12'
    GROUP BY GROUPING SETS((tl.ClientRegionCd, tl.ClientRegionDesc), ())
    Stacie

    Check this blog post as how to deal with date ranges
    http://sqlblog.com/blogs/aaron_bertrand/archive/2009/10/16/bad-habits-to-kick-mishandling-date-range-queries.aspx
    For your result you can simply achieve your result with UNION ALL, e.g.
    select Client, Region, Letters
    from myTable 
    UNION ALL
    select NULL, NULL, SUM(letters) as Letters
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • How to delete a row from a SQL Server CE Table with multiple JOINs?

    I want to delete a record from a SQL Server CE table.
    There are 3 tables scripts, options and results. I would like to remove a record from the results table. The where clause contains dynamic information which retrieved via other queries to different tables in the same database. These queries work fine and deliver
    the desired data.
    The Compact server is a clone of a remote table created using the sync framework. The same query to the remote table works fine.
    The error I get is:
    There was an error parsing the query. [ Token line number = 1,Token line offset = 10,Token in error = from ]
    The code that throws the exception is as follows:
    Dim connLoc As SqlCeConnection = New SqlCeConnection(My.Settings.ConnectionString)connLoc.Open()     Dim strDel As String = "Delete r from ResultsTable r inner join OptionsTable o ON o.TestName=r.TestName inner join ScriptTable c ON r.TestName=c.TestName WHERE r.TestName = '" & ds1Loc.Tables(0).Rows(0)(1) & "' AND [Index] = '" & lstIndex & "'"Dim cmdDel As SqlCeCommand = New SqlCeCommandcmdDel.CommandText = strDelcmdDel.Connection = connLoccmdDel.ExecuteNonQuery()
    The values held in ds1Loc.Tables(0).Rows(0)(1) and lstIndex are
    correct so should not be the problem.
    I also tried using parameterised queries
    Dim strDel As String = "Delete r from [ResultsTable] r inner join [OptionsTable] o ON o.TestName=r.TestName inner join [ScriptTable] c ON r.TestName=c.TestName WHERE r.TestName = @TestName AND [Index] = @lstIndex"
    Dim cmdDel As SqlCeCommand = New SqlCeCommand        cmdDel.CommandText = strDel       
    With cmdDel.Parameters           
    .Add(New SqlCeParameter("@TestName", ds1Loc.Tables(0).Rows(0)(1)))           
    .Add(New SqlCeParameter("@lstIndex", lstIndex))       
    End With 
    cmdDel.Connection = connLoc        cmdDel.ExecuteNonQuery()
    I have tried replacing the "=" with "IN" in the the WHERE clause but this has not worked.
    Is it the join that is causing the problem? I can do a select with the same search criteria and joins from the same database.
    Also this query works with SQL Server. Is it perhaps that SQL CE does not support the Delete function the same as SQL Server 2008? I have been looking at this for a while now and cannot find the source of the error. Any help would be greatly appreciated.

    Hello,
    In SQL Server Compact, we can use join in FROM clause. The DELETE statement fail may be caused by the FOREIGN KEY constraint.
    Please refer to:
    DELETE (SQL Server Compact)
    FROM Clause (SQL Server Compact)
    Regards,
    Fanny Liu
    Fanny Liu
    TechNet Community Support

  • 30 M rows in SQL Server 2008 R2- View or Table for faster performance

    Hello,
    I am creating a SSRS 2008 report that currently is using a view. It's a view made out of one table and is not indexed.
    There are 70 some columns that I am displaying in the report with 10 or so parameters that I am passing through a procedure from SSRS to SQL Server.
    When the report runs in Server or in development mode, the report gets out of memory error - which could be a totally different issue as it is trying to bring in a  couple million rows amd runs for 15- 20 mins.. and errors out.
    My question is if it is sourcing a single table, will a view be better with the right index or a table with index.
    Clustered, non clustered? Any suggestions or input would be greatly appreciated.
    Thank You.

    What is the exact error message?
    In SSRS you can use a stored procedure with parameters as data source. You can use a query in the sp, you don't need a view.
    >it is trying to bring in a  couple million rows amd runs  20 mins.. and errors out.
    Indexing not likely to help you. You have a huge return set problem.
    Kalman Toth Database & OLAP Architect
    SELECT Query Video Tutorial 4 Hours
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • JTDS not connecting with SQL Server 2008 R2 SP2 + SSL with Java 6 U34-35

    Environment:
    Windows 7 Pro 32-bit
    SQL Server 2008 R2 SP2 (Forced Encryption = Yes, No Certificate provided to server)
    Java 6 Update 27-35 and Java 7 Update 2-7
    jTDS 1.2.2 and 1.2.6
    Under the following setup, our Java application is able to connect to the SQL Server database:
    - SQL Server 2008 R2 SP2
    - Java 6 Update 27-33 or Java 7 Update 2-5
    just switching the JVM to the following would cause the application to be unable to connect to the database:
    - Java 6 Update 34 or 35, or Java 7 Update 6 or 7
    Browsing through the Java 6 Update 34 release notes, it looks like nothing big was changed, so I'm wondering what has changed with Java 6 U34 and Java 7 U6. I was also looking through a packet sniffer, and indeed the behavior of Java 6 Update 33 and lower was different from Java 6 Update 34 (although I couldn't understand the messages being passed, the number of connections and messages were different).
    * This is different from the issue with Java 6 Update 29-30 and Java 7 wherein they were patched for the BEAST SSL vulnerability. That was fixed with the SP2 patch for SQL Server 2008 R2, and for SQL Server 2008 you'd need a hotfix aside from SP3. After patching the server with those updates, Java 6 Update 29-33 and Java 7 U1-5 should be able to connect to the database.
    * If I do switch off Force Encryption, all Java versions are able to connect to the database.
    Edited by: user1357749 on Oct 12, 2012 1:20 AM

    Hi,
    It's four months later, but my colleague and I have reproduced the same behavior in both our commercial product, and a very simple example class. It's exactly as you describe it, where the latest versions of both Java 6 and 7 (and several previous versions) hang during the first jTDS SQL query to the DB (immediately after the SSL and handshake). It also happens with the Microsoft JDBC driver.
    If you disable the BEAST SSL fix (-Djsse.enableCBCProtection=false), then the connections work without any problems. So, while this is different from the original BEAST SSL problem and subsequent fix, it really seems like some additional changes were made to the fix in a later Java release that broke things.
    My colleague has filed a bug with Oracle, and is awaiting a response. We also filed a bug at the jTDS project (#690 - http://sourceforge.net/p/jtds/bugs/690/) that has simple reproduction steps. A contributer at the jTDS project agrees that this seems to be a problem with the JRE, and is not specific to jTDS.
    I hope that Oracle will address this issue soon. We need to periodically update the JRE due to vulnerabilities, and we need to have SSL for our JDBC connections for security reasons. This bug puts us and others in a difficult position.

  • How to convert rows to columns in sql server 2008

    How to convert rows to columns in sql server 2008 using the GROUP BY function? (only one query allowed)

    Lookup the Pivot transformation. From BOL:
    The Pivot transformation makes a normalized data set into a less normalized
    but more compact version by pivoting the input data on a column value. For
    example, a normalized Orders data set that lists customer name, product, and quantity purchased typically has multiple rows for any customer who purchased multiple products, with each row for that customer showing order
    details for a different product. By pivoting the data set on the product column, the Pivot transformation can output a data set with a
    single row per customer. That single row lists all the purchases by the customer, with the product names shown as column names, and the quantity shown as a value in the product column. Because not every customer purchases every product, many columns may contain
    null values.
    When a dataset is pivoted, input columns perform different roles in the pivoting process. A column can participate in the following ways:
    The column is passed through unchanged to the output. Because many input rows
    can result only in one output row, the transformation copies only the first
    input value for the column.
    The column acts as the key or part of the key that identifies a set of
    records.
    The column defines the pivot. The values in this column are associated with
    columns in the pivoted dataset.
    The column contains values that are placed in the columns that the pivot
    creates.
    Paul

  • Unable to connect to SQL Server 2008 from OBIEE 11G(on 64 bit Linux box)

    We are unable to connect to connect to SQL Server 2008 from OBIEE 11G which is on 64 bit Red Hat Enterprise Linux.
    Infrastructure: OBIEE 11.1.1.5 64bit, on 64 bit Red Hat Linux Enterprise Linux 5.6 , MS SQL Server 2008 on 64 bit Microsoft Windows Server
    Issue Description: Unable to connect to SQL Server 2008 from OBIEE11G RPD
    Details: We are unable to connect to SQL Server 2008 from OBIEE which is on a 64 bit Linux box. We created the ODBC connection on Linux box to the SQL server. Whenever we try to import metadata it throws an error that says ‘Connection Failed’.
    Here are the steps we followed to setup the ODBC connection on Linux box.
    1) We updated the user.sh file with the LD_LIBRARY_PATH and LD_LIBRARY_PATH_64 values that point to $ORACLE_HOME/bifoundation/odbc/lib
    This is where we found the driver for SQL server SEmsss23.so.
    2) We updated the odbc.ini file with the entry for SQL server with the connection details
    SI_SQL_Server_DEV = SQL Server
    [SI_SQL_Server_DEV]
    Driver=/u001_OAS/Oracle/Middleware/Oracle_BI1/bifoundation/odbc/lib/SEmsss23.so
    Description=DataDirect 5.1 SQL Server Wire Protocol
    Address=10.230.216.52,54970
    AlternateServers=
    AnsiNPW=Yes
    ConnectionRetryCount=0
    ConnectionRetryDelay=3
    Database=SVBDW_NEW
    LoadBalancing=0
    LogonID=SIDatavalidation
    Password=~~~Password123
    QuoteID=No
    ReportCodePageConversionErrors=0
    3) We updated the IDENTIFIER_QUOTE_CHAR with single quotes instead of double quotes in the DB features of the RPD
    4) We updated the bash_profile file to point the ODBCINI variable to the path where the OBIEE odbc.ini file is present.
    Export ODBCINI=/u001_OAS/Oracle/Middleware/instances/instance1/bifoundation/OracleBIApplication/coreapplication/setup/odbc.ini
    The error in nqsserver.log file says “[nQSError: 16001] ODBC error state: IM002 code: 0 message: [DataDirect][ODBC lib] Data source name not found and no default driver specified.”

    Hi,
    Make sure SQL Configuration Manager make sure the TCP/IP enabled. please try below method
    Method 1
    Re Create a new ODBC & Oracle Bi Server DSN Configuration test it and use it in the connection pools.
    define your ODBC data source in your server where the BI Server is installed. Check your DB connections in your physical layer and make they are defined on your BI Server as well.
    Method 2:
    try using the complete TNS in below format in the datasource name section:
    (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST =DB IP)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = ORCL) ) and provide the credentials.
    Method 3:
    To use the OCI call interface you need to have oracle client DB to be installed so that you can establish a connection using that DB credentials and connect to the remote dB and then import the tables.....this is the rule of thumb.
    hope helps you.
    Thanks
    Deva

  • Connection pooling with SQL Server 2008 and Tomcat 6.0

    Hello Everybody,
    I'm creating a web application using struts 2.0 , tomcat 6.0 and sql server 2008.
    Everything works fine but i'm unable to create connection pooling with sql server 2008.Please help me to solve this issue.
    Code for this is as foolows:
    in my META-INF/context.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <Context path="/spas" docBase="spas"
    debug="5" reloadable="true" crossContext="true">
    <Resource
    name="jdbc/spas_new"
    auth="Container"
    type="javax.sql.DataSource"
    maxActive="20"
    maxIdle="10"
    maxWait="-1"
    user="spas_user"
    password="spas123"
    driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
    url="jdbc:sqlserver://HGL-0053\dbo:1433;databaseName=spas_new;responseBuffering=adaptive;"/>
    </Context>
    in my web.xml
    <resource-ref>
    <description>SQL Server Datasource</description>
    <res-ref-name>jdbc/spas_new</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    and in my ConnectionThread.java file i've used:
    Context ctx = new InitialContext();
    if(ctx == null )
    throw new Exception("Sorry! No Context Exception");
    DataSource ds = (DataSource)ctx.lookup("java:/comp/env/jdbc/spas_new");
    System.out.println("ds:"+ds);
    conn=ds.getConnection();
    Following is the exception:
    org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Login failed for user ''.)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1225)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
    at login.V_SPAS_ConnectionThread.getConnection(V_SPAS_ConnectionThread.java:87)
    at org.apache.jsp.login.v_005fspas_005flogin_005fpage_jsp._jspService(v_005fspas_005flogin_005fpage_jsp.java:95)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
    at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
    at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263)
    at org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:1023)
    at org.apache.struts.tiles.TilesRequestProcessor.internalModuleRelativeForward(TilesRequestProcessor.java:345)
    at org.apache.struts.action.RequestProcessor.processForward(RequestProcessor.java:572)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:221)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
    at org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:694)
    at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:665)
    at org.apache.jsp.index_jsp._jspService(index_jsp.java:54)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at login.V_SPAS_SecurityCheckFilter.doFilter(V_SPAS_SecurityCheckFilter.java:108)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:619)
    Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user ''.

    Hi Karthikeyan,
    This is not the issue at all. I can open the management studio by the same login id and password and also i can make the database jdbc connection from plain java file.
    It does not give me any problem by them.
    I'm unable to find the actual problem. May be i'm missing something in connection pooling.
    Please help.
    Regards
    Mina

  • How to connect SQl Server 2008 to SAP BW

    Hi Experts,
    i would to build the following scenario.
    I would like to connect an infoprovider or a query in sap BW to a SQL Server.
    The goal will be to use the Management studio as well and to send the data from SAP BW (Cube or Query) to the sql server.
    1. Could you please advice steps by steps how to do the istallation?
    2; Which connectors should i use?
    3. Is there any document which provide the tools, drivers, connectors to be used?
    4. Is there any how to which can help after the installation to run the scenario?
    Thank you in advance for your Input.
    Cheers
    Gilo

    Hello,
    What you request can be done with DB Connect.
    A good starting point is the following link :
    [http://help.sap.com/saphelp_NW04/helpdata/en/58/54f9c1562d104c9465dabd816f3f24/content.htm|http://help.sap.com/saphelp_NW04/helpdata/en/58/54f9c1562d104c9465dabd816f3f24/content.htm]
    Also I recommend to search further on SDN because there are some interesting posts on connecting BW to external databases like SQL Server.
    Wim

Maybe you are looking for

  • Does the traffic seem down?

    Since the switch over it seems that less people are coming to these forums or at least less questions are getting asked. Has anyone else noticed this too?

  • How to disable the block Wan Request feature?

    I can't Figure how to change it. I have been tring to do this for hours. http://img216.imageshack.us/my.php?image=38082490tb2.jpg Message Edited by Donald2424 on 01-01-2009 05:48 PM

  • Multiple Spaces between words in Java

    Hi All String s1 = "boy"; String s2 = "girl"; String s = s1 + "multiple spaces through keyboard spacebar writing this because when this is posted it will not be visible in the browser" + s2; system.out.println(s); I need to have multiple spaces betwe

  • Doesn't hold as many songs as it used to...

    I still get about 940 songs but I used to get 1000 (at one point I even had more then that) - it seems everytime I updated it it holds less and less. Like this morning, it had 970 or something and I wanted to add two new cds... so you would think I w

  • IConnection classdef exception when running report in websphere-linux env

    hi all, <br><br>        I am running Websphere 6.1 on a linux environment (Red Hat enterprise 5.5). I am using the Crystal Reports 2008 SDK API to generate the report and I get the following exception. <br><br> com.crystaldecisions.sdk.occa.report.li