How to create SQL Connection to other database from call out ?

Hi

I am trying to update another legacy MS SQL database after user insert new 
record in MS CRM system. The way i did is at call out postcreate , i code by 
VS 2003. The coding is starting from setting a connectionsstring to connect 
another database which it is in same server as MS CRM Server, but different 
database name and insert SQL command.

The result is, my call out can't open database connection at all. I tested 
that inserting new record in my local machine with testing web form 
application, it is correct sql command and can connect to that datbase and 
insert new reccord.

From this problem, anyone had experiences before? Please kindly suggestion.

Thank you,
Amnouy J.

0
Utf
5/20/2007 2:56:03 PM
crm 35858 articles. 1 followers. Follow

2 Replies
643 Views

Similar Articles

[PageSpeed] 52

Hi Amnouy,

Please check your system event log on the CRM server. If you haven't cached 
the exception, you will find the error causing the problem in there.

I assume you're having a security problem. The callout is running in the 
context of the network service account by default and unless you grant 
proper permissions to this account in your SQL database, you should receive 
an access denied error.

-- 
Michael H�hne, Microsoft Dynamics CRM MVP

Web: http://www.stunnware.com/crm2
Feed: http://www.stunnware.com/crm2/atom.aspx
Custom Lookup Dialog: http://www.stunnware.com/crm2/?area=customLookup

----------------------------------------------------------

"Amnouy" <Amnouy@discussions.microsoft.com> schrieb im Newsbeitrag 
news:A118BDE1-5047-496D-80FE-5E5C174FC345@microsoft.com...
> Hi
>
> I am trying to update another legacy MS SQL database after user insert new
> record in MS CRM system. The way i did is at call out postcreate , i code 
> by
> VS 2003. The coding is starting from setting a connectionsstring to 
> connect
> another database which it is in same server as MS CRM Server, but 
> different
> database name and insert SQL command.
>
> The result is, my call out can't open database connection at all. I tested
> that inserting new record in my local machine with testing web form
> application, it is correct sql command and can connect to that datbase and
> insert new reccord.
>
> From this problem, anyone had experiences before? Please kindly 
> suggestion.
>
> Thank you,
> Amnouy J.
> 


0
Michael
5/20/2007 8:10:03 PM
Hi Michael and everyone,

Here is error from event log:-

Event Type:	Error
Event Source:	MSCRMCallout
Event Category:	None
Event ID:	16912
Date:		5/21/2007
Time:		12:24:44 PM
User:		N/A
Computer:	S-DB-02
Description:
Error: ISV code threw exception: assembly: ContactCallOut.dll; class: 
ContactCallOut.ContactSynToPBM; entity: contact, event: postcreate, 
exception: System.Web.Services.Protocols.SoapException: Server was unable to 
process request. ---> Login failed for user 'CRM_Admin'.

Server stack trace: 
   at 
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String 
methodName, Object[] parameters)
   at ContactCallOut.CallOutService.CallOutService.HelloWorld()
   at ContactCallOut.ContactSynToPBM.PostCreate(CalloutUserContext 
userContext, CalloutEntityContext entityContext, String postImageEntityXml)
   at 
System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(MethodBase 
mb, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, 
Object[]& outArgs)
   at 
System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message 
reqMsg, Boolean bProxyCase)
   at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, 
MessageData& msgData)
   at Microsoft.Crm.Callout.PostCreateDelegate.EndInvoke(IAsyncResult result)
   at Microsoft.Crm.Callout.CalloutHost.PostCreate(CalloutUserContext 
userContext, CalloutEntityContext entityContext)

For more information, see Help and Support Center at 
http://go.microsoft.com/fwlink/events.asp.

Below is my testing sql connection from web service which i called the 
customized web service from postcreate callout.

public string HelloWorld()
		{
			string sConn = "Server=S-DB-02;Initial 
Catalog=EHIM;UID=CRM_Admin;PWD=Password1234";
			SqlConnection conn=null;
			SqlCommand comm = null;

			conn= new SqlConnection(sConn);
			conn.Open ();
			comm = new SqlCommand ();
			comm.Connection = conn;
			comm.CommandText = "SELECT FirstName FROM company_contact";
			comm.CommandType = CommandType.Text ;

			if (comm.ExecuteScalar () == null)
			{
				return "Database Error";
			}
			else
			{
				return comm.ExecuteScalar ().ToString ();
			}

			conn.Close ();
			return "Hello World";
		}

And in CallOut, i call crm web service by declare:-

