LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Connecting to SQL database using IP address

Hi
 
I'm writing some SQL code to connect to a database on another site.
 
I have been given -
Server IP addres
Database name
User ID
 
Using the database connectivity tools it seems like I have to use a dsn to connect to the database - is it possible to do it using the IP and database details above?
 
Cheers
 
Dave
0 Kudos
Message 1 of 7
(5,413 Views)
In general the answer to your question is yes, but you might need a bit more information - like maybe a password. What DBMS are you connecting to? (Oracle, SQL Server, something else?) Do you have the appropriate client software installed on your computer?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 7
(5,397 Views)
Hi Mike
 
Thanks for replying again.
 
It is an SQL database and there is no password as we use a general read only account. I don't have the client software installed on the machine.
 
Cheers
 
Dave
0 Kudos
Message 3 of 7
(5,378 Views)
Yes you should have all the information needed. To create your DSN you use the Data Sources (ODBC) program in Administrative Tools. If you need help, here are a couple sites that I found with instructions for creating a DSN and again here. Given that you are accessing SQL Server, you may already have the client drivers you need depending upon the version of Windows you are running.

If you have XP, you're golden. If you are running something earlier, you need to download and install MDAC Version 8.2 SP1.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 7
(5,356 Views)

Hi Mike,

 

Link cannot open, can u repost?

0 Kudos
Message 5 of 7
(4,017 Views)

@DavidIMurray wrote:
 
 
It is an SQL database and there is no password as we use a general read only account. I don't have the client software installed on the machine.
 

Technically speaking most databases that you connect to remotely are SQL databases. But they may be running an Oracle, Microsoft SQL Server, or Maria DB/MySQL engine or several other less common ones. And each of them needs a different ADO.NET/OLE-DB/ODBC driver, so it is actually important to specify the type of SQL engine it is running on.

 

You may have meant to say MS SQL Server, but that wasn't clear from your message.

 

In order to access any of these servers from your computer through the Database Connectivity Toolkit you will need to have the according database driver installed. This can be either an OLE-DB or ODBC based driver. You also have to watch out about the bitness. In order to use the Database Connectivity Toolkit you would need to use LabVIEW 32 bit and an according 32 bit database driver. If you are on 64 bit Windows you will need to run odbcad32.exe in C:\Windows\SysWOW64 in order to configure this. The ODBC Administrator that gets started from the Control Panel is the 64 bit version which only configures 64 bit drivers.

Rolf Kalbermatter
My Blog
0 Kudos
Message 6 of 7
(4,009 Views)

As others have mentioned, you will also need the type of SQL Server (Oracle, MySQL, SQL Server, MS Access, etc.) to determine the driver to use for connecting.

The input to the Database connect vi can either be a UDL string, or a path to a UDL file.

To use a file just create a new text document (Where you would keep other config files for this program) and give it the extension .udl, open the file and the Data Link Properties window will open to allow you to configure the connection, save and pass the filename to the database connect vi when you run the software.

The udl connection string can have a couple of different settings but the format itself is fairly straightforwards, you might want to check out ConnectionStrings.com for examples and values.

Jon D
Certified LabVIEW Developer.
0 Kudos
Message 7 of 7
(3,998 Views)