Postgres database? - sql

I have set up a database using PostgresSQL, the host is set as local host. I want to know how to connect to that database using other software e.g. tableau and to let other people access and manipulate the database, to do this I need the host name/address along with the port number and password, how do I find out the host name/address to connect with? or how do I when creating the server save the host name as something that I can connect to which isn't local host?

Related

Connection string for a localhost SQL Server instance on a different machine in the same network?

I'd like to connect to a local instance of SQL Server on another machine within the same network, and am wondering if it's even possible.
For example, say we have Machine01 and Machine02, both on the same internal network. I have several IIS websites setup on Machine01. If I log onto Machine02 and query the URL of one of the websites on Machine01 in in internet browser (say http://Machine01:9000), the website will load just fine. This has me thinking that it might be possible to construct a connection string to access the local database on Machine01 from Machine02. Is this possible?
I have Allow remote connections to this server checked in SSMS.
I've tried this connection string:
Server=Machine01;trusted_connection=true;Database=MyDB;Persist Security Info=True
Your connection string is correct in that the Server is the target computer name, and the premise of what you're trying to do is certainly correct and quite possible.
However make sure that the firewall on Machine01 is set to allow inbound traffic on the LAN from the SQL Server port (by default, 1433).
Also, the trusted_connection bit may not work, depending on how you have your users set up. If the user account on Machine02 a trusted user account on Machine01? If in any doubt, set up a SQL Server user account on your Machine01 SQL server, make sure you have SQL connections enabled (Server properties -> Security -> SQL Server and Windows Authentication mode), and pass across the SQL user name and password in the connection string instead...
You might try setting up a linked server, I find it to make the queries much easier. Here is some information on how to set it up.

How to connect to sql server database via LAN

want to connect to a database on another PC connected via LAN. I am able to use the sql server db with string like C:\Users... but i cannot connect using string like (\\Server\c\user...) I tried to move the db file to My Documents, still i get this error.
I get the following error message: An attempt to attach an auto-names database for file (\\SERVER\Users\Jeswills\Documents\TBSDB.mdf) failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share
I hope i asked the question correctly
As database does not support the '\SERVER\c...' parameters, i had to attach the database, after enabling TCP/IP and SQL Browser, i had to create a login through security and add it to the attached database file because authentication must be SQL not windows. And i also gave read/write privileges to the account. Then on the child system, i confirmed connection to the account through SSMS with the login connecting to SERVER (which is the remote computer's name).
Note: you must be able to ping the remote systems and SQL Server Express R2 installed. I tried with SQL Server Express but did not get a head way. www.connectionstrings.com/sql-server-2008 for more connection string
Then i used this connection string to connect remotely, making integrated security and user instance = false unlike if i were connecting locally.
Data Source=SERVER\SQLEXPRESS,1433;Database=DATABASEFILE.MDF;Integrated Security=False;Network Library=dbmssocn;Connect Timeout=30;User Instance=False;user='USERNAME';password='PASSWORD'
Not sure what specifically you’re trying to do here but I guess it’s one of these two.
Option 1
Attach database stored on remote shared drive to a local SQL Server
Note that this is only possible starting in SQL Server 2008 R2. If you’re running SQL Server 2008 this is not an option.
Check this for more details
http://blogs.msdn.com/b/varund/archive/2010/09/02/create-a-sql-server-database-on-a-network-shared-drive.aspx
Option 2
Connect to remote SQL Server instance from local computer
If that database is already attached to SQL Server instance that runs on the same machine then it’s much better to just connect to that instance from SSMS than trying to attach database from remote storage.
To do this you need to enable TCP/IP protocol in SQL Server Configuration Manager. It’s under SQL Server Network configuration node. Make sure you enable TCP/IP and also set enable the IP address for listening (this is under TCP/IP properties).
Apart from this you’ll want to enable remote connections on your remote instance. This is done from SSMS -> instance properties -> Connection tab
When this is done you should be able to connect to remote instance from local SSMS by typing in IPaddress/instance name. For example 192.168.0.125/{instance_name} or only IP address if this is default instance.

access Oracle sql server remotely

Ok, so I started working on my machine locally but I still need to access the database on the remote server. I was using this...
DriverManager.registerDriver(new OracleDriver());
conn = DriverManager.getConnection("jdbc:oracle:thin:#dukeorrac01:1521:ORDB1","nrsc","nrsc");
But that doesn't seem to be accessing a remote server. I assume I need some sort of IP address in there somewhere. I realize I should use a datasource but I didn't set all this up and I don't have time to learn how to implement that (will do that after this project).
How do I access that remotely?
P.S. I'm using jboss as my locally running server.
In your connection string "jdbc:oracle:thin:#dukeorrac01:1521:ORDB1","nrsc","nrsc" dukeorrac01 refers to the host where your DB is. Replace that with whatever host you want to connect to (assuming all others parts of the connection string stay the same).
Here is the syntax for oracle connection string
jdbc:oracle:thin:#[HOST][:PORT]:SID

SQL express deployment on multiuser?

I am developing a application for a small user group and decided to use sql express.
So the design as normal is sql express will be hosted in one machine(as server machine) and users client app will connect to sql-express host machine for accessing db.
Now the problem is remote clients are not able to connect the db, but host machine can access the db. Can someone please help if you have tried this before ??
Connection string used is as below, do we need to change the connection string ?
Data Source=Hostname\SQLExpress;Integrated Security=true; AttachDbFilename=|DataDirectory|\mydb.mdf;User Instance=true;
Note: Users are not domain connected they are LAN connected.
The database service is probably not setup to listen on TCP port 1433 by default for security reasons. You need to use the configuration utility to enable remote access. You also need to make sure that port is not being blocked by a firewall. These instructions for SQL Server 2005 are useful.
If the users are not running under a domain account I believe you will have issues with authentication. You may want to add them to a domain, or enable SQL Server (password) authentication. After enabling this you can specify a username and password via the connection string. You need to make sure that the user exists and has access to the appropriate tables, views, or stored procedures.
By default, SQL Server does not permit remote connections. You need to change this via the Server Configuration Manager in the Start Menu.

How to connect to SQL server through IP

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.