INFORMIXSERVER does not match either DBSERVERNAME or DBSERVERALIASES - c#

I have installed the Informix Client SDK. Then I created a simple .net console application referencing IBM.Data.Informix.dll. When I call IfxConnection.Open() it throws an exception.
ERROR [HY000] [Informix .NET provider][Informix]INFORMIXSERVER does
not match either DBSERVERNAME or DBSERVERALIASES.
sqlerrm(database)
I have seen this post and I can't seem to find the sqlhosts file in the client machine. Also I can't the environment variables mentioned the post as well.
So my questions are:
How to create the sqlhosts file and where will it be saved? Will this be in the database server or client machine or both?
What are the environment variables needed?

In a Windows machine the needed configuration is defined by the Setnet32 utility (installed with the Informix Client SDK). You need to set your Informix instance values in that utility for the connection provider to work (Informix .NET Provider).
First define your "Host Information" in the third tab and then click apply (btw I'm in a spanish Windows machine!):
Note: The "Current Host" value should be added to your hosts Windows file (%WINDIR%\System32\drivers\etc\hosts).
Afterwards, define your "Server Information" in the second tab:
IBM Informix Server is your Informix instance name (INFORMIXSERVER).
Hostname is populated with the hosts defined in the previous step (third tab).
Protocolname is the protocol used to communicate with your server (if you're using an unsecured TCP connection, it could be 'olsoctcp' or 'onsoctcp'. Refer to the official documentation to check which value to use).
Service name is the name used for your server communication service, which should be added to your services Windows file (%WINDIR%\System32\drivers\etc\services)
After these changes you should be able to run your .NET application. Obviously your connection string values should match the information defined in this utility.

Related

C# - Named Pipes Provider, Error: 40 - local access

I developed a windows application on another system, SQL Server was located somewhere on another server, standard instance, data access was not a problem at all.
Now I have to do some work on the application on my own system, where I have a Standard SQL Server on the same machine and an identical copy of the database. The database is perfectly accessible from the outside, testing the connectionstring from C# succeeds. I tried access using my windows user as well as SQL authentication using sa and its password. All test succeed, but when I try to run the application it fails giving the error message:
...Named Pipes Provider, Error: 40..
I am using SQL Server 2019, standard port, all protocols activated. The users I tried are sysadmins (since I only want to make some modifications to my application, security is not important at the moment).
It looks as if I had no local access to my database from a C# application - I am using Office 365. Any idea what I can do to make my application work locally?
Thanks so much!
Check this troubleshooting guide from MS even when it says it's for connecting to instances on a different host.
If you already validated that all protocols are enabled, you should check the connection string you're using. You can try the following:
Specifying localhost or the host name will use shared memory so you shouldn't get any error related to named pipes.
Use the pipe path (you can find it in the SQL Server Configuration Manager - > SQL Server Network Configuration -> Protocols for -> Named Pipes -> Properties -> Pipe Name
Use the IP of the host and specify the port number (1433 if it's the default one)

Network naming: no LDAP server detected or configured

I am trying connect existing oracle database of existing project using asp.net. I have direct access to the oracle database.But for now I have created a simple table in the existing live oracle server and I am trying to connect to that server by creating a simple registration page in asp.net.
I am totally new into oracle and its configuration. I need to know the steps to connect my current asp.net application (login page and registration page). I am not using anything else other than visual studio 10 and oracle server (same error after trying to connect on local oracle server 11g)
The error message/exception i am getting is "Network naming: No LDAP server detected or configured"
What I have tried?
I have changed the connection string in the back end i.e the xyz.aspx.cs file, i have not made any changed in the web.config file.
I resolved this error by copying my ldap.ora (and other config files) over to where tns.ora file sits by default as described here:
if I select tns as connection type in Add Connection dialog box that's
when I come to know about tns file's default location.
I had the same problem with vs.net 2019.
Error when creating db. conn. in IDE: Network naming: no LDAP server detected or configured. I resolved it by removing LDAP from sqlnet.ora file, from NAMES.DIRECTORY_PATH param.

Access ASP.NET with database running on localhost through LAN

I am using Microsoft Visual Studio 2013 Ultimate.
I have one C# application connected with WSN to collect and save all sensor readings in database. It is working fine and stable.
Later I decided to add ASP.NET application (developed in the same software) so other computers in LAN can access my page and check measurements. I have one web form with few labels and buttons to ensure move forward and backward through the database table. It is working fine when I start it from Visual Studio but when I am trying to access from IIS it does not work.
I have this error (main part of the text):
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.
I have installed IIS and I can access "localhost" from my browser (IIS image appears). I published site with "Publish" option from Visual Studio.
I saw a few very similar questions on this forum but I did not find answer. Can you recognize what can be the problem?
Regards.
I think DeanOC's answer will apply if you are using your windows login to connect to sql server (in connection string you'll have Integrated Security=true) in which case:
In IIS select you web application on the righ side click Advanced Settings a dialogue box will pop up in it you can see which application pool your website is using
Close dialog go to Application Pools, right click the application pool you want and go advanced settings
Change the Identity of the application pool, under Process Model, to your current windows login.
http://www.codeproject.com/Articles/674930/Configuring-IIS-ASP-NET-and-SQL-Server
Everything is well explained. Just follow the procedure and it will be - Yeah, solved. :)
The message implies that either sql server instance you are pointing to is not running or that you are pointing to the wrong sql server instance. If you are able to run the application from visual studio then sql server should be running and that would imply that your connection string is wrong.
During publish, msbuild will run config transforms i.e. if build profile is set to release it will change the connection strings in web.config to those in web.release.config. Check your connection strings in the IIS website and also check you password is correct
You could enable TCP/IP in SQL Server Configuration.
Microsoft SQL Server xxx -> Configuration Tools -> SQL Server Configuration Manager -> Select TCP/IP. Right click and select enable
Therefore, you can connect successfully from your local computer but it fails when you access from IIS of other server.
I think you are trying to access the web page from another computer in the network and not sql server in which case you have to add a binding to your site. By default the site is only bound to localhost port 80 meaning it will only be accessible from within the same machine. You'll need a url with dns entries or a static ip address to use to connect to your machine. Check out IIS bindings:
http://blogs.technet.com/b/chrad/archive/2010/01/24/understanding-iis-bindings-websites-virtual-directories-and-lastly-application-pools.aspx
http://technet.microsoft.com/en-us/library/cc731692(v=ws.10).aspx
because you used attach Mode in this way when one of them is connected to your database other one cannot use it like open file. and only the one who is in the same sever could access to your database.
to solve this problem you have to add your database to your SOL server manager after that you could access to it from many devices use
this connection string
Data Source='server IP';Initial Catalog='database name';Persist Security Info=True;User ID='your user name';password='your password'
please follow this video
enter link description here

How to deploy a Windows forms project with a database connection to some other machine?

I have a small demo windows forms application, which has 2 forms.
enter a name in the first form, which will add the name to a table in the database. The back-end used is SQL Server 2008.
After successful entry in the database, the user is prompted to the second form, which is basically a demo calculator.
My question is how can I deploy this project to some other machine. Wana create a normal executable file, in the other machine.
I was able to deploy one another windows forms app, which was without a SQL database connection, by using the Setup and Deployment wizard of the VS 2008.
Also, does the other machine would have to have certain prerequisites, like presence of SQL server in it?
I googled... found some MSDN links but could not find meaningful results.
Any assistance or an external pointer to this scenario would be highly appreciated.
You can get connections string using ConfigurationManager and set connection string in app.config.
Getting connection string from app.config example:
string connStr = ConfigurationManager.ConnectionStrings["myConnStr"].ConnectionString;
After deploy you application you can change app.config manually or make in your app simple form for set connection string.
You could try adding a Setup Project to your Solution and relay on the automatic dependency detection that it brings to build an MSI setup kit for your application that would bundle any dependencies. Not sure about the SQL Server though...
Since it needs a DB for its execution, you have to provide a sql server instance for it. This can be any of these below mentioned
a dedicated SQL server on the network
SQLServer installed on any one of the machines on the network and configured correctly for accepting connections from other machines on the network
SQL Server local instance installed on the second machine if the second machine is not on the network or the program is independent of the network.
AFAIK, for deployment you can copy exe (built after proper connectionstring configuration) or you can rely on setup project

Siebel DB question

One of my client has a Siebel program installed and a .DBF database. I'd like to know if it's possible to make requests directly to this "db file" within a c# application?
Do I need to install Siebel on my dev machine too?
Thanks!
UPDATE
It worked. You'll need some dll and a EXE file :
• dbctrs8.dll
• dbcon8.dll
• dbserv8.dll
• dbodbc8.dll
• dblgen8.dll
• dbeng8.exe
(this is from Siebel 7, but you'll be able to find what dll you'll need because you'll get an error anyway).
You'll need a computer that has Siebel installed and "copy" the ODBC connection parameters from it. So, go to that computer and go to run, execute, odbcad32. Find the ODBC connection, check the parameters (you'll see the main dll + other parameters). Then go to the target computer and add an ODBC connection with the same parameters.
If the "ODBC Driver" is not available, you'll need to install it manually. I followed the procedure there :
http://www.developer.com/db/article.php/3712461/Installing-a-Custom-ODBC-Driver-on-Windows-for-SQL-Anywhere.htm
The dbf is an instance of a local SQL Anywhere database, so you could connect to it via the Siebel Local database driver - or install Siebel Dedicated Web Client and grab the controls that will appear in your C# IDE.

Categories