Tuesday, September 3, 2019

[R TERADATA] Connecting to teradata from R


https://stackoverflow.com/questions/20998653/connect-r-and-teradata-using-jdbc


Download the jdbc driver from here

https://downloads.teradata.com/download/connectivity/jdbc-driver

Sometimes you need to restart the PC to make it work!

Using the R Console, enter the following steps below to make a Teradata connection:
drv = JDBC("com.teradata.jdbc.TeraDriver","ClasspathForTeradataJDBCDriverFiles") 
Example:
drv = JDBC("com.teradata.jdbc.TeraDriver","c:\\terajdbc\\terajdbc4.jar;c:\\terajdbc\\tdgssconfig.jar")  
NOTE: A path on a UNIX machine would use single forward slashes to separate its components and a colon between files.
conn = dbConnect(drv,"jdbc:teradata://DatabaseServerName/ParameterName=Value","User","Password") 
Example:
conn = dbConnect(drv,"jdbc:teradata://jdbc1410ek1.labs.teradata.com/TMODE=ANSI,LOGMECH=LDAP","guestldap","passLDAP01")
NOTE: Connection parameters are optional. The first ParameterName is separated from the DatabaseServerName by a forward slash character.
dbGetQuery(conn,"SQLquery")
Example:
dbGetQuery(conn,"select ldap from dbc.sessioninfov where sessionno=session")

[TERADATA] Uploading csv to table




1. Create table

CREATE MULTISET TABLE test_table
(
AccountID INTEGER,
Score DECIMAL(18,4),
Score_Class VARCHAR(50),
Load_Date Date
)


2. Write the insert command. Exactly same number of question marks as in the table definition
insert into test_table VALUES(?,?,?,?)

3. Define the delimiter of the file in

Tools -> Options->Export/Import

4. Make sure to ignore first line of the file as it is a header

Tools->Options->Import   Check the "Ignore the first record in the import file (Skip Header)



Loud fan of desktop

 Upon restart the fan of the desktop got loud again. I cleaned the desktop from the dust but it was still loud (Lower than the first sound) ...