spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Suresh Thalamati <suresh.thalam...@gmail.com>
Subject Re: JDBC SQL Server RDD
Date Tue, 17 May 2016 07:26:00 GMT
What is the error you are getting ?

At least on the  main code line I see JDBCRDD is marked as private[sql].  Simple alternative
 might be to call sql server using data frame api , and get rdd from data frame. 

eg:
val df = sqlContext.read.jdbc("jdbc:sqlserver://usaecducc1ew1.ccgaco45mak.us-east-1.rds.amazonaws.com
<http://usaecducc1ew1.ccgaco45mak.us-east-1.rds.amazonaws.com/>;database=ProdAWS;user=sa;password=?s3iY2mv6.H",
"(select CTRY_NA,CTRY_SHRT_NA from dbo.CTRY)" , new java.util.Properties())

val rdd = df.rdd 


Hope that helps
-suresh

> On May 15, 2016, at 12:05 PM, KhajaAsmath Mohammed <mdkhajaasmath@gmail.com> wrote:
> 
> Hi ,
> 
> I am trying to test sql server connection with JDBC RDD but unable to connect.
> 
> val myRDD = new JdbcRDD( sparkContext, () => DriverManager.getConnection(sqlServerConnectionString)
,
>       "select CTRY_NA,CTRY_SHRT_NA from dbo.CTRY limit ?, ?",
>       0, 5, 1, r => r.getString("CTRY_NA") + ", " + r.getString("CTRY_SHRT_NA"))
> 
> 
> sqlServerConnectionString here is jdbc:sqlserver://usaecducc1ew1.ccgaco45mak.us-east-1.rds.amazonaws.com
<http://usaecducc1ew1.ccgaco45mak.us-east-1.rds.amazonaws.com/>;database=ProdAWS;user=sa;password=?s3iY2mv6.H
> 
> 
> can you please let me know what I am doing worng. I tried solutions from all forums but
didnt find any luck
> 
> Thanks,
> Asmath.


Mime
View raw message