I have installed Oracle 10g in one of my office's computer. I want to keep this as database server. I am developing a .net project which will communicate with the database server from client machine and from the server machine. I success to communicate with oracle from server machine but not from client machine using the .net project. The connection code is as follows:
Public OraConn As ADODB.Connection
OraConn = New ADODB.Connection
OraConn.Provider = "OraOLEDB.Oracle"
OraConn.ConnectionString = "Data Source=<my_database_name>;User ID=<my_user>;Password=<my_pass>;"
OraConn.Open()
Please tell me step by step procedures how can I connect to my server database from my .net client program resides on client machine ?
Thanks in Advance.
My first thought is to try and ping the port of the db in your server (if you are using windows you can use "telnet ", see that you aren't blocked by any firewall rules in you server.
my second one is "Data Source="
if all fails, try reading this:
http://www.oracle.com/technology/pub/articles/cook_dotnet.html
Related
I developed an application using vb.net that connects to SQL Server Express 2008 R2 database (Hospital) through LAN, from a client PC.
SQL Server 2008 Express Management Studio successfully connects to the database (Hospital), but using the same connection string, my vb.net application fails to connect.
My connection string is:
"Data Source=TCP:192.168.1.1\SQLEXPRESS;Initial Catalog=Hospital;Persist Security Info=True;User ID=XXXX;Password=1111"
What is the problem? Can anybody help me to solve that?
First create a ODBC connection.
Then follow this connection string:
Data Source="SERVERNAME";Initial Catalog="DATABASE NAME";User ID="USERNAME";Password="PASSWORD";
IT should Work
Case :
I'm creating a desktop application with VB.NET (Windows Forms), and using SQL Server 2008 Express for its database.
Problem :
I want to create a client-server application, it means I just need 1 database on the server.
I have a computer and a laptop. I set my laptop's IP to 192.168.1.1 and my computer's IP to 192.168.1.2.
Now I place the database on my computer, the database name is db_transportasi.
Problem is, how to connect my computer's database from my laptop?
Specification :
I'm using this string below for my connection :
Data Source=ARVID-THEODORUS\SQLEXPRESS;Initial Catalog=DB_TRANSPORTASI;Integrated Security=True
I already setup my SQL Configuration Manager, enabled the TCP/IP, switch to the IP Addresses tab and set the IPAII Port Properties to 2301
I turned off my firewall so I don't have to set any exception.
Here is the SQL Server SS :
Question :
How to connect to my computer's database from my laptop?
Could you show me the example for my laptop VB.NET Connection String?
Thanks before.
There you go:
"Server=192.168.1.2,1433;Initial Catalog=DB_TRANSPORTASI;Integrated Security=True"
ConnectionStrings.com is a good resource for connection strings for many different databases.
try this link:
http://www.linglom.com/2009/03/28/enable-remote-connection-on-sql-server-2008-express/
connection string:
"Network Library=DBMSSOCN; Data Source=xxx.xxx.xxx.xxx,1433;" & _
"Initial Catalog=mySQLServerDBName; User ID=myUsername;" & _
"Password=myPassword"
Try this page. A whole list of different ways.
http://www.connectionstrings.com/sql-server-2008
Ensure that you start up the "SQL Server Browser" service in SQL server configuration manager.
Working in VWD 2010 Express
I have an aspx.vb file with the following connection string:
Protected Function getPasswordLength() As Integer
Dim conn As New SqlConnection("Data Source=localhost;database=MyDB;Integrated Security=true")
Dim cmd As SqlCommand = conn.CreateCommand()
cmd.CommandText = "select dbo.getPWLen() ;"
conn.Open()
getPasswordLength = CInt(cmd.ExecuteScalar())
conn.Close()
End Function
This works when the code is on the web server / which is collocated with the SQLServer.
However, when I want to debug, I have to copy to the server. I would like to be able to "debug in place" on my development machine and only copy files to the production machine periodically. Technically the production machine is not in production at the moment, but that's beside the point.
Anyway, I followed the following instruction: http://weblogs.asp.net/nannettethacker/archive/2008/02/17/creating-a-database-connection-to-a-remote-sql-server-database-within-visual-web-developer.aspx
I can now see the remote database, functions, etc. on the other machine (from the VWD running on the development machine).
However, I thought I should then be able to execute this same code locally on the development machine using ctrl-F5, but I get the following error:
--
**Server Error in '/' Application.
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)**
Should what I'm doing be possible? If so, any ideas what I'm doing wrong?
Make sure your SQL Server is configured to accept remote connections.
I have a remote server that has win2003 installed
I can connect to the machine using remote desktop and am succesfully hosting a web app on the server
I need to connect to the SQL server on that machine using a sql compare tool that I have.
What are the steps that I need to take to be able to connect to the SQL server given that all I have is the IP address to the machine and admin login credentials
if you are trying to remotely connect to sql server using ssms or another client on a different machine, you need to do the following:
open up sqlservr on server firewall
open up sqlbrowsr on server firewall
be concerned about security - if you can rdp/connect to sql w/o vpn, then so can other people - so you better make sure you have hardened environment and very strong passwords.
Depending on the specific access technology, different syntaxes for connection strings are needed. For the .NET provider, the syntax allows for passing server addresses.
Here's a sample connection ADO.net connection.
imports System.Data.SqlConnection
...
dim cn as new SqlConnection()
cn.connectionString = "Server=192.168.1.200;Database=mydbName;user id=notSA;password=C0mp!3xPVVD"
cn.open()
...
'Do cool stuff
...
cn.close()
Open up port TCP 1433 (Sql Server) on the remote server
And for your connection string jus use the IP Address for the Server, instead of using the computer name
You should be able to interchange between computer name and IP address without any problems, because the Computer Name gets turned into an IP Address anyway.
I have a VB script which connects to a local SQL database to retrieve a value. The exact same script runs on about 100 servers, but a few of the servers produce this error:
[DBNETLIB][ConnectionOpen (PreLoginHandshake()).]General network error. Check your network documentation
Here is the code that runs:
Function GetPrimaryServerID
On Error Resume Next
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")
objConnection.Open "Provider=SQLOLEDB;Data Source=127.0.0.1;Initial Catalog=xxx;User ID=xxx;Password=xxx"
sqlquery = "SELECT ServerID FROM tblSettings"
objRecordSet.Open sqlquery,objConnection
objRecordSet.MoveFirst
GetPrimaryServerID = objRecordSet("ServerID")
objRecordSet.Close
objConnection.Close
End Function
The error occurs on the 5th line when trying to open the connection string. I'm confused as to why this script is working on nearly all servers and failing on only a handful. The database that they connect to is identical on every server in terms of structure, its only the data that changes.
Fixed the problem by doing the following:
Opened SQL Server Configuration Manager and went to Protocols for MSSQLSERVER -> TCP/IP. In the 'IP Addresses' tab, I noticed that IP2 which has address of 127.0.0.1 was active but not enabled. Changed to enabled and restarted SQL services. My VB script now successfully opens the connection to 127.0.0.1.
It could fail if the database is not configured to listen to TCP/IP traffic. The error "Named Pipes Provider, error: 0 - No process is on the other end of the pipe." points in that direction.
You can test that with:
telnet 127.0.0.1 1433
To configure where the server listens, use `SQL Server Network Utility" for SQL Server 2000, or "SQL Server Surface Area Configuration" for SQL Server 2005 and up.
It's not a database error, but a client tools or config error
The failing servers will probably:
have a different level of either SQL Server install /includes service pack)
are configured for Windows Authentication only
have an older MDAC (linked to SQL Service pack, OS Service pack etc)
Edit:
SQL Server SSL Encryption, server side, is described here. And in KB 316898 too
"Server side" requires only a server certificate and all connections are encrypted
"client side" requires client certs and is optional, and only for that client
Certain client libraries (notably MS JDBC) do not support this.
If I've guessed right, you'll have either client or server SSL encryption set based on the server (your script is acting as a client)
a blog entry too
It may also be mismatching calls to WSAStartup and WSACleanup. If you call WSACleanup too often then sockets stop working. And the SQL client will also break - which is usually the case for remote DB servers (as opposed to local instances accessed through named pipes etc.).
Try to disable the WPF and this should solve the problem (Control Panel -> Windows Firewall).
If not, then you can also stop the service for firewall (from Services.msc --> Windows personal firewall)