I am trying to write a libname statement in SAS Enterprise Guide to refer to an existing ODBC connection to a SQL database. This program is shared with others, so coding my user name and password in it is not an option. Ideally I would like to the program to prompt me for a user name and password, but I can't get it to work. Here is what I have tried:
Works (but is not acceptable):
libname libref odbc dsn=DSN_Name uid=User_Name pwd=My_Password;
(where "libref", "DSN_Name", "User_Name", and "My_Password" are my actual values)
Does not work:
a) libname libref odbc dsn=DSN_Name;
result: ERROR: CLI error trying to establish connection: [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user ''.
ERROR: Error in the LIBNAME statement.
b) libname libref odbc dsn=DSN_Name prompt=yes;
result: ERROR: CLI error trying to establish connection: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver
specified : [Microsoft][ODBC Driver Manager] Invalid connection string attribute
ERROR: Error in the LIBNAME statement.
c) libname libref odbc prompt=yes;
result: ERROR: CLI error trying to establish connection: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver
specified : [Microsoft][ODBC Driver Manager] Invalid connection string attribute
ERROR: Error in the LIBNAME statement.
plus a bunch of other such combos. I feel like I am missing something, but what? Are there other options which don't involve me writing my password in and inevitably forgetting to delete it? Thank you!
Related
PROC SQL; UPDATE CLEAN.Unknown_Provs AS A SET ProviderAddress1=(SELECT COALESCEC(Prac1stAddr,Mail1stAddr) FROM HED.tblProviderNPI AS B WHERE A.UnknownFile_ProviderKey=B.NPI) WHERE ProviderAddress1=''; quit;
HED is the libname created for the SQL server database.
How can i fix the error
I am new to Informatica and I am getting the below error while running a simple DB to DB table load using Informatica.
Message Code: WRT_8229
Message: Database errors occurred:
FnName: Execute -- [Informatica][ODBC SQL Server Wire Protocol driver][Microsoft SQL Server]Incorrect syntax near '$'.
FnName: Execute -- [Informatica][ODBC SQL Server Wire Protocol driver][Microsoft SQL Server]Statement(s) could not be prepared.
FnName: Execute -- [Microsoft][ODBC Driver Manager] Function sequence error
I am not using any parameter in the mapping and I do not understand why I am getting that:
'Incorrect syntax near '$'' error.
I have another mapping that loads the same table, but that is working without any issues.
This error can occur when the target table contains a column name with a space or special character. For your case it seems its $. Now, you need to add QuotedId=Yes to your odbc.ini file for target connection entry. Check if you are using same connection as the mapping that works. If not, you need to append below parameter to your connection.
open .odbc.ini. This exists in $ODBC_INI location.
append below entry and save it.
[TGT_CONN]
...
QuotedId=Yes
Explanation - QuotedID parameter determines whether the driver uses quoted identifiers while writing/reading. So Infa should use sql like SELECT "abc_$" from "table"
Scenario:
I run SAS programs from Sasfusion server abc123.
I run regular SAS programs with proc contents, proc prints, proc exports, etc with no issue.
I was just requested to access a SAS dataset in location on a separate server zyx123 (not sure if it is Sasfusion or not)
I thought this would be something simple like putting in a libname statement.
libname z '\path to the folder\' server=zyx123;
proc contents data = z.requesteddataset;
run;
Is it possible to even do the above?
I get the following errors:
ERROR: Libref TEST is not assigned.
ERROR: Error in the LIBNAME statement.
ERROR 23-7: Invalid value for the SERVER option.
The LIBNAME option SERVER= is used to access to data sets on a machine with SAS/SHARE licensed running a SAS session in which Proc SERVER is executing.
See the SAS/SHARE User's Guide, LIBNAME documentation:
LIBNAME Statement
In a client session, associates a libref (a shortcut name) with a SAS library that is located on the server for client access. In a server session, predefines a server library that clients are permitted to access.
…
SERVER=<server-node.>server-name | __port-number
specifies the location and identity of the SAS/SHARE server session that administers the SAS library.
You should request additional information about the remote server from you network / SAS administrator.
Not sure about your specific ERROR messages logged -- the log for an unsuccessful libname (on my machine) looks like:
12 libname foo 'c:\temp' server=#######.######;
ERROR: Attempt to connect to server #######.###### failed.
ERROR: A communication subsystem partner link setup request failure has occurred.
ERROR: The connection was refused.
ERROR: Error in the LIBNAME statement.
I am trying to connect to Athena using SQL workbench. I followed all the instructions from page 15 to 19 mentioned in this PDF file:
https://s3.amazonaws.com/athena-downloads/drivers/JDBC/SimbaAthenaJDBC_2.0.7/docs/Simba+Athena+JDBC+Driver+Install+and+Configuration+Guide.pdf
If I use the default athena bucket name, I get this error:
S3://aws-athena-query-results-51346970XXXX-us-east-1/Unsaved
[Simba]AthenaJDBC An error has been thrown from the AWS SDK
client. Unable to execute HTTP request: No such host is known
(athena.useast-1.amazonaws.com) [Execution ID not available]
For any other bucketname I get this error:
s3://todel162/testfolder-1
[Simba]AthenaJDBC An error has been thrown from the AWS SDK
client. Unable to execute HTTP request: athena.useast-1.amazonaws.com
[Execution ID not available]
How do I connect to Athena using JDBC client?
Using copy-paste had an issue with the string on page 16:
jdbc:awsathena://AwsRegion=useast-1;
It should have a - like this...
jdbc:awsathena://AwsRegion=us-east-1;
Once I corrected this, I was able to connect.
I have tried the following connection string with pyodbc.connect()
DRIVER={NZOLEDB};SERVER=myserver;PORT=xxxx;DATABASE=mydatabase;UID=myUID;PWD=mypassword;
But the following error message keeps coming up:
Error: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')
What should the correct connection string be written?