public override void PostCreate(CalloutUserContext userContext, 
CalloutEntityContext entityContext,
			string postImageEntityXml)
		{
			// Standard CRM Service setup
			CrmService service = new CrmService ();
			service.Url = "http://s-db-02:5555/mscrmservices/2006/crmservice.asmx";
			service.Credentials = System.Net .CredentialCache .DefaultCredentials ;
			service.CallerIdValue = new CallerId ();
			service.CallerIdValue .CallerGuid = userContext.UserId ;

			ContactCallOut.CallOutService.CallOutService integrate_service = new 
ContactCallOut.CallOutService.CallOutService ();
			integrate_service.HelloWorld();
			
		}


Please kindly suggest, i have no ideas where i should fix really.

Thank you,
Amnouy J.




"Michael Höhne" wrote:

> Hi Amnouy,
> 
> Please check your system event log on the CRM server. If you haven't cached 
> the exception, you will find the error causing the problem in there.
> 
> I assume you're having a security problem. The callout is running in the 
> context of the network service account by default and unless you grant 
> proper permissions to this account in your SQL database, you should receive 
> an access denied error.
> 
> -- 
> Michael Höhne, Microsoft Dynamics CRM MVP
> 
> Web: http://www.stunnware.com/crm2
> Feed: http://www.stunnware.com/crm2/atom.aspx
> Custom Lookup Dialog: http://www.stunnware.com/crm2/?area=customLookup
> 
> ----------------------------------------------------------
> 
> "Amnouy" <Amnouy@discussions.microsoft.com> schrieb im Newsbeitrag 
> news:A118BDE1-5047-496D-80FE-5E5C174FC345@microsoft.com...
> > Hi
> >
> > I am trying to update another legacy MS SQL database after user insert new
> > record in MS CRM system. The way i did is at call out postcreate , i code 
> > by
> > VS 2003. The coding is starting from setting a connectionsstring to 
> > connect
> > another database which it is in same server as MS CRM Server, but 
> > different
> > database name and insert SQL command.
> >
> > The result is, my call out can't open database connection at all. I tested
> > that inserting new record in my local machine with testing web form
> > application, it is correct sql command and can connect to that datbase and
> > insert new reccord.
> >
> > From this problem, anyone had experiences before? Please kindly 
> > suggestion.
> >
> > Thank you,
> > Amnouy J.
> > 
> 
> 
> 
0
Utf
5/21/2007 4:57:00 PM
Reply:

Similar Artilces:

cannot create profiles in win 7 mail 32 bit
I upgraded to WIndows 7 professional 64 bit and still cannot get my MS Office 2003 to work properly. All the programs except Outlook seems to work fine. I am totally unable to open outlook without mail profiles. I click on mail in control panel and I get low memoery or resources too low. That's impossible. I have 4GB RAM and 1GB VRAM. In addition, I noticed to night that while I created a profile for myself as Admin, I do ot have admin permissions EVEN IF I say 'run as admin" If I open my profile, it syas Admin under my name yet shows up as standard user. I...

Price from database does not showup correctly in POS
When I try to ring up items in the POS the sale price of some items does not showup correctly in POS. It shows a totally different sale price which is sometimes less or sometimes more than the sale price in the database. I always bachup my database and also refresh the Sql server but the problem continues. Does anybody has a solution to this. Regards, Nitin Try reindexing the DB in SO Administrator - Database/Reindex Other than that, can you provide more details? Have you set up customers with Discount Percentages or Price Levels? -- Glenn Adams Tiber Creek Consulting http://www.t...

Designing Report Troubles
Hi, We just tried to customize a report with Visual Studio 2003 We followed the instructions from the book Working with Dynamics CRM 3.0 from MS Press. We downloaded the reports, we set up a project,.. ... not made any changes yet .. ... but the report is not able to preview and brings up the following error "No connection to Adventure_works_cycle" even we made a connection to sa .. and the connection was tested successfully. Why is the report drying to use a database that is not installed? (I know what the adeventure works cycle database is :-)) Why is AWC named in the "...

!!HELP!!! Cannot connect to Exchange Server from a RDP, ICA session or server local machine
Please excuse the posting as I wasn't sure which group to post this in. I'm having issues using Outlook from a server desktop, an RDP or ICA connection. I have remote users who connect using Citrix. They logon to the Citrix server desktop (Windows 2003 Server) and use Outlook from there. They can also use Outlook from within Citrix as it is a Published Application. I know some of you are going to suggest why don't they use OWA but let's not get into that. I can log onto any workstation here in the office and connect to the Exchange server and open their Outlook. What I and they...

Connect/work offline/cancel message
In outlook 2003 connecting to SBS/Exchange 2003 server, get message: Exchange is currently in recovery mode you can connect, work offline, or cancel. This is only happening in a few computers on the network after implementing SBS 2003 with Outlook and Exchange 2003. ...

