Connecting to ODBC sources - SQL Server from the Linux Command Line
videoimage: thumbnail.jpg
Transcript#
This transcript was generated automatically and may contain errors.
Hey everyone, my name is Cecil and I'm here with my colleague Jay and we're from the Posit support team and today we're going to be walking you through how to connect to a database. In this case we're using Microsoft SQL Server and we'll be doing this on the Linux Command Line. It's a good idea to make sure that you can connect to your database from the Linux Command Line before you try connecting through Posit Workbench or Posit Connect.
So in this case our SQL Server is just using local authentication which is just username and password. So if we open up the odbc.ini file, this is a file that we can use to test our database connection. So this will have our connection string specifying that we're using the Posit Pro drivers here so the SQL Server driver, the IP of our SQL Server in this case, the database that we're using, the port, and the user id and password that we're connecting with.
Testing connectivity from the command line
So now that we have that file what we want to do is we can test connectivity outside of the product and through the Linux Command Line with ISQL. So we can do isql-v sql-server-local which was the name of our dsn and the dash v flag is just for verbosity in case the connection does fail we'll know why.
So we can hit enter there and you'll see if it works we'll be thrown into a shell into our SQL Server. So from here we can validate that we're actually connected by just running a select command to show the schema. So there we can see the schema.
