CLICONFG and Setting the Alias

History:

I was running into errors adding the SharePoint 2010 farm to the Quest Tools Site Administrator Console. The error I was getting was:

NetBIOS or DNS name or IP address of the SharePoint server
Error: The SharePoint SQL database server cannot be reached at SQLALIAS. Please verify that the firewall does not block SQL Server ports on SQLALIAS and SERVERNAME. SQL aliases used on SharePoint front-end servers must also be configured for SERVERNAME.
Details SQLALIAS (Database Server): Database access failed (Error: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. Source: Microsoft OLE DB Provider for SQL Server SQLSTATE: 08001 Native error: 17 Server: Error state: 1 Error severity: 16 Strings: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. )

I had used the CLICONFG from the “run” command to set the alias for the SQL Cluster:

However, when working with the helpdesk from Quest Tools, he had me set the CLICONFG from C:\Windows\SysWOW64. This resolved the issue.

Advertisements

Using SQL inside Workflow

Thanks to iLove SharePoint for creating the “Execute SQL” action.

With it I was able to create a workflow against the add/change event in my document library to create a link to my equipment page based on if there is any information to link to.

I first store my select statement in a variable so I can log it to the history file (this was helpful with debugging the workflow.)

SELECT COUNT(DWG_NAME_) FROM AccessDatabase…[AccessTable] where DWG_NAME_ = ‘[%DocumentLibrary:FileName%].DWG’

Then using the Execute SQL action, I can query the Access Database to see if there is anything I want to link to and store the results in a variable. I can then also show how many items there are in the hyperlink text. (The connection string I used was: Data Source= OFFICESERVER;Initial Catalog=WSS_Content;Integrated Security=SSPI. This particular server uses Studio Express on the same server as SharePoint.)

So if there is something to link to, I create the URL text: Store Helpful text-[%Variable: SQLResult%] in Variable: URLText.

Then I build the URL string:

And store it in the hyperlink column of my document library. The user will know that only the drawings with links have something in the Access Database to look at:

Using Data from Access in SharePoint via SQL

This is a reoccurring issue I have; I don’t know C# beyond one program I wrote 3 years ago when my career path took me away from development and toward other areas. But now, working with SharePoint, this has become a handicap – I want to accomplish a task that is more complicated than straight SharePoint Designer can handle. Unfortunately I don’t have time to defer the task while I learn the C# that would solve this task in a more efficient manner. OK, so it is imperative that I get around to learning C#. Until then what can I do? I do know SQL. This leads me to my current workaround.

Task: Create a site for an engineering project that will store drawings, pieces of equipment (known by their tags), and all specs and requisitions related to those tags. The drawings are created with a program called CADworks. CADworks stores information about the drawings (such as the tag numbers) in an Access database. Pull in the information from the Access database into a SharePoint Equipment list that can be used to tie together drawings (stored as PDF’s in a SharePoint library), Specs (information can be in lists or libraries), Requisitions (lists), and Purchase Orders (library.)

I hoped first to use a ShareVis workflow to take the drawing number as it’s uploaded into the library and pull the data from the Access database and manipulate the list then. However, that functionality does not currently exist with ShareVis – the plug-ins that looked like they might be able to do what I wanted are for forms only. (They did however pass on that request to their development department. I have hope that it will be possible in the future.)

