r - RODBC connectivity to Oracle without tnsnames.ora -
i trying connect oracle r using rodbc without using tnsnanes.ora.
i have tried following strings, none of them working.
> con.text <- paste0("driver={oracleodbc-11g};dbq=//oracle.server:1527/database.pdw.prod;uid=user;pwd=pswd;") > con.text <- paste0("driver={oracleodbc-11g}; ", "connectstring=(description=(address= (protocol = tcp)(host = oracle.server)(port = 1527))(connect_data=(service_name = database.pdw.prod))); uid=user;pwd=pswd;") > con.text <- paste0("driver=", "oracleodbc-11g" , ";server=", "oracle.server" , ";database=", "database.pdw.prod" , ";uid=", "user" , ";pwd=", "pwd", ";") > con.text <- paste0("driver=", "oracleodbc-11g" , ";server=", "oracle.server" , ";connectstring=" , "(description=(address= (protocol = tcp)(host = oracle.server)(port = 1527))(connect_data=(service_name = database.pdw.prod)))" , ";database=", "database.pdw.prod" , ";uid=", "user" , ";pwd=", "pswd", ";") > con1 <- odbcdriverconnect(connection = con.text)
but these strings getting following error:
warning messages: 1: in odbcdriverconnect(connection = con.text) : [rodbc] error: state hy000, code 12162, message [unixodbc][oracle][odbc][ora]ora-12162: tns:net service name incorrectly specified 2: in odbcdriverconnect(connection = con.text) : odbc connection failed
or
1: in odbcdriverconnect(connection = con.text) : [rodbc] error: state im002, code 0, message [unixodbc][driver manager]data source name not found, , no default driver specified
the correct sysntaxis looking is
conex <- odbcdriverconnect("driver=oracle en oraclient11g_home2;uid=username;pwd=password;dbq=//hostname:port/oracle_sid;", believenrows = false)
ex
conex <- odbcdriverconnect("driver=oracle en oraclient11g_home2;uid=john;pwd=deere;dbq=//fcoracleserver.youdomain:1521/testenvironment;", believenrows = false)
the hard part find name of driver, can see mine on spanish.
what did create first odbc conection using c:\windows\system32\odbcad32.exe, there can check right name of oracle or sql server driver.
once create conection, can use odbcdatasources()
on r, see conection , find out driver. thats hard part.
hope helps !
Comments
Post a Comment