I'm trying to connect to an MS SQL database from R (on a Mac) - after fiddling a lot with odbc.ini, odbcinst.ini, and installing freeTDS as described:
sudo port install freetds +mssql +odbc +universal
it now works on the Mac's command line level, but when trying to access it from R using the command:
con <- odbcConnect("myDSN", uid = "myID", pwd = "myPWD")
it just hangs and when forced to stop executing, I get 50+ of the following warnings:
In odbcDriverConnect("DSN=myDSN;UID=myID;PWD=myPWD") :
[RODBC] ERROR: state IM002, code 1421220112, message [iODBC][Driver Manager]Data source
name not found and no default driver specified. Driver could not be loaded
After having tried to make it work for about two days, I'm running out of suggestions. Can anybody help point me to what I am missing?
EDIT: It also works when running R on the virtual Windows machine. How do I get it to work on the Mac?
Did you first configure your MS SQL driver connection? If you have, then you should have a data source called "myDSN" in the OCBC Data Source dialog box.
Here is a great blog which gives step-by-step instructions and screen captures for what you need to do.
When you issue queries in R, R will try to talk to the ODBC data source called "myDSN". That data source knows what database you want (MS SQL) and also what the credentials (username/password) are needed to get access. This is the reason why you must configure the data source.
Related
I download netezza emulator and run it on VMware workstation. Then connect via Dbeaver. When I run
SELECT * FROM TEST1;
I am getting SQL Error [1100] [HY000]: ERROR: System is not 'Online'
how can I solve this error.
Also I cant create new table on emulator when I try to create new table. It doesnt give any error but it also never respons. Dbeaver says execute query and count seconds but no response
Hard to tell, the error message only says that your client (dbeaver) cannot contact the server (Netezza). A couple of guesses:
you forgot to turn your emulator on (you mentioned an emulator???)
you connect to the server using the wrong IP address and/or port number
a firewall is blocking your access (either on you client side, on the server. or between if it’s not an emulator your are using)
Perhaps Try Ping’ing the server from the client and vise versa (a command prompt of some sort). Then get back to us
When you add Netezza emulator to vmware virtualize intel vt-x option is not enabled so it prevents to netezza run properly. You need to enable Virtualize Intel VT-x/EPT or AMD...
Option then reboot netezza vm then netezza will start normally.
if you want to control whether netezza working properly or not you can use
nzstate
command
I'm trying FastReport.Mono on Linux (CentOS 7) to see if I can make an app to generate reports. Example Mono app seems to work fine with PDF and JPG export from custom dataset.
Now I need to query data from MS SQL database. I have a sample report that works well under Windows, but fails on Linux:
private static void ReportExportJPG()
{
Report report = new Report();
report.Load(#"sql-report.frx");
report.Prepare(); // <<<--- Error here
...
}
Error message is:
Cant find object MsSqlDataConnection
Feature table says that MS SQL connectivity (nor ODBC, nor many others) is not available in FastReport.Mono. Does this mean it's entirely missing or I should use other ways and provide ready-made connection to FastReport somehow? If so - How?
P.S. Running Windows report generator with MS SQL connection under Wine works well, so I assume connecting to MS SQL from CentOS is somehow viable.
I was able to resolve this by adding the following to my project source:
using FastReport.Data;
using FastReport.Utils;
...
RegisteredObjects.AddConnection(typeof(MsSqlDataConnection));
How would I access MS SQL Server with ubuntu 14.04. I tried using freetds I failed to understand the process and It was my first time learning sqlmap. I have tried to read for several hours but in vain. Just give me a clue a way to proceed. I have the IP address of the database but I don't know how I can read it.
DbVisualizer (https://www.dbvis.com) should work for you. Its cross platform, fairly easy to use and can connect to almost any kind of database. You'll need the IP address, port, username and password, just create a new connection and provide the connection details. You then can see the tables and run SQL against them (you're gonnna need to learn SQL if you don't know it).
It would help to know what you are trying to migrate. Im assuming the Ubuntu server is where the data is, but you haven't said what platform you are using or what format you are trying to get the data in. Are you just trying to clone the entire database to your local MySQL process?
I am having an insanely tough time getting Rails to connect to SQL Server on a Mac.
I have set up a DSN using Actual SQL Server drivers: http://www.actualtech.com/ - it works great. I can test it and it seems to be functioning.
However, when I run:
iodbctest "dsn=rails_import2;uid=sa;pwd=mypassword"
The output is:
1: SQLDriverConnect = [Actual][SQL Server] Unable to connect to data source (0) SQLSTATE=S1000
1: ODBC_Connect = [Actual][SQL Server] Unable to connect to data source (0) SQLSTATE=S1000
I have been banging my head against the wall on this for hours. I have tried a lot of things and had it working at one point with FreeTDS +MSSQL (http://blog.opensteam.net/past/2009/1/28/rails_ms_sql_on_mac/), but it broke after a restart.
Any ideas?
So after a few days of mind-numbing experimentation, I've determined that I've somehow hosed my FreeTDS install. Not sure how, but I've basically given up on using the activerecord-sqlserver-adapter gem from my Mac.
The good news? The instructions here at http://odbc-rails.rubyforge.org/ work great. Oh, and you'll also need the activerecord-odbc-adapter gem.
Here's what I've tried:
-Find Vista's ODBC Data Source Manager* through search,
-Add a new File Data Source*, selecting Driver for Microsoft Access (*.mdb), and selecting my mdb file of interest,
-import pyodbc from python shell and try:
pyodbc.connect("DSN=<that Data Source I just created>")
I get the following error message (Portuguese**):
Error: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Nome da fonte de dados n\xe3o encontrado e nenhum driver padr\xe3o especificado (0) (SQLDriverConnectW)')
Which translates as "Data source name not found and no standard driver specified".
What am I doing wrong?
How to get it right?
Also, I searched the web for documentation but found nothing worth much, could anyone recommend any documentation?
*Names may not be completely accurate because my Windows is in Portuguese.
**No, Portuguese doesn't have '3' and '\' as letters, these are misprinted special characters
DSN= is only used for a system or user DSN.
For a DSN File, you need to use FILEDSN=c:\myDsnFile.dsn
http://www.connectionstrings.com/ is your best friend.
I had a similar problem with pyodbc although not with Access but a different ODBC driver.
This is what helped me.
http://robertoschiabel.wordpress.com/2008/02/28/windows-x64-32bit-odbc-vs-64bit-odbc/
(here is the appropriate KB article in case this URL goes away. http://support.microsoft.com/kb/942976/en-us )
Our previous server hardware died and we had to quickly redeploy on a 64 bit OS because that is all we had that was available. Using the normal ODBC admin tool I added the appropriately named DSN but it still claimed it wasn't found. Only when running the special 32-bit version of the ODBC admin, was I able to define a DSN that my script using pyodbc could find.
I use odbc module (included in ActiveState Python), but tested pyodbc and for me works:
#db = odbc.odbc('northwind')
#db = odbc.odbc('Driver={Microsoft Access Driver (*.mdb)};Dbq=Nwind.mdb;Uid=;Pwd=;')
#db = pyodbc.connect('Driver={Microsoft Access Driver (*.mdb)};Dbq=Nwind.mdb;Uid=;Pwd=;')
db = pyodbc.connect('DSN=northwind')
Of course commented connections works too.
I configured nothwind as user DSN so you probably will have to configure your ODBC database connection as User DSN or System DSN, or without configuring in ODBC Administrator you can use ConnectString where you can point at your .mdb file.
It's smart to list your odbc connections with pyodbc to see what are you using. Make sure you use appropriate pyodbc 32 bit Python 32 bit driver. If you want to use 64bit access files you should use 64 bit MS Acceess which provides driver.
sources = pyodbc.dataSources()
keys = sources.keys()
for key in keys:
print key