Connect to Informix using C# from windows server
Posted in 2015
Larry Kotur couldn't connect to IDS from a C# web app using Client SDK 4.10.TC5 and an IBM.Data.Informix connection string stored in web.config, despite ODBC connections working fine. Suggestions from the list were that his connection string format was wrong: rather than combining host and port as "server=IP:port", he should use separate keywords, e.g. Database=...;Host=...;Server=<servername>;Service=<port>;Protocol=onsoctcp;UID=...;Password=.... No confirmation from the original poster that this fixed it is recorded in the thread.
Auto-generated by DrWatson from the posts below — may be imperfect; read the full thread.
Topics: Installation, Setup & Upgrades, Platform-Specific Issues
I have installed Client SDK 4.10.TC5, added a connectionstrings to the web.config file (using the format supplied by Client SDK in ..\\\\demo\\\\dotnetdemo\\\\quickstart\\\\cs\\\\conninfo), used gacutilt to add IBM.Data.Informix.dll to the global assembly cache In the C# code the connectstring from web.config is referenced but I am not getting a connection to the IDS server. Has anyone used this method of connection and have it work> And if so how did you do it? Thanks, Larry Kotur
What no takers? Any help would be appreciated. IBM was no help whatsoever!
This is a type of connection string we use for Informix. It's ODBC, so if you were to take this as an example, you would have to create an ODBC data source and point to it: <add name="connectionName" connectionString="Dsn=ODBCNameYouCreated" providerName="System.Data.Odbc"/> --EEM > -----Original Message----- > From: ids-bounces@iiug.org [mailto:ids-bounces@iiug.org] On Behalf Of > LARRY KOTUR > Sent: Thursday, June 25, 2015 14:28 PM > To: ids@iiug.org > Subject: Re: Connect to Informix using C# from windows .... [35324] > > What no takers? > > Any help would be appreciated. > > IBM was no help whatsoever! > > > *********************************************************************** > ******** > Forum Note: Use "Reply" to post a response in the discussion forum.
Everett, ODBC works fine and that connection string is OK. I am attempting to use the file web.config for the connection information in a C# program. web.config is an xml file and I am using the connection string as supplied by IBM and several variations suggested by IBM support but to no avail <?xml version="1.0" encoding="utf-8"?> <configuration> <system.web> <customErrors mode="Off"/> <authorization> <allow users="Operations\\\\website" /> </authorization> <pages> <namespaces> <add namespace="System.Web.Optimization" /> </namespaces> <controls> </controls> </pages> </system.web> <system.webServer> </system.webServer> <connectionStrings> <add name="testconn1" providerName="IBM.Data.Informix" connectionString="database=vonroll;server=172.xx.x.x:xxxxx;uid=userid;password=o nly4me;" /> </connectionStrings> </configuration> In the C# program the reference is to "testconn1" for the database open and it is not connecting. This is not an ODBC connection. Larry
Maybe needs the port as well ? Cheers Paul > Everett, > > ODBC works fine and that connection string is OK. > > I am attempting to use the file web.config for the connection information > in a > C# program. > > web.config is an xml file and I am using the connection string as supplied > by > IBM and several variations suggested by IBM support but to no avail > > <?xml version="1.0" encoding="utf-8"?> > > <configuration> > <system.web> > > <customErrors mode="Off"/> > > <authorization> > > <allow users="Operations\\\\website" /> > > </authorization> > > <pages> > > <namespaces> > > <add namespace="System.Web.Optimization" /> > > </namespaces> > > <controls> > > </controls> > > </pages> > </system.web> > <system.webServer> > > </system.webServer> > <connectionStrings> > > <add name="testconn1" providerName="IBM.Data.Informix" > connectionString="database=vonroll;server=172.xx.x.x:xxxxx;uid=userid;password=o nly4me;" > /> > </connectionStrings> > > </configuration> > > In the C# program the reference is to "testconn1" for the database open > and it > is not connecting. This is not an ODBC connection. > > Larry > > > ******************************************************************************* > Forum Note: Use "Reply" to post a response in the discussion forum. > -- Paul Watson Tel: +1 913-674-0360 Mob: +1 913-387-7529 Web: www.oninit.com Oninit® is a registered trademark of Oninit LLC Failure is not as frightening as regret. If you want to improve, be content to be thought foolish and stupid. What this country needs are more unemployed politicians
Hi, Try this: Database=DATABASE;Host=HOSTNAME;Server=SERVERNAME;Service=PORTNUMBER;Protocol=on soctcp;UID=USERNAME;Password=PASSWORD; Best Regards On Fri, 26 Jun 2015 at 16:36 Paul Watson <paul@oninit.com> wrote: > Maybe needs the port as well ? > > Cheers > Paul > > > Everett, > > > > ODBC works fine and that connection string is OK. > > > > I am attempting to use the file web.config for the connection information > > in a > > C# program. > > > > web.config is an xml file and I am using the connection string as > supplied > > by > > IBM and several variations suggested by IBM support but to no avail > > > > <?xml version="1.0" encoding="utf-8"?> > > > > <configuration> > > <system.web> > > > > <customErrors mode="Off"/> > > > > <authorization> > > > > <allow users="Operations\\\\website" /> > > > > </authorization> > > > > <pages> > > > > <namespaces> > > > > <add namespace="System.Web.Optimization" /> > > > > </namespaces> > > > > <controls> > > > > </controls> > > > > </pages> > > </system.web> > > <system.webServer> > > > > </system.webServer> > > <connectionStrings> > > > > <add name="testconn1" providerName="IBM.Data.Informix" > > > > connectionString="database=vonroll;server=172.xx.x.x:xxxxx;uid=userid;password=o nly4me;" > > /> > > </connectionStrings> > > > > </configuration> > > > > In the C# program the reference is to "testconn1" for the database open > > and it > > is not connecting. This is not an ODBC connection. > > > > Larry > > > > > > > > ******************************************************************************* > > Forum Note: Use "Reply" to post a response in the discussion forum. > > > > -- > Paul Watson > Tel: +1 913-674-0360 > Mob: +1 913-387-7529 > Web: www.oninit.com > > Oninit® is a registered trademark of Oninit LLC > > Failure is not as frightening as regret. > If you want to improve, be content to be thought foolish and stupid. > What this country needs are more unemployed politicians > > > > ******************************************************************************* > Forum Note: Use "Reply" to post a response in the discussion forum. > > --001a11c23d04495b4505196dbcef
So you were looking for something like this: <add name="myDBConnectionString" connectionString="Database=myDatabase;Persist Security Info=True;Password=thePassword;Server=theServer;Service=sqlexec;User ID=userID" providerName="IBM.Data.Informix" /> I think the problem you're having is that you tried to put both the host ID (in your case IP address) and service/port together, "server=172.xx.x.x:xxxxx". Try it like this: "server=172.xxx.xxx.xxx;service=xxxxx". --EEM > -----Original Message----- > From: ids-bounces@iiug.org [mailto:ids-bounces@iiug.org] On Behalf Of > Paul Watson > Sent: Friday, June 26, 2015 10:36 AM > To: ids@iiug.org > Subject: Re: RE: Connect to Informix using C# from wind.... [35343] > > Maybe needs the port as well ? > > Cheers > Paul > > > Everett, > > > > ODBC works fine and that connection string is OK. > > > > I am attempting to use the file web.config for the connection > > information in a C# program. > > > > web.config is an xml file and I am using the connection string as > > supplied by IBM and several variations suggested by IBM support but > to > > no avail > > > > <?xml version="1.0" encoding="utf-8"?> > > > > <configuration> > > <system.web> > > > > <customErrors mode="Off"/> > > > > <authorization> > > > > <allow users="Operations\\\\website" /> > > > > </authorization> > > > > <pages> > > > > <namespaces> > > > > <add namespace="System.Web.Optimization" /> > > > > </namespaces> > > > > <controls> > > > > </controls> > > > > </pages> > > </system.web> > > <system.webServer> > > > > </system.webServer> > > <connectionStrings> > > > > <add name="testconn1" providerName="IBM.Data.Informix" > > > connectionString="database=vonroll;server=172.xx.x.x:xxxxx;uid=userid;p > assword=only4me;" > > /> > > </connectionStrings> > > > > </configuration> > > > > In the C# program the reference is to "testconn1" for the database > > open and it is not connecting. This is not an ODBC connection. > > > > Larry > > > > > > > *********************************************************************** > ******** > > Forum Note: Use "Reply" to post a response in the discussion forum. > > > > -- > Paul Watson > Tel: +1 913-674-0360 > Mob: +1 913-387-7529 > Web: www.oninit.com > > Oninit(r) is a registered trademark of Oninit LLC > > Failure is not as frightening as regret. > If you want to improve, be content to be thought foolish and stupid. > What this country needs are more unemployed politicians > > > *********************************************************************** > ******** > Forum Note: Use "Reply" to post a response in the discussion forum.