Oracle instant client ODBC connection - r

I have a problem connecting to Oracle DB using ODBC library. ODBC drivers are installed and when I test connection through ODBC admin tool in windows it is ok. However, in R I'm running into the following problem:
con <- dbConnect(odbc::odbc(), "ORACLEDNS")
Error: nanodbc/nanodbc.cpp:950: 28000: [Oracle][ODBC][Ora]ORA-01005: null password given; logon denied
Adding PWD results in R session being unresponsive without providing any type of error.
con <- dbConnect(odbc::odbc(), "ORACLEDNS", PWD = "password")
How can I debug the issue, what might be the problem?
DB Version:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

Related

Error while writing data from Linux server to SQL Server using dbWriteTable

I'm trying to write data to a table in SQL Server using dbWriteTable from odbc package. And, getting this error:
dbWriteTable(con1, 'mtcars', mtcars[1:5, ])
Error: 'CREATE TABLE "mtcars" ( "row_names" varchar(255), "mpg" FLOAT, "cyl" "disp" FLOAT, "hp" FLOAT, "drat" FLOAT, "wt" FLOAT, "qsec" FLOAT, "vs" FLOAT, "am" FLOAT, "gear" FLOAT, "carb" FLOAT)' nanodbc/nanodbc.cpp:1587: 42000: [FreeTDS][SQL Server]Incorrect syntax near 'mtcars'.
It's working fine from a windows machine. Any help would be appreciated..
The QUOTED_IDENTIFIER option is OFF for that session. Probably because of the FreeTDS driver.
The SQL Server Native Client ODBC driver and SQL Server Native Client
OLE DB Provider for SQL Server automatically set QUOTED_IDENTIFIER to
ON when connecting. This can be configured in ODBC data sources, in
ODBC connection attributes, or OLE DB connection properties. The
default for SET QUOTED_IDENTIFIER is OFF for connections from
DB-Library applications.
You can try setting QUOTED_IDENTIFER ON, or switch to the Microsoft ODBC Driver for Linux.

64-bit DBeaver can't connect to ODBC source - “Unexpected driver error occurred while connecting to database”

I want to make new connection ODBC in Dbeaver. The test result in ODBC driver is 'successfully connected to data source'. So in Dbeaver i just click new connection database then ODBC, i fill the Database/Schema in Dbeaver same with Data Source in ODBC, also i fill username and password like in ODBC and i didn't change any settings. But i get the following error like this:
'Unexpected driver error occurred while connecting to database'
should i change any settings in Dbeaver?

Using ODBC package to access SQL Express from R on Mac vs PC

I've been trying to set up a remote SQL Express database to test analysis work I've been doing (the full dataset is a full SQL Server build but for IG purposes I'm trying to do a minimal test setup in-house). I have a copy of the latest version of SQL Express set up on an old PC. My primary development environment is on the Mac, but I've got Bootcamp installed on it.
I installed the MS SQL ODBC driver for Mac from the Microsoft website, and have been trying to use the ODBC package following the instructions on https://db.rstudio.com.
After initial attempts failed, I tested the local setup of the SQL Server, following Microsoft's troubleshooting guide.
I then switched using Bootcamp to Windows, installed RStudio on there, and ran the same line of code (below) with the Windows version of the driver name, with success.
I've disabled the firewall to ensure that this wasn't interfering. I've pinged Test-PC and confirmed that the IP address works as expected. The error I get is as below.
Could anyone suggest where to go / look next?
library(odbc)
> odbc::odbcListDrivers()
name attribute value
1 ODBC Driver 13 for SQL Server Description Microsoft ODBC Driver 13 for SQL Server
2 ODBC Driver 13 for SQL Server Driver /usr/local/lib/libmsodbcsql.13.dylib
3 ODBC Driver 13 for SQL Server UsageCount
> con <- dbConnect(odbc::odbc(), Driver="ODBC Driver 13 for SQL Server", Server = "Test-PC/SQLEXPRESS", UID = "my_user", PWD = "my_password", Port = 1433)
Error: nanodbc/nanodbc.cpp:950: HYT00: [Microsoft][ODBC Driver 13 for SQL Server]Login timeout expired

Unable to connect non-system databases in rstudio

I've been trying to connect DB(sql server management studio) to rstudio.
This is what i have tried
# Importing and listing the drivers usiang the ODBC
library(odbc)
odbcListDrivers()
sort(unique(odbcListDrivers()[[1]]))
# Database connection using DBI
library(DBI)
con <- dbConnect( odbc(),
Driver = "SQL Server",
Server="localhost\\SQLEXPRESS",
Database="master",
Trusted_Connection="True"
)
The above code successfully connects to the db but i can see only the system databases under the connection tab. The non-system db the user defined ones are not show in the connection panel of the R studio. How to fix this.
Connections panel
Non-system dbs in the database

[Microsoft][ODBC Driver Manager] Invalid string or buffer length ON WINDOWS SERVER 2008

My java webapp is working fine in my windows XP 64bit with System DSN, by deploying manually in tomcat.
When i am running my webapp in Tomcat on windows server 2008 64bit. I am using a System DSN, because with user DSN it's not detecting the datasource. In this scenario it is throwing me an error as follows:
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid string or buffer length
So far I have tried:
I compared SQL server and DSN registry values, and they are same.
I deployed on other XP machine, it's working fine but not on Windows Server 2008
Thank you in advance.
When trying to run query against System ODBC DSN (MS Access .mdb file) from an app deployed to Jboss 4.x, I get same error: "SQL state [S1090]; error code [0]; [Microsoft][ODBC Driver Manager] Invalid string or buffer length" in Windows Server R2.
I reproduced same error on 2 different Windows Server R2 machines. On Windows Server Standard (i guess R1) and Windows 7 Professional x64 the problem is not reproducible.
Further more, on same Windows Server R2 when trying to connect directly (from a standalone app), i don't get this problem.
If the application wouldn't connect/detect data source, you'd get an error saying that there is no such DSN name or it's not found.
The same error message is thrown when trying to send an empty query to ODBC Data Source (registered Data Source Name - DSN). So i guess the ODBC gets an empty query which tries to execute against the DS and the result is: Invalid string or buffer length.
Since i can read the .mdb file registered as a ODBC DS with given DSN, and i don't get this error when querying it from the standalone app, i'm going to make a standalone app that will read the .mdb file through ODBC and write it's content to a .csv file, which Jboss apps will read.
If anyone finds a better solution, please let me know.

Resources