Issue: Can’t insert into SharePoint List via SQL Insert. So can I pull data from Access AND SharePoint Libraries to create a cross-linking data view?

  1. Create a linked server to access an Access database. See Configuring a Linked Microsoft Access Server on SQL 2005 Server . Since the CADworks database is stored on the shared drive, I’ll need to create a batch file to copy it to the SQL server nightly.
  2. Create store procedure to query access database:

    set ANSI_NULLS ON

    set QUOTED_IDENTIFIER ON

    GO

    — =============================================

    — Author:        SharePoint Diva

    — Create date: 3/10/2009

    — Description:    Pull data from Linked Access Database

    — to display in a data view on SharePoint

    — =============================================

    ALTER PROCEDURE [dbo].[csp_GetComponentsMechanical]

        — Search by PID if provided, otherwise use wild card

        @pid varchar(40) = ‘%’

    AS

    BEGIN

        — SET NOCOUNT ON added to prevent extra result sets from

        — interfering with SELECT statements.

        SET NOCOUNT ON;

     

        — Inside declare for debugging

        — DECLARE @pid varchar(40)

        — SET @pid = ‘%’

     

    — Insert statements for procedure here

        SELECT DISTINCT REPLACE(DWG_NAME_,’.DWG’,”) AS [P&ID], REPLACE(TAG_,’-‘,”) AS [Equip. Tag]

        FROM AccessDatabase…[AccessTable]

        WHERE DWG_NAME_ like @pid

    END

     

  3. Create Database Connection in SharePoint Designer:


     


     

  4. Create a data view in SharePoint Designer:

     

  5. Modify the DataForm field to create a hyperlink to the drawings library based on the value of the field:

    Address example: http://DevActiveProject/DrawingsDesign/Forms/AllItems.aspx?&FilterField1=P%5Fx0026%5FID&FilterValue1={@P_x0026_ID}

     

    So now I have an equipment page containing data from Access that links to my document library, and because of the query string parameter, I can create a link in my document library that will redirect to a filtered view of my equipment page.

     

     

    I’ll cover in a following post the workflow I created for my library to create the hyperlink back to this list.

 

 

Attaching this database requires upgrade…

I’m trying to add a content database to an existing Web Application.  I go into Central Administration > Application Management > Content Databases and Add a content database.  I then get the error: 

Attaching this database requires upgrade, which could time out the browser session.  You must use the STSADM command ‘addcontentdb’ to attach this database.   

The content database gets created in the separate SQL Server (2005).  Running the STSADM command gives the following error in the error log: 

The specified SPContentDatabase Name=blah_Content Parent=SPDatabaseServiceInstance has been upgraded to a newer version of SharePoint. Please upgrade this SharePoint application server before attempting to access this object. 

Nothing requires an upgrade, by following the steps in this article, I was able to create the content database and attach it to the web application. 

Reproduced Content from Article (just in case link disappears): 

Step a: Use SQL Query Analyzer to create the database

Use SQL Query Analyzer to create a new content database for use with the virtual server in Windows SharePoint Services. You cannot use the Create Database Wizard in the SQL Server Enterprise Manager tool to create the new database. Instead, run the following two queries in SQL Query Analyzer. When you use the following queries, make sure that you do the following:

·         Replace each instance of WSS_Content in the queries with the name that you want to use for the database.

·         Replace each instance of AdminVsAppPoolIdentity in the query with the account that is the SharePoint Central Administration virtual server application pool identity. This account is also the database owner (dbo) of the database.

·         Replace each instance of ContentVsAppPoolIdentity in the query with the account that is the content virtual server application pool identity.

·         Replace each instance of Domain in the query with the domain name.

Use the following query to create the database: 

— Windows SharePoint Services Content Database Creation Script
— TODO: Change the database name from WSS_Content to the name of the database that you want to use
CREATE DATABASE [WSS_Content] COLLATE Latin1_General_CI_AS_KS_WS
exec sp_dboption [WSS_Content], autoclose, false
GO

 

Use the following query to configure permissions for the database that you created: 

— Windows SharePoint Services Content Database Creation Script
use WSS_Content
— TODO: Change AdminVsAppPoolIdentity to the SharePoint Central Administration virtual server application pool account and change ContentVsAppPoolIdentity to the content virtual server application pool account.

DECLARE @AdminVsAppPoolIdentity nvarchar(128 )
DECLARE @ContentVsAppPoolIdentity nvarchar(128 )
SET @AdminVsAppPoolIdentity = N’Domain\AdminVsAppPoolIdentity’
SET @ContentVsAppPoolIdentity = N’Domain\ContentVsAppPoolIdentity’

