哪个分区 parameter中新增硬盘分区一个分区frp

分区表无法使用延迟创建选项_百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
分区表无法使用延迟创建选项
上传于||暂无简介
阅读已结束,如果下载本文需要使用0下载券
想免费下载更多文档?
定制HR最喜欢的简历
下载文档到电脑,查找使用更方便
还剩7页未读,继续阅读
定制HR最喜欢的简历
你可能喜欢博客访问: 132343
博文数量: 119
博客积分: 0
博客等级: 民兵
技术积分: 590
注册时间:
IT168企业级官微
微信号:IT168qiye
系统架构师大会
微信号:SACC2013
分类: 嵌入式
& &&& &RK29android系统平台使用parameter文件来配置一些系统参数,比如定义串口号,固件版本,nand flash分区信息等等。 &Parameter文件是非常重要的系统配置文件,最好在能了解清楚各个配置功能时再做修改,避免出现parameter文件配置异常造成系统不能正常工作的问题。Parameter文件大小有限制,最大不能超过32KB。&
parameter文件预览: &面是一个parameter文件的内容,不同的项目,parameter文件的内容会有一些差异。
FIRMWARE_VER:4.1.1
MACHINE_MODEL:rk30sdk
MACHINE_ID:007
MANUFACTURER:RK30SDK
MAGIC: 0x5041524B
MACHINE: 3066
CHECK_MASK: 0x80
KERNEL_IMG: 0x
#RECOVER_KEY: 1,1,0,20,0
CMDLINE:console=ttyFIQ0 androidboot.console=ttyFIQ0 init=/init initrd=0x,0x mtdparts=rk29xxnand:0xx(misc),0xx(kernel),0xx(boot),0xx(recovery),0xx(backup),0xx(cache),0xx(userdata),0xx(kpanic),0xx(system),-@0x(user)
文件内容说明 & &
1.FIRMWARE_VER:0.2.3 &固件版本,打包updata.img时会使用到,升级工具会根据这个识别固件版本。Boot loader会读取这个版本传递给kernel使用。 &&
2.MACHINE_MODEL:rk29sdk &机型,打包updata.img使用,不同的项目,可以自己修改,用于升级工具显示。 &&
3.MACHINE_ID:007 &&&& 产品开发ID,可以为字符和数字组合,打包updata.img使用,不同的项目使用不同的ID, 可以用于识别机器机型。 &&
4.MANUFACTURER:RK29SDK && 厂商信息,打包updata.img使用,可以自己修改,用于升级工具显示。
5.MAGIC: 0x5041524B & & &MAGIC,不能修改 &&
6.ATAG: 0x & & &ATAG,不能修改 &&
7.MACHINE: 2929 & & & 内核识别用,不能修改。 &&
8.CHECK_MASK: 0x80 & & &保留,不能修改。&
9.KERNEL_IMG: 0x & & & 内核地址,boot loader会将内核加载到这个地址,kernel编译地址改变时,这个值需要相应修改。 & &
10 &COMBINATION_KEY: 0,6,A,1,0
按键类型为:0 &= 普通按键 , 1 = AD按键(保留,未支持) & &
GPIO定义:上例中定义的是GPIO6A1 & &&
判断电平:0 = 低电平 ,1=高电平 & & &
Combination按键定义,用户可以根据实际机型定义,RK29 SDK板目前定义为GPIO6PA1, 为VOL+按键。 &&
功能说明:
boot loader版本低于2.08(不包含)版本: & & &
1、按住recovery按键开机进loader rockusb升级模式。 & & &
2、同时按住recovery按键和combination按键开机,会引导recovery.img,进android的 recovery模式,用户可以更加菜单选择操作。 & &
boot loader版本高于2.08(包含)版本: & & &
1、按住recovery按键并接USB开机,进loader rockusb升级模式。 & &
2、按住recovery按键不接USB开机,3S左右会引导recovery.img。 & & &
3、同时按住recovery按键和combination按键开机,会引导recovery.img,进android的 recovery模式,用户可以根据菜单选择操作。 & & & &
特殊说明: & & & & &&
1、combination按键可以定义多个 &
2、通过同时按住recovery按键和combination按键进android的recovery系统时,CMDLINE会添加recovery_key参数,比如recovery_key=193,193/32=6,193%32=1,那么就是按了GPIO6的A1口组合键进recovery系统的。Recovery系统可以根据不同的按键自动完成不同的工作,比如恢复出厂设置,格式化data分区等。&
3、如果combination key功能定义错误,可能会造成没法通过recovery按键进loader rockusb升级模式,默认SDK发布的parameter不包含combination key定义。 & & &&
11. &CMDLINE:console=ttyS1,n androidboot.console=ttyS1,串口定义。 & & & &
initrd=0xx500000,第一个参数是boot.img加载到sdram的位置,第二个参数为ramdisk的大小,目前ramdisk最大不能超过8MB。&
MTD分区: &
mtdparts=rk29xxnand:0xx(misc),0xx(kernel),0xx(boot),0xx(recovery),0xx(system),0xx(backup),0xx(cache),0xx(userdata),0xx(kpanic),-@0x(user)
分区定义说明: &
例如:0xx(boot),@符号之前的数值是分区大小,@符号之后的数值是分区的起始位置,括号里面的字符是分区的名字。所有数值的单位是sector,1个sector为512Bytes.上例中,boot分区起始位置为0x8000 sectors位置,大小为0x2000 sectors(4MB). & &目前flash最大的block是4MB(0x2000 sectors),所以每个分区需要4MB对齐,也就是每个分区都必须为4MB的整数倍大小。 & &
Backup及之前的分区为固件区,在linux系统里是只读的,在确定大小后,后续升级时不能修改分区大小。 & &
Backup之后的分区在linux系统里是可读写的。在后续升级时可以调整分区大小,调整分区大小后需要进android 的recovery系统格式化cache等分区。 &
常见问题和解决办法 &
1、 system分区修改为ext3格式时,parameter的mtd分区怎么定义? &Ext3为可写文件系统,那么system分区需要定义在backup分区之后。&
2、怎么增加一个mtd分区? & & 在parameter MTD分区中按住分区定义格式增加分区,如果在系统中需要可写的,那么要把分区定义在backup分区之后,只读的,那么分区定义在backup分区之前。 &
3、由于系统固件变大,backup分区起始位置和大小变大后整个系统不正常怎么处理? & & Backup分区之前的区域为只读区域,为保证系统固件可靠性和稳定性,这个区域有做特殊处理,在第一次升级固件后就不可以把分区改大(改小不会有问题),所以在开发阶段定义分区大小时尽量预留足够空间。 & & 出现问题的机器,需要按住recovery按键进loader rockusb升级模式,等待10秒后,用量产工具或者用户工具的修复模式升级固件,也可以用开发工具的擦除idb功能低格flash后再升级固件。 &
4、combination key定义错误,没法通过recovery按键进loader rockusb升级模式怎么处理?? & &目前只能通过短路flash升级处理。 & & 所有定义combination key需要根据项目硬件来定义。 & &使用2.08之后的boot loader,通过recovery按键就可以实现选择进loader rockusb或者android 的recovery系统,具体参考前面combination key的定义。
阅读(779) | 评论(0) | 转发(0) |
相关热门文章
给主人留下些什么吧!~~
请登录后评论。posts - 92,&
comments - 175,&
trackbacks - 0
Spark提供的JdbcRDD很不好用,没法指定命名参数,而且必须要提供两个Long类型的参数表示分区的范围,如果数据表没有long类型的字段或者不需要条件,那就不能用JdbcRDD了。这里我简单重写了一个GenericJdbcRDD,支持命名参数和分区,仅仅作为参考哦。
项目结构如下:
GenericJdbcRDD.scala
package yay.jdbc.rdd
import java.sql.{Connection, ResultSet}
import org.apache.spark.annotation.DeveloperApi
import org.apache.spark.rdd.{JdbcRDD, RDD}
import org.apache.spark.{Logging, Partition, SparkContext, TaskContext}
import scala.reflect.ClassTag
* Created by ${yuananyun} on .
private[yay] class JdbcPartition(idx: Int, val lower: Long, val upper: Long) extends Partition {
override def index = idx
class GenericJdbcRDD[T: ClassTag](
sc: SparkContext,
getConnection: () =& Connection,
sql: String,
paramsMap: Map[String, Object],
skip: Long,
take: Long,
numPartitions: Int,
mapRow: (ResultSet) =& T = JdbcRDD.resultSetToObjectArray _) extends RDD[T](sc, Nil) with Logging {
@DeveloperApi
override def compute(thePart: Partition, context: TaskContext) = new JdbcNextIterator[T] {
context.addTaskCompletionListener { context =& closeIfNeeded()}
val part = thePart.asInstanceOf[JdbcPartition]
val conn = getConnection()
val stmt = conn.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY)
var parsedSql = &&
if (conn.getMetaData.getURL.matches(&jdbc:mysql:.*&)) {
parsedSql = sql+& limit &+ part.lower+&,&+ part.upper
val stmt = new NamedParameterStatement(conn, parsedSql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY)
// setFetchSize(Integer.MIN_VALUE) is a mysql driver specific way to force streaming results,
// rather than pulling entire resultset into memory.
// see /doc/refman/5.0/en/connector-j-reference-implementation-notes.html
if (conn.getMetaData.getURL.matches(&jdbc:mysql:.*&)) {
stmt.setFetchSize(Integer.MIN_VALUE)
logInfo(&statement fetch size set to: & + stmt.getFetchSize + & to force MySQL streaming &)
if (paramsMap != null && paramsMap.size & 0) {
val paramsIter = paramsMap.iterator
while (paramsIter.hasNext) {
val (key, value) = paramsIter.next()
stmt.setObject(key, value)
val rs = stmt.executeQuery()
override def getNext: T = {
if (rs.next()) {
mapRow(rs)
finished = true
null.asInstanceOf[T]
override def close() {
if (null != rs && !rs.isClosed()) {
rs.close()
case e: Exception =& logWarning(&Exception closing resultset&, e)
if (null != stmt && !stmt.isClosed()) {
stmt.close()
case e: Exception =& logWarning(&Exception closing statement&, e)
if (null != conn && !conn.isClosed()) {
conn.close()
logInfo(&closed connection&)
case e: Exception =& logWarning(&Exception closing connection&, e)
override protected def getPartitions: Array[Partition] = {
take & 0 match {
case false =& throw new IllegalArgumentException(&take 参数不能小于0&)
case _ =& {
val step = take / numPartitions
(0 until numPartitions).map(i =& {
val start = (skip + i * step)
val end = start + step
new JdbcPartition(i, start, end)
}).toArray
JdbcNextIterator.scala
package yay.jdbc.rdd
* Created by ${yuananyun} on .
abstract private[yay] class JdbcNextIterator[U] extends Iterator[U] {
private var gotNext = false
private var nextValue: U = _
private var closed = false
protected var finished = false
* Method for subclasses to implement to provide the next element.
* If no next element is available, the subclass should set `finished`
* to `true` and may return any value (it will be ignored).
* This convention is required because `null` may be a valid value,
* and using `Option` seems like it might create unnecessary Some/None
* instances, given some iterators might be called in a tight loop.
* @return U, or set 'finished' when done
protected def getNext(): U
* Method for subclasses to implement when all elements have been successfully
* iterated, and the iteration is done.
* &b&Note:&/b& `NextIterator` cannot guarantee that `close` will be
* called because it has no control over what happens when an exception
* happens in the user code that is calling hasNext/next.
* Ideally you should have another try/catch, as in HadoopRDD, that
* ensures any resources are closed should iteration fail.
protected def close()
* Calls the subclass-defined close method, but only once.
* Usually calling `close` multiple times should be fine, but historically
* there have been issues with some InputFormats throwing exceptions.
def closeIfNeeded() {
if (!closed) {
closed = true
override def hasNext: Boolean = {
if (!finished) {
if (!gotNext) {
nextValue = getNext()
if (finished) {
closeIfNeeded()
gotNext = true
override def next(): U = {
if (!hasNext) {
throw new NoSuchElementException(&End of stream&)
gotNext = false
NamedParameterStatement.java
package yay.jdbc.
import java.io.InputS
import java.io.R
import java.math.BigD
import java.net.URL;
import java.sql.*;
import java.sql.D
import java.util.*;
* This class wraps around a {@link PreparedStatement} and allows the programmer to set parameters by name instead
* of by index. This eliminates any confusion as to which parameter index represents what. This also means that
* rearranging the SQL statement or adding a parameter doesn't involve renumbering your indices.
* Code such as this:
* &pre&&code&
* Connection conn = getConnection();
* String sql = &select * from my_table where name=? or address=?&;
* PreparedStatement p = conn.prepareStatement(sql);
* p.setString(1, &bob&);
* p.setString(2, &123&);
* ResultSet rs = p.executeQuery();
* &/code&&/pre&
* Can be replaced with:
* &pre&&code&
* Connection conn = getConnection();
* String sql = &select * from my_table where name=:name or address=:address&;
* NamedParameterStatement p = new NamedParameterStatement(conn, sql);
* p.setString(&name&, &bob&);
* p.setString(&address&, &123&);
* ResultSet rs = p.executeQuery();
* &/code&&/pre&
public class NamedParameterStatement extends PreparedStatementWrapper
private static final HashMap&String, Map&String, List&Integer&&& nameIndexCache = new HashMap&String, Map&String, List&Integer&&&();
private static final HashMap&String, String& parsedSqlCache = new HashMap&String, String&();
private final String parsedS
private final Map&String, List&Integer&& nameIndexM
* Creates a NamedParameterStatement. Wraps a call to
* c.{@link Connection#prepareStatement(java.lang.String) prepareStatement}.
* @param conn the database connection
* @param sql
the parameterized sql
* @throws SQLException if the statement could not be created
public NamedParameterStatement(Connection conn, String sql,int resultSetType,int resultSetConcurrency) throws SQLException
if (nameIndexCache.containsKey(sql))
nameIndexMap = nameIndexCache.get(sql);
parsedSql = parsedSqlCache.get(sql);
nameIndexMap = new HashMap&String, List&Integer&&();
parsedSql = parseNamedSql(sql, nameIndexMap);
nameIndexCache.put(sql, nameIndexMap);
parsedSqlCache.put(sql, parsedSql);
ps = conn.prepareStatement(parsedSql,resultSetType,resultSetConcurrency);
* Returns the indexes for a parameter.
* @param name parameter name
* @return parameter indexes
* @throws IllegalArgumentException if the parameter does not exist
private List&Integer& getIndexes(String name)
List&Integer& indexes = nameIndexMap.get(name);
if (indexes == null)
throw new IllegalArgumentException(&Parameter not found: & + name);
* Parses a sql with named parameters. The parameter-index mappings
* are put into the map, and the parsed sql is returned.
* @param sql sql with named parameters
* @return the parsed sql
private static String parseNamedSql(String sql, Map&String, List&Integer&& nameIndexMap)
// I was originally using regular expressions, but they didn't work well for ignoring
// parameter-like strings inside quotes.
int length = sql.length();
StringBuffer parsedSql = new StringBuffer(length);
boolean inSingleQuote = false;
boolean inDoubleQuote = false;
int index = 1;
for (int i = 0; i & i++)
char c = sql.charAt(i);
if (inSingleQuote)
if (c == '\'')
inSingleQuote = false;
} else if (inDoubleQuote)
if (c == '&')
inDoubleQuote = false;
if (c == '\'')
inSingleQuote = true;
} else if (c == '&')
inDoubleQuote = true;
} else if (c == ':' && i + 1 & length && Character.isJavaIdentifierStart(sql.charAt(i + 1)))
int j = i + 2;
while (j & length && Character.isJavaIdentifierPart(sql.charAt(j)))
String name = sql.substring(i + 1, j);
c = '?'; // replace the parameter with a question mark
i += name.length(); // skip past the end if the parameter
List&Integer& indexList = nameIndexMap.get(name);
if (indexList == null)
indexList = new LinkedList&Integer&();
nameIndexMap.put(name, indexList);
indexList.add(index);
parsedSql.append(c);
return parsedSql.toString();
public void setArray(String name, Array value) throws SQLException
for (Integer index : getIndexes(name))
ps.setArray(index, value);
public void setAsciiStream(String name, InputStream value) throws SQLException
for (Integer index : getIndexes(name))
ps.setAsciiStream(index, value);
public void setAsciiStream(String name, InputStream value, int length) throws SQLException
for (Integer index : getIndexes(name))
ps.setAsciiStream(index, value, length);
public void setBigDecimal(String name, BigDecimal value) throws SQLException
for (Integer index : getIndexes(name))
ps.setBigDecimal(index, value);
public void setBinaryStream(String name, InputStream value) throws SQLException
for (Integer index : getIndexes(name))
ps.setBinaryStream(index, value);
public void setBinaryStream(String name, InputStream value, int length) throws SQLException
for (Integer index : getIndexes(name))
ps.setBinaryStream(index, value, length);
public void setBinaryStream(String name, InputStream value, long length) throws SQLException
for (Integer index : getIndexes(name))
ps.setBinaryStream(index, value, length);
public void setBlob(String name, Blob value) throws SQLException
for (Integer index : getIndexes(name))
ps.setBlob(index, value);
public void setBlob(String name, InputStream value) throws SQLException
for (Integer index : getIndexes(name))
ps.setBlob(index, value);
public void setBlob(String name, InputStream value, long length) throws SQLException
for (Integer index : getIndexes(name))
ps.setBlob(index, value, length);
public void setBoolean(String name, boolean value) throws SQLException
for (Integer index : getIndexes(name))
ps.setBoolean(index, value);
public void setByte(String name, byte value) throws SQLException
for (Integer index : getIndexes(name))
ps.setByte(index, value);
public void setBytes(String name, byte[] value) throws SQLException
for (Integer index : getIndexes(name))
ps.setBytes(index, value);
public void setCharacterStream(String name, Reader value) throws SQLException
for (Integer index : getIndexes(name))
ps.setCharacterStream(index, value);
public void setCharacterStream(String name, Reader value, int length) throws SQLException
for (Integer index : getIndexes(name))
ps.setCharacterStream(index, value, length);
public void setCharacterStream(String name, Reader value, long length) throws SQLException
for (Integer index : getIndexes(name))
ps.setCharacterStream(index, value, length);
public void setClob(String name, Clob value) throws SQLException
for (Integer index : getIndexes(name))
ps.setClob(index, value);
public void setClob(String name, Reader value) throws SQLException
for (Integer index : getIndexes(name))
ps.setClob(index, value);
public void setClob(String name, Reader value, long length) throws SQLException
for (Integer index : getIndexes(name))
ps.setClob(index, value, length);
public void setDate(String name, Date value) throws SQLException
for (Integer index : getIndexes(name))
ps.setDate(index, value);
public void setDate(String name, Date value, Calendar cal) throws SQLException
for (Integer index : getIndexes(name))
ps.setDate(index, value, cal);
public void setDouble(String name, double value) throws SQLException
for (Integer index : getIndexes(name))
ps.setDouble(index, value);
public void setFloat(String name, float value) throws SQLException
for (Integer index : getIndexes(name))
ps.setFloat(index, value);
public void setInt(String name, int value) throws SQLException
for (Integer index : getIndexes(name))
ps.setInt(index, value);
public void setLong(String name, long value) throws SQLException
for (Integer index : getIndexes(name))
ps.setLong(index, value);
public void setNCharacterStream(String name, Reader value) throws SQLException
for (Integer index : getIndexes(name))
ps.setNCharacterStream(index, value);
public void setNCharacterStream(String name, Reader value, long length) throws SQLException
for (Integer index : getIndexes(name))
ps.setNCharacterStream(index, value, length);
public void setNClob(String name, NClob value) throws SQLException
for (Integer index : getIndexes(name))
ps.setNClob(index, value);
public void setNClob(String name, Reader value) throws SQLException
for (Integer index : getIndexes(name))
ps.setNClob(index, value);
public void setNClob(String name, Reader value, long length) throws SQLException
for (Integer index : getIndexes(name))
ps.setNClob(index, value, length);
public void setNString(String name, String value) throws SQLException
for (Integer index : getIndexes(name))
ps.setNString(index, value);
public void setNull(String name, int sqlType) throws SQLException
for (Integer index : getIndexes(name))
ps.setNull(index, sqlType);
public void setObject(String name, Object value) throws SQLException
for (Integer index : getIndexes(name))
ps.setObject(index, value);
public void setObject(String name, Object value, int targetSqlType) throws SQLException
for (Integer index : getIndexes(name))
ps.setObject(index, value, targetSqlType);
public void setObject(String name, Object value, int targetSqlType, int scaleOrLength) throws SQLException
for (Integer index : getIndexes(name))
ps.setObject(index, value, targetSqlType, scaleOrLength);
public void setRef(String name, Ref value) throws SQLException
for (Integer index : getIndexes(name))
ps.setRef(index, value);
public void setRowId(String name, RowId value) throws SQLException
for (Integer index : getIndexes(name))
ps.setRowId(index, value);
public void setShort(String name, short value) throws SQLException
for (Integer index : getIndexes(name))
ps.setShort(index, value);
public void setSQLXML(String name, SQLXML value) throws SQLException
for (Integer index : getIndexes(name))
ps.setSQLXML(index, value);
public void setString(String name, String value) throws SQLException
for (Integer index : getIndexes(name))
ps.setString(index, value);
public void setTime(String name, Time value) throws SQLException
for (Integer index : getIndexes(name))
ps.setTime(index, value);
public void setTime(String name, Time value, Calendar cal) throws SQLException
for (Integer index : getIndexes(name))
ps.setTime(index, value, cal);
public void setTimestamp(String name, Timestamp value) throws SQLException
for (Integer index : getIndexes(name))
ps.setTimestamp(index, value);
public void setTimestamp(String name, Timestamp value, Calendar cal) throws SQLException
for (Integer index : getIndexes(name))
ps.setTimestamp(index, value, cal);
@SuppressWarnings(&deprecation&)
public void setUnicodeStream(String name, InputStream value, int length) throws SQLException
for (Integer index : getIndexes(name))
ps.setUnicodeStream(index, value, length);
public void setURL(String name, URL value) throws SQLException
for (Integer index : getIndexes(name))
ps.setURL(index, value);
PreparedStatementWrapper.java
package yay.jdbc.
import java.io.InputS
import java.io.R
import java.math.BigD
import java.net.URL;
import java.sql.*;
import java.util.C
public class PreparedStatementWrapper implements PreparedStatement
protected PreparedS
public &T& T unwrap(Class&T& iface) throws SQLException
return ps.unwrap(iface);
public ResultSet executeQuery(String sql) throws SQLException
return ps.executeQuery(sql);
public ResultSet executeQuery() throws SQLException
return ps.executeQuery();
public boolean isWrapperFor(Class&?& iface) throws SQLException
return ps.isWrapperFor(iface);
public int executeUpdate(String sql) throws SQLException
return ps.executeUpdate(sql);
public int executeUpdate() throws SQLException
return ps.executeUpdate();
public void setNull(int parameterIndex, int sqlType) throws SQLException
ps.setNull(parameterIndex, sqlType);
public void close() throws SQLException
ps.close();
public int getMaxFieldSize() throws SQLException
return ps.getMaxFieldSize();
public void setBoolean(int parameterIndex, boolean x) throws SQLException
ps.setBoolean(parameterIndex, x);
public void setByte(int parameterIndex, byte x) throws SQLException
ps.setByte(parameterIndex, x);
public void setMaxFieldSize(int max) throws SQLException
ps.setMaxFieldSize(max);
public void setShort(int parameterIndex, short x) throws SQLException
ps.setShort(parameterIndex, x);
public int getMaxRows() throws SQLException
return ps.getMaxRows();
public void setInt(int parameterIndex, int x) throws SQLException
ps.setInt(parameterIndex, x);
public void setMaxRows(int max) throws SQLException
ps.setMaxRows(max);
public void setLong(int parameterIndex, long x) throws SQLException
ps.setLong(parameterIndex, x);
public void setEscapeProcessing(boolean enable) throws SQLException
ps.setEscapeProcessing(enable);
public void setFloat(int parameterIndex, float x) throws SQLException
ps.setFloat(parameterIndex, x);
public void setDouble(int parameterIndex, double x) throws SQLException
ps.setDouble(parameterIndex, x);
public int getQueryTimeout() throws SQLException
return ps.getQueryTimeout();
public void setQueryTimeout(int seconds) throws SQLException
ps.setQueryTimeout(seconds);
public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException
ps.setBigDecimal(parameterIndex, x);
public void setString(int parameterIndex, String x) throws SQLException
ps.setString(parameterIndex, x);
public void setBytes(int parameterIndex, byte[] x) throws SQLException
ps.setBytes(parameterIndex, x);
public void cancel() throws SQLException
ps.cancel();
public SQLWarning getWarnings() throws SQLException
return ps.getWarnings();
public void setDate(int parameterIndex, Date x) throws SQLException
ps.setDate(parameterIndex, x);
public void setTime(int parameterIndex, Time x) throws SQLException
ps.setTime(parameterIndex, x);
public void clearWarnings() throws SQLException
ps.clearWarnings();
public void setCursorName(String name) throws SQLException
ps.setCursorName(name);
public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException
ps.setTimestamp(parameterIndex, x);
public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException
ps.setAsciiStream(parameterIndex, x, length);
public boolean execute(String sql) throws SQLException
return ps.execute(sql);
@SuppressWarnings(&deprecation&)
public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException
ps.setUnicodeStream(parameterIndex, x, length);
public ResultSet getResultSet() throws SQLException
return ps.getResultSet();
public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException
ps.setBinaryStream(parameterIndex, x, length);
public int getUpdateCount() throws SQLException
return ps.getUpdateCount();
public boolean getMoreResults() throws SQLException
return ps.getMoreResults();
public void clearParameters() throws SQLException
ps.clearParameters();
public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException
ps.setObject(parameterIndex, x, targetSqlType);
public void setFetchDirection(int direction) throws SQLException
ps.setFetchDirection(direction);
public int getFetchDirection() throws SQLException
return ps.getFetchDirection();
public void setObject(int parameterIndex, Object x) throws SQLException
ps.setObject(parameterIndex, x);
public void setFetchSize(int rows) throws SQLException
ps.setFetchSize(rows);
public int getFetchSize() throws SQLException
return ps.getFetchSize();
public int getResultSetConcurrency() throws SQLException
return ps.getResultSetConcurrency();
public boolean execute() throws SQLException
return ps.execute();
public int getResultSetType() throws SQLException
return ps.getResultSetType();
public void addBatch(String sql) throws SQLException
ps.addBatch(sql);
public void clearBatch() throws SQLException
ps.clearBatch();
public void addBatch() throws SQLException
ps.addBatch();
public int[] executeBatch() throws SQLException
return ps.executeBatch();
public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException
ps.setCharacterStream(parameterIndex, reader, length);
public void setRef(int parameterIndex, Ref x) throws SQLException
ps.setRef(parameterIndex, x);
public void setBlob(int parameterIndex, Blob x) throws SQLException
ps.setBlob(parameterIndex, x);
public void setClob(int parameterIndex, Clob x) throws SQLException
ps.setClob(parameterIndex, x);
public Connection getConnection() throws SQLException
return ps.getConnection();
public void setArray(int parameterIndex, Array x) throws SQLException
ps.setArray(parameterIndex, x);
public ResultSetMetaData getMetaData() throws SQLException
return ps.getMetaData();
public boolean getMoreResults(int current) throws SQLException
return ps.getMoreResults(current);
public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException
ps.setDate(parameterIndex, x, cal);
public ResultSet getGeneratedKeys() throws SQLException
return ps.getGeneratedKeys();
public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException
ps.setTime(parameterIndex, x, cal);
public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException
return ps.executeUpdate(sql, autoGeneratedKeys);
public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException
ps.setTimestamp(parameterIndex, x, cal);
public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException
ps.setNull(parameterIndex, sqlType, typeName);
public int executeUpdate(String sql, int[] columnIndexes) throws SQLException
return ps.executeUpdate(sql, columnIndexes);
public void setURL(int parameterIndex, URL x) throws SQLException
ps.setURL(parameterIndex, x);
public int executeUpdate(String sql, String[] columnNames) throws SQLException
return ps.executeUpdate(sql, columnNames);
public ParameterMetaData getParameterMetaData() throws SQLException
return ps.getParameterMetaData();
public void setRowId(int parameterIndex, RowId x) throws SQLException
ps.setRowId(parameterIndex, x);
public void setNString(int parameterIndex, String value) throws SQLException
ps.setNString(parameterIndex, value);
public boolean execute(String sql, int autoGeneratedKeys) throws SQLException
return ps.execute(sql, autoGeneratedKeys);
public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException
ps.setNCharacterStream(parameterIndex, value, length);
public void setNClob(int parameterIndex, NClob value) throws SQLException
ps.setNClob(parameterIndex, value);
public void setClob(int parameterIndex, Reader reader, long length) throws SQLException
ps.setClob(parameterIndex, reader, length);
public boolean execute(String sql, int[] columnIndexes) throws SQLException
return ps.execute(sql, columnIndexes);
public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException
ps.setBlob(parameterIndex, inputStream, length);
public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException
ps.setNClob(parameterIndex, reader, length);
public boolean execute(String sql, String[] columnNames) throws SQLException
return ps.execute(sql, columnNames);
public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException
ps.setSQLXML(parameterIndex, xmlObject);
public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException
ps.setObject(parameterIndex, x, targetSqlType, scaleOrLength);
public int getResultSetHoldability() throws SQLException
return ps.getResultSetHoldability();
public boolean isClosed() throws SQLException
return ps.isClosed();
public void setPoolable(boolean poolable) throws SQLException
ps.setPoolable(poolable);
public boolean isPoolable() throws SQLException
return ps.isPoolable();
public void closeOnCompletion() throws SQLException
ps.closeOnCompletion();
public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException
ps.setAsciiStream(parameterIndex, x, length);
public boolean isCloseOnCompletion() throws SQLException
return ps.isCloseOnCompletion();
public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException
ps.setBinaryStream(parameterIndex, x, length);
public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException
ps.setCharacterStream(parameterIndex, reader, length);
public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException
ps.setAsciiStream(parameterIndex, x);
public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException
ps.setBinaryStream(parameterIndex, x);
public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException
ps.setCharacterStream(parameterIndex, reader);
public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException
ps.setNCharacterStream(parameterIndex, value);
public void setClob(int parameterIndex, Reader reader) throws SQLException
ps.setClob(parameterIndex, reader);
public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException
ps.setBlob(parameterIndex, inputStream);
public void setNClob(int parameterIndex, Reader reader) throws SQLException
ps.setNClob(parameterIndex, reader);
具体的用法:
object SparkToJDBC {
def main(args: Array[String]): Unit = {
val sc = new SparkContext(&local&, &mySql&)
val paramsMap = Map[String, Object](&msgType& -& &99&, &sendTime& -& &6&)
val rdd = new GenericJdbcRDD(sc, () =& {
Class.forName(&com.mysql.jdbc.Driver&).newInstance()
DriverManager.getConnection(&jdbc:mysql://xxxxxxxx?characterEncoding=utf-8&, &root&, &xxxxx&)
}, &SELECT * FROM emb_message where msg_type=:msgType and send_time&=:sendTime&,
paramsMap, 0, 1000, 3, r =& (r.getString(6),r.getString(11)))
rdd.foreach(x =& println(x))
rdd.saveAsTextFile(&c:\\temp\\test&)
红色部分:其中paramsMap表示要传给sql的命名参数,0和1000分别表示skip和take,3表示生成的Rdd的partition数。
阅读(...) 评论()}

我要回帖

更多关于 新增分区 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信