Creating a table
There's probably an easier way to do it but... I have a series of numbers in column A (150 in all) and a series of letters in column B (22 in all). In total there are 4800 rows. What I am trying to do is create a table with the number down the left hand side and the letters across the top. In each cell within the table I need to count how many times the combination of number/letter appears. Eg: A B C 201 0 2 2 202 3 0 1 203 3 6 4 I tried combining the number/letter into a single text field using the CONCATENATE function then filtering ...

Creating a letter from template
Is it possible in CRM? So far the only way i figured out to use templated is in an email and /KB-article. (And order offcourse) The thing i'm looking for is when selecting a contact, somehow i can make a letter activity and call a template that puts name & adress data etc. After that i should be able to print the letter, to put it in an enveloppe and send it someplace... So far it seems to me this cannot be done, but then again, i'm certainly not a CRM expert... Is it possible? If so, can anyone provide me the actions to be taken step by step ? thanks Kas "_Kas_&...

Simple Question-How to create more than one transaction on the Acc
If there is a question already posted let me know. The question is: I created a bank account information on the Account list icon and want to have more than (one)transactions listed and see each payee displayed separately on each page so i could have all the months posted with due dates and total listed. Thank you. In microsoft.public.money, a.j. wrote: >If there is a question already posted let me know. The question is: I created >a bank account information on the Account list icon and want to have more >than (one)transactions listed and see each payee displayed separately ...

Internet connection problem
Hi. I hope someone is able to cast some light on a problem. We have a home network (all computers running XP) some wired and some wireless. For about a month now we have intermittent connection problems in that any one computer (randomly) will not connect to internet. I think all of the computers have suffered from the problem. Rebooting the affected computer makes no difference but rebooting the router can sort it until the next time. Even my mobile phone occasionally cannot connect. In Firefox the message is just "server not found". Pinging an IP address results in a time...

Somehow I created a Macro in a worksheet.
I created a macro in an Excel worksheet somehow. I didn't try to, it just happened. Now everytime I open that workbook, it asks me if I want to run the macro, disable it, etc. How the hell do I get rid of the macro? It doesn't show up under tools, macros. And it apparently doesn't do anything either because I can disable it and nothing different happens. Who invented this system anyway? Thanks, V When you record a macro, a module is created to store the macro code. There are instructions here for removing the module that is causing the prompt to appear: http://www.c...

Email accounts are not created for new user
I had a severe system crash several days ago because of bad memory in my domain controller (Server 2003 R2)/Exchange server 2003 (small site - no extra systems). I had to reinstall Exchange 2003 and reload the exchange store from backup. For existing users everything works great. Everybody can send and receive email, the calender works correctly, etc. OWA works. However, when I create a new user account in Active Directory Computers and Users, the account is created and the new user can log onto a system. However, Outlook 2003 cannot be configured to use the exchange server. In t...

email address on Service Call Entry window
Add an email address field to the Service Call Entry window for the customer contact on the service call. Even if it is not pulled from the email address of the address id on the service call, at least the dispatcher could enter an email address on the service call in order to communicate with the customer regarding the call. It is common to take email address as part of contact information. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the m...

Error creating new task
Error .. "Could not complete operation. One or more parameter values are not vaild" ...

we do not create seperate http virtual server anymore?
Hi all, Just want to confirm that we do not need to create the seperate http virtual server for FE/BE (backend two node A/P Exchange 2003 cluster), right? I remember I need to create it in Exchange 2000 FE/BE clustering envir. Thanks in advance. On Wed, 2 Aug 2006 11:44:26 -0700, John <John@discussions.microsoft.com> wrote: >Hi all, > >Just want to confirm that we do not need to create the seperate http virtual >server for FE/BE (backend two node A/P Exchange 2003 cluster), right? I >remember I need to create it in Exchange 2000 FE/BE clustering envir. > >...

create main configuration file for solution.
Hello. How can I create main configuration file for my solution (Win-Form : VS 2008. VB.NET), like a general ini-file. Thanks :) "Mr. X." wrote: > Hello. > How can I create main configuration file for my solution (Win-Form : VS > 2008. VB.NET), like a general ini-file. > It's called an app.config. There is a name space you can use to mainulupate the app.config from a program. I see it on the project source directory (not for solution). I cannot see it on the release directory. Is there any convention to read / write from app.config...

Creating Contacts For Accounts Using...
Hopefully as Microsoft CRM matures, many small time saving features will be added. One that should be a priority is the ability to add a new contact for an existing account using the common account information, i.e. address, phone number, web address, etc. Retyping the same company address in each time is not very productive. Thank you, Ed Podowski ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, f...

How to create an "and" rule in Query Based Distribution Groups
Hi, With Exchange 2003 Query Based Distribution groups, is it possible to create an "and" rule? ie, all users who are based in "London" "and" have the first name "John"? Thanks, Curtis. -- Please reply to news group only. Thank you. Sure. (&(attribute1=blah)(attribute2=blah)) http://msdn.microsoft.com/library/en-us/adsi/adsi/search_filter_syntax.asp?frame=true -- Bharat Suneja MCSE, MCT www.zenprise.com blog: www.suneja.com/blog ----------------------------------- "Curtis Fray" <xxx@xxx.com> wrote in message news:OjVc...

Create individual files from a row
I have an excel file with several thousand entries, which contain data in several columns. I would like to be able to create an individual xml or html file for each row, but with predifined formatting around so Mr A bloggs, A street, A town, AA1 1AA Could become Abloggs.html <head></head> <name>Mr A bloggs</name> <street>A street</street> Any other info here as well </html> etc. Is this possible and any suggestions how? thanks, Graham. -- GrahamN ------------------------------------------------------------------------ GrahamN's Profile: ...

Cannot create mailbox for new user accounts
I am running Exchange 2003 on Server 2003. I was able to move all existing mailboxes from my old Exchange 2000 server to my new 2003 server. Whenever I try to create a new user it creates the user normally and asks if I want to create a mailbox for the user. I check yes, and it says account created successfully. However, the mailbox never appears in Exchange, no email address is assigned to the new user, and I cannot send mail to the user account either. If I try to access any Exchange properties from ADUC it shows everyhting as if a mailbox exists, but there is no mailbox. I am ...

WdfUsbTargetDeviceCreate creates NULL Control Pipe Handle
Hi, We have a usb composite device which has one mass storage interface and another as a network interface. We are developing a WDF driver (NDIS-USB) for the network interface. Immediately after WdfUsbTargetDeviceCreate if I break into the debugger and examine the newly created device, then I see that the Control Pipe Handle is NULL! Here is the actual output: -------- kd> !WDFUSBDEVICE 0x0000057f`fe5905f8 WDFUSBDEVICE 0000057ffe5905f8 ============================= Config descriptor fffffa80037216b0, device descriptor fffffa8001a6fb58 Control USBD_PIPE_HANDLE 000000000000...

Scroll horizontaly with mouse, create same system used to scroll .
Hi, I think it would be great if mouses adopted a second scroll button, for horizontal scrolling, just like the vertical one .... Indeed, when you work with wide Excel spreadsheets, you can easily scroll down but to scroll from left to right or vice-versa, you have to use the scroll bar or arrows and it's annoying... So, am I a millionnaire yet??? Hi Frederic, > I think it would be great if mouses adopted a second scroll button, for > horizontal scrolling, just like the vertical one .... Indeed, when you work > with wide Excel spreadsheets, you can easily scroll down b...

3rd party server for connection okay?
We had a network guy come in and try to configure our network - 3 stores and HQ in seperate locations. Because of our router and dsl configuration, vpn would not work. He set up an outside ip address (dnsdyn.org) in order to have the stores and HQ talk. Still not working! ARGH!!!!!!! In the store it shows a connection but then states invalid store id. The store id is correct. In the HQ client the address is the ip address of the outside source and the port? Anyone know why this isn't working and have any suggestions???? Thank you! Are you sure the Store ID is correct? Does the messa...

Creating a print-macro that'll only print page 1?
Hi, I have a spreadsheet that contains multiple sheets. I want to add a button that runs a macro, which only prints page 1 on the first sheet (called Scorekort). The "Scorekort" sheet contains 13 pages in total, but I only want to print the first page. Any ideas for this macro? Anders hi, Sub Macro1() Sheets("Scorekort").PrintOut From:=1, To:=1, Copies:=1, Preview:=True, Collate:=True End Sub if you don't want a print preview, Preview:=False -- isabelle Le 2011-05-21 04:16, Anders M a �crit : > Hi, > > I have a spreadsheet that contains multiple ...

How do I create custom postcards in Word 2007?
I want to create my own postcards using the right size and type of paper for mailing. This depends entirely on your printer. Can it handle the heavy weight of card used in postcards, and can it handle the unusual size of a postcard? On Apr 18, 2:54=A0pm, Create Custom Postcards <Create Custom Postca...@discussions.microsoft.com> wrote: > I want to create my own postcards using the right size and type of paper = for > mailing. Perhaps the easiest way to start is to get some Avery (or similar) postcard stock, which will have two postcards per sheet. Then find the a...

Close Event for the Database (?)
Is there a close event for the database? I have forms referencing other forms, and if the user closes Access without backing out of the forms, an error message pops up. It would be hand to just trap that error in an "On close" event for the entire db. Of course that might be a horrible thing when other errors are happening on close.... -- croy ...