EXEC sp_grantlogin @ContentVsAppPoolIdentity;
EXEC sp_grantlogin @AdminVsAppPoolIdentity;

— The following line will fail with error 15007 if @AdminVsAppPoolIdentity is the Network Service account.  This is expected.
EXEC sp_changedbowner @AdminVsAppPoolIdentity;

— The following line will fail with error 15063 if the account is not the Network Service account.  This is expected.
IF NOT EXISTS (SELECT * FROM sysusers WHERE name=@ContentVsAppPoolIdentity) EXEC sp_grantdbaccess @ContentVsAppPoolIdentity;

— The following line will fail with error 15410 if the account is not the Network Service account.  This is expected.
EXEC sp_addrolemember ‘db_owner’, @ContentVsAppPoolIdentity;

Step b: Add the content database to the virtual server

Use Windows SharePoint Services Central Administration to add the content database to the virtual server. To do this, follow these steps.

  1. Click Start, point to All Programs, point to Administrative Tools, and then click SharePoint 3.0 Central Administration.
  2. Click Application Management, and then click Content databases under SharePoint Web Application Management.
  3. On the Manage Content Databases page, click Add a content database.
  4. In the Web Application area, click the name of the Web application to which you want to add the content database.
  5. In the Database Name and Authentication area, specify the name of the database, the name of the database server, and the authentication method.
  6. In the Database Capacity Settings area, type the number that you want in the Number of sites before a warning event is generated box and in the Maximum number of sites that can be created in this database box, and then click OK.

Note If you configured permissions for the database with the NT Authority\Network Service account, you have to add the Network Service account to the System Administrators role in SQL Server before you can follow this step. You cannot make the Network Service account the database owner (dbo) of the database. You have to add the Network Service account to the System Administrators role before you can add the database to the virtual server. After you add the database to the virtual server, remove the Network Service account from the System Administrators role in SQL Server.

 

 

 

 

 

 

Jumping the Gun

“Divas” are rarely as talented or knowledgeable as they’d like to be. Call it a statement of intent. An “if you build it they will come…” idea. Or call me a complete poser. Whatever… I’m attempting to share the knowledge of my success and failures. Like every good diva-poser-scientist-wannabe, I imagine I’ll be encountering far more failures than successes.

So far, trying to use SQL Server 2008 with Microsoft Office SharePoint Server 2007 on a Windows Server 2008 isn’t working for me. Actually I’d not even reached the MOSS installation part yet. I was just trying to do the step before installing the Windows SharePoint Services 3.0 x64 with Service Pack 1. The part where I go into SQL Server Surface Area Configuration and allow Remote Connections.

And I find there is no such animal in 2008. So if anyone knows how to allow remote connections on SQL Server 2008, please let me know. My google-fu has yet to find any answers. For now, we’re going back to 2005 in this installation.

To continue, provide valid credentials for the SQL Server Agent Service

This was driving me crazy. We’re performing a fresh installation on a fresh server; Microsoft Office SharePoint Server 2007 on a Windows Server 2008. I’ve reached the part of the installation where I’m installing SQL Server 2008. No matter what I put in for the UserName, I’d get the error “Invalid or missing username or password. To continue, provide valid credentials for the SQL Server Agent service.”

Looking at the forums, it wasn’t just me. Several people provided answers or reporting not having any issue, but it was obvious, from the continuous pleas for help, that the responses weren’t providing the help asked for. Maybe they’re like me; I need pictures. So here’s my error:

Peter Saddow from MSFT listed the answer, but it took me a few tries to understand it.


 invalid or missing username or password. To continue, provide valid credentials for the SQL Server Agent Service – MSDN Forums

I suppose won’t know until later if this was completely the correct action to take, but it did get me beyond this screen, which after umpteen tries is all I really wanted at this point: