LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Remote access to database using ODBC connector

Solved!
Go to solution

Hi,

 

My Labview hangs everytime i execute this program to connect with a remote server. May I know why ? I tried to use a local host on the same listening port and it works perfectly fine. Both remote and local are using the same listening port. not sure if it will affect

Thanks.

 

remote1.png


 

0 Kudos
Message 1 of 12
(5,628 Views)

Can you ping the computer where the remote db is located? Have you checked your firewall?

Rolf Kalbermatter
My Blog
Message 2 of 12
(5,598 Views)

How do I ping the location? And I suspect it might be the firewall. Because I was using a school network

0 Kudos
Message 3 of 12
(5,597 Views)
Solution
Accepted by topic author S.Neo

Open command line and enter:

ping <your ip address of the other computer>

 

Even if you can ping the computer that won't mean that the firewall is not the issue. The MySQL driver uses its own specific IP port number that most firewalls will consider a threat and either block it outright or ask you during the first attempt if you want to allow this. If the firewall of the remote computer is involved, or one in your school network you will of course not get a prompt to allow that connection.

For network firewalls you would have to contact the network administrator and for the firewall on the DB computer, its administrator. 

Rolf Kalbermatter
My Blog
Message 4 of 12
(5,594 Views)

I am using Amazon EC2 server as my remote server. I tried to Ping < ip address > and packet sent was 100% loss. I used tether from my phone since the school network has firewall. 

 

How should i proceed next ? 

Thank you 

0 Kudos
Message 5 of 12
(5,552 Views)

Are you using LabVIEW 32-bit on a 64-bit machine? Which version of the ODBC connector are you using - the 32-bit or the 64-bit?

If you're using LabVIEW 32-bit, you need to make sure you have the 32-bit ODBC connector installed and also make sure that your connection is set up in the 32-bit version of the ODBC connection manager located here: c:\Windows\SysWOW64\odbcad32.exe (which is completely separate and independent to the 64-bit ODBC manager which is the one that opens by default).

 

If you're still having issues after checking that, you probably have a firewall issue and you'd need to talk to your IT department after you've checked any local settings on your PC.

 

Edit: Also - is the server set up to allow incoming TCP connections from your machine. For security, it's not uncommon to have an allowed list of the IPs / hostnames / usernames that are allowed to connect through the TCP/IP port of the MySQL server (and even that is sometimes turned off by default).


LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 6 of 12
(5,547 Views)

Hi,

 

I am using 32-bit labview and 32 bit odbc connector. I have succesfully connected and retrieve data from local server. I am trying out remote server and it isn't successful.

 

Thank you

0 Kudos
Message 7 of 12
(5,539 Views)

I doubt that you can just use Amazon service to install any server on it and access it from anywhere in the world. They most likely run various firewalls to protect their cloud services which will not allow nonstandard port numbers like the mySQL driver to pass through. You may be able to configure the Amazon service to allow specific ports to be allowed or you may have to make a service request, or it may not be possible. 

Rolf Kalbermatter
My Blog
Message 8 of 12
(5,536 Views)

Hi, 

May I know if my labview and odbc connector is 32 bit But my amazon EC2 server is 64 bit. will there be a problem communicating ? 

Thank you

0 Kudos
Message 9 of 12
(5,502 Views)

There shouldn't. An application calls the ODBC manager DLL which then calls the ODBC driver DLL. A DLL however has to have the same bitness than the calling application, so this means that the ODBC driver itself has to match the bitness of the application. And since the user part of the ODBC driver is separated between 32 Bit and 64 Bit you also have to start the correct ODBC Manager Configuration utility (odbcad32.exe in <Windows>\SysWow64 for the 32 bit version and in <Windows>\System32 for the 64 Bit version, despite the naming convention of those directories) in order to configure the user DSNs that your program will use.

The mySQL ODBC driver then translates the SQL commands and everything else to a bytestream on the wire which gets send to the SQL Server instance. Not considering bugs in the ODBC driver, they should generate the same bytestream on the wire independent if they are compiled as 32 Bit or 64 Bit driver.

 

There even exists an implementation of a simple mySQL driver written entirely in LabVIEW since the bytestream is simply sent over TCP and LabVIEW can do that directly. However I would not recommend you to use that driver in the hope that things would work better. First that driver is pretty old and supports a much older version of mySQL than what is currently shipped by Oracle. Second it is a fun project of a single person who implemented enough that it worked for their specific needs. It is by far not a completely functional driver. So you likely would end up debugging that driver itself and that seems to just make your problems bigger, not smaller. It would just add another dimension to the whole puzzle that could cause failures.

Rolf Kalbermatter
My Blog
0 Kudos
Message 10 of 12
(5,494 Views)