In the Data Environment, you can setup the connection via accessing the Properties of the connection.
From there, you can choose the provider, the server name, and the database (I am using SQL Server 2008, by the way).
However, I see a problem in this since the connection string cannot be altered anymore once deployed. Therefore, I set the connection string of the Data Environment Connection during log on.
With deMain.conn1
.ConnectionString = connString
End With
where connString is a global variable containing the connection string that is read from a .ini file.
I ran the program and encountered the following error:
I figured it out. In the Properties window of the Data Environment Connection, you must select first the correct Provider and click Next.
In the Connection tab, you don't have to fill-out the fields anymore.
Related
I'm having an issue making a proxy database connection to an ORACLE database using ODP.net. I need my program to attempt the proxy connection but then prompt me for my certificate and authenticate me with that.
I have a Perl script that does this and it only requires me to specify the name of the TNS entry and the user I want proxying in for me.
I also have my SQL Developer doing the same thing, pointing to the same TNS entry.
But when I try to attempt the same approach with ODP.NET it just gives me the ORA-12154 error, "TNS: Could not resolve the connect identifier specified."
From my limited knowledge of Oracle I ASSUME that the error means that it couldn't find that TNS entry. And I've verified that the entry DOES exist in my tnsnames.ora file and proved I could proxy to it via my Perl script and SQL Developer. Even put a breakpoint in my VB code to ensure I was specify the correct TNS Entry.
I've even stripped down the connection string to JUST the datasource to see what error I get. So I'm not sure if I have the connection string wrong or if it needs to be in a different format. But I DO know that the solution HAS to allow me to specify the TNS alias and the connection HAS to prompt me for my certificate. No password.
So I guess I'm trying to find out what the appropriate connection string would look like to do this and why .NET can't seem to figure out what this TNS alias is.
I've tried setting the USER ID attribute to the account I want proxying for me, set the PROXY USER ID attribute the same way as well as also tried "/", set the DATA SOURCE attribute to the TNS alias.
This program will be deployed to four different environments that have the same TNS alias in them but point to different servers. So I really need to be able to specify the TNS alias.
Getting following exception two week once in PROD, when calling azure function from core api 3.1.
Below issue occurred when establishing the connection with oracle DB using ADO.Net. especially when executes the conn.open().
OracleConnection conn = new OracleConnection(connStr);
conn.Open();
OracleCommand cmd = new OracleCommand(strSQLQuery, conn)
{
CommandType = CommandType.Text
};
OracleDataReader odr = cmd.ExecuteReader();
Once restarted the app service from azure portal, it would be resolved.
Error - ora-12545 network transport unable to resolve connect hostname.
Please check if below can be worked around.
If you are using the tnsname.ora,Please make sure its configured
correctly. Check tnsname.ora file for prod and check for
servername,See if the prod listener exists in listener.ora file, it
must be missing.So try to add the listener for prod environment similar to dev
,if present.
If the Connection string had DNS name, try replacing it with IP
address. Try to use user service name as they have different names for
product and dev separately which can be useful even if SID is same
(in some cases).Always Ensure that the host field of the local_listener is
properly set to a name which can be resolved by the Oracle client.
Or
Try to update host files to contain the requird server and host port.
Go to
\etc\hosts . Insert server name and
server IP in here and save.
Also check the .net version , it may be incompatible sometimes,
maybe that’s why , after restarting ,its setting itself and the
problem is resolved in azure app service.or Some times issue maybe
due to firewall being restricting in azure portal.
You can raise a support request from overview page from troubleshoot blade ,if the issue still remains.
Reference:
oracle - Stack Overflow
I followed the link http://mobileworld.appamundi.com/blogs/andywigley/archive/2008/12/08/building-a-sync-services-for-ado-net-solution-for-mobile-devices.aspx
and was able to sync DB.
Problem is that it is only for static connection string and Server IP where SQL server DB is located which i provided through designer wizard.
now i want to change the connection string and Server IP as provided in some file.So that user can change the Server DB location and synchronize.I don't know how to proceed.Please Help
In the tutorial the MiddleTierServiceLibrary project has an App.Config file with the DB connection string. You can set the DB connection there.
I press add connection in database explorer then put the server name which is Rabbitmasterpc
windows Authentication, attach a database file: --> I browse to the database i attached.. give it a logical name..click 'ok'. And what I get:
"A network-related or instance specific error occured while
establishing a connection to SQL Server. The server was not found or
was not accessable. Verify that the instance name is correct and that
SQL Server is configured to allow removte connections. (provider:
Named Pipes Provider, error:40- Could not open a connection to SQL
server)"
UPDATE:
http://www.mssqltips.com/tip.asp?tip=1673
The article says it is in facets..but i dont have it inside
Check if SQL Server is configured (via SQL Server Configuration Manager) to accept remote connections.
Also, you may need to check the Connections property page for your database in Management Studio, as well as firewall settings:
http://blogs.msdn.com/b/walzenbach/archive/2010/04/14/how-to-enable-remote-connections-in-sql-server-2008.aspx
Try using code below to open the connection.
Try
Dim objconnection As SqlConnection = New _
SqlConnection("Server=localhost;Database=DATABASENAME;" & _
"user ID = YOURUSERID; password = YOURPASSWORD;")
objconnection.Open()
objconnection.Close()
MessageBox.Show("Database Connection Success")
Catch ex As Exception
MessageBox.Show("Database Connection Error: " & ex.Message)
End Try
I have a web site developed locally with a local Sql Server database. I also have a web host that provides one Sql Server database for my site. Now I want to deploy the application, and I would like to be able to manage the remote database from the Server Explorer in Visual Studio. I have the connection string used in the application, which works fine for adding, say, a datasource to a control etc. But I don't know if there's any way to use it to connect the database inside the Server Explorer so that I can add tables etc. I have read that you're supposed to be able to this instead of using the Sql Server Management Studio, but I have'nt read anything about how to connect to the remote database in it.
What I have tried so far is this: I have selected Add database in Server Explorer. This brings up first a dialog where I choose Sql Server. And then I get a dialog where I can set Server name (which I tried using the ip address in the connection string below), and Authentication (where I chose Sql Server Authentication, with the user id and password from below). But when I test the connection it fails.
Here's the connection string, which works fine when used for datasources in the application (obviously with different user name and password):
Any help appreciated!
EDIT:
Well, I've done everything suggested by lewiguez below now, but it doesn't make any difference. I can't believe this should be so hard... I keep getting this error message in Sql Server Management Studio:
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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 53)
Here's the process I follow for working with remote databases:
In VS 2008 under the Server
Explorer tab, right-click on "Data
Connections" and then click "Add
Connection"
Change the Data Source to
"Microsoft Sql Server"
Put in your fully-qualified
"Server Name" (be it IP Address, domain name, etc.), select "Sql Server
Authentication" and put in "User
Name" and "Password" for the database user
Select the database you want to connect to under "Select or enter a database name"
Hit "Test Connection" to test and then "OK" to accept
You should be able to interact with the database at this point by expanding the connection and then the "Tables" folder. For example, right-click on the Tables folder and you'll be presented with an "Add Table" option in the dialog. Right-clicking an existing table will bring up the "Open Table Definition" options where you can change any columns, etc.
If you're not getting to this point (and it sounds like you're not), I'd recommend checking your Sql Server connection from whatever machine you're using.
I generally do this by going into the Management Studio and connect with whatever credentials I'm trying to use. If they don't work, make sure they are, in fact, added as a Sql Server user and a database user (they have to be both).
Also, I would check in the Sql Server Surface Area Configuration Manager. You have to allow TCP connections and you have to be set up to allow Sql Server Authentication connections as well from remote hosts. If THAT'S all set up, but you still can't connect, I'd double-check to make sure your firewall is allowing Sql Server connections. The default port is 1433.
Also, if you can connect, but then can't write to anything, double-check your table permissions. Hope this helps!
I finally understood the problem: as I suspected the settings in my own installation was not the problem, but rather it was the settings on the Sql Server installation on my web host. And in fact I found a place in the control panel on my web host where I could set an exception to my ip address so that my ip would be granted access to the port 1433 for Sql Server, which is otherwise closed by default for security reasons.
I've had no luck finding any information about this at all on the internet, which I find strange. All the information I could find had to do with changing these settings on your own local installation of Sql Server. But I'm sure there are loads of people out there who like me use a web host for deploying their web site, and then that info doesn't seem to apply. (Perhaps apart from the TCP setting, which I think must be set, and there's detailed info about that here: http://www.linglom.com/2009/03/28/enable-remote-connection-on-sql-server-2008-express/ )
Hope this helps someone else who like me uses a web host. Now everything works fine for me at least, both in Management Studio and in Visual Studio Server Explorer.