六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 28|回复: 0

MySql与Java 数据类型转换

[复制链接]

升级  60%

6

主题

6

主题

6

主题

童生

Rank: 1

积分
30
 楼主| 发表于 2013-1-29 07:48:24 | 显示全部楼层 |阅读模式
<style type="text/css">body { background:#ffffff; color:#202020; margin:0px; padding:0px; }a{ background:transparent; }a:link { color:#006486; }a:active { color:#1d93b6; }a:visited { color:#464646; }a:hover { color:#1d93b6; }/* work around issue with docbook-generated pages */a[id]:hover { color: inherit;}a img { border: none; }p{ margin:0px 0px 12px 0px; padding:0px; }dd { margin: 1em 0em 1em 2em; }p.error, div.error { color: #d0670a; }tr.error { background: #ffde84; }/* Useful clear elements */hr.clear{ clear:both; margin:0px; padding:0px; visibility:hidden; }br.clear{ clear:both; margin:0px; padding:0px; }/* Horisontal rules - check if this can be simplifyed */div.gray1{ margin:8px 0px; padding:0px; height:3px; background:#fff url("gray1000.png") repeat-x; }div.gray1 hr { display:none; }div.gray2{ margin:8px 0px; padding:0px; height:3px; background:#fff url("gray2000.png") repeat-x; }div.gray2 hr { display:none; }div.orange1{ margin:8px 0px; padding:0px; height:3px; background:#fff url("orange10.png") repeat-x; }div.orange1 hr { display:none; }div.orange2{ margin:8px 0px; padding:0px; height:3px; background:#fff url("orange20.png") repeat-x; }div.orange2 hr { display:none; }div.yellow1{ margin:8px 0px; padding:0px; height:3px; background:#fff url("yellow10.png") repeat-x; }div.yellow1 hr { display:none; }div.yellow2{ margin:8px 0px; padding:0px; height:3px; background:#fff url("yellow20.png") repeat-x; }div.yellow2 hr { display:none; }/* The top background graphics for Devzone, Solution Center and Online Shop */#header{ position:absolute; top:0px; left:0px; width:98%; height:75px; max-width:980px; }body.dev #header { background:#004e61 url("dz000000.jpg") repeat-y; }body.solutions #header { background:#fffbc9 url("sol00000.jpg") repeat-y; }body.order #header { background:#c8e0e8 url("shop0000.jpg") repeat-y; }/* LayoutThe container div embrace the whole layout; max-width and min-width won't work on Internet Explorer */#container{ position:relative; max-width:1000px; min-width:760px; }#logo{ position:absolute; top:10px; left:2.3%; margin:0px; padding:0px; z-index:50; }#tag{ position:absolute; top:13px; left:17%; margin:0px; padding:0px; z-index:50; }#head{ position:absolute; left:1%; top:10px; width:97%; height:100%; text-align:right; margin:0px; padding:0px; }#search{ float:right; width:400px; margin:0px 4px 0px 0px; }#searchbox{ background:url("gray1000.png") repeat-x bottom; padding-bottom:6px; float:right; }.toplogin{ float:right; margin:2px 10px 0px 0px; }#worldwide{ clear:right; float:right; }#page{ padding-top:8px; }.lCol  { float:left; width:49%; margin-right:1%; background:#fff; }.rCol { float:left; width:49%; background:#fff; }.col15 { float:left; width:15%; background:transparent; }.col33 { float:left; width:33%; background:transparent; }.col49 { float:left; width:49%; background:transparent; }.col66 { float:left; width:66%; background:transparent; }.col84 { float:left; width:84%; background:transparent; }.col99 { float:left; width:99%; background:transparent; }.bluebox{ margin:0px; padding:10px 16px 12px 12px; background:#dae6ea; }.lCol .indent { margin:0px 12px 0px 12px; padding:0px; }.rCol .indent { margin:0px 0px 0px 12px; padding:0px; }.col15 .indent { margin:0px 12px 0px 12px; padding:0px; }.col33 .indent { margin:0px 12px 0px 12px; padding:0px; }.col49 .indent { margin:0px 12px 0px 12px; padding:0px; }.col66 .indent { margin:0px 12px 0px 12px; padding:0px; }.col84 .indent { margin:0px 12px 0px 12px; padding:0px; }.col99 .indent { margin:0px 12px 0px 12px; padding:0px; }/* Start page things */.feature{ background:#0d6d90 url("tco-bg00.jpg") no-repeat; width:100%; }/* Developer Zone things */.devdot{ background:url("devdotbg.gif") no-repeat right top; height:250px; }.searchmanual{ margin:0px; padding:10px 16px 12px 12px; background:#e3ebe2; }#docnav{ float:right; margin:0px 0px 8px 8px; }/* Partner Solution things */#featpartner{ float:right; border:1px solid #ffde84; margin:8px 0px 8px 8px; text-align:center; width:124px; padding:4px; background:#fff; }#portalsidebar{ text-align:center; width:100%; margin-bottom:4px; }#portalabout{ margin:0px; padding:10px 16px 12px 12px; background:#fffbc9; }body.solutions .searchbox{ background:#ffde84; padding:12px; }.searchbar{ margin:0px; padding:0px; width:100%; }.searchbar .left{ width:50%; float:left; }.searchbar .right{ width:50%; float:left; text-align:right; }/* Online Shop *//* border to avoid bug in mozilla 1.2/netscape 7.0 */.darkbluebox{ float:left; width:48%; background:#004e61; color:#fff; border: 1px solid #004e61; }.darkbluebox a:link { color:#fff; }.darkbluebox a:visited{ color:#fff; }.darkbluebox a:hover { color:#64bfdb; }.darkbluebox a:active{ color:#64bfdb; }.lightbluebox { float:left; width:48%; background:#1d93b6; margin-right:10px; color:#fff; border: 1px solid #1d93b6; }#cart{ background:#c8e0e8 url("cartbg-t.gif") repeat-x; padding:0px; }#cart h4{ padding-left:16px; background:url("cart0000.gif") no-repeat 0px 2px;  }#cartline{ background:url("cartbg-b.gif") repeat-x bottom; padding:10px 0px; }.shoppingcart{ width:100%; }.shoppingcart tr.total td { padding-top:8px; }.checkout, .edit { background:#1d93b6; padding:2px 8px 4px 8px; color:#fff; }a.checkout:link { color:#fff; }a.checkout:visited{ color:#fff; }a.checkout:hover { color:#64bfdb; }a.checkout:active{ color:#64bfdb; }a.edit:link { color:#fff; }a.edit:visited{ color:#fff; }a.edit:hover { color:#64bfdb; }a.edit:active{ color:#64bfdb; }.addtocart{ background:#c8e0e8 url("cart0000.gif"); background-repeat:no-repeat; background-position:5px 5px; border:1px solid #004e61; padding:2px 8px 4px 20px; font-weight:bold; font-size:90%; }.moreinfo{ background:#fff; border:1px solid #004e61; padding:2px 8px 4px 8px; font-weight:bold; font-size:90%; }/* Comments - both DevZone and Partner Solution subsites */#comments { padding:10px; margin:10px 0px; width: 100%; }body.dev #comments { background:#e3ebe2; }body.solutions #comments { background:#fffbc9; }.commentdetails { font-weight:bold; padding:4px 0px 8px 0px; width:100%; }body.dev .commentdetails {  border-top:1px solid #666; }body.solutions .commentdetails { border-top:1px solid #ffde84; }/* Typography*//* Font settings and special treatment of text - color etc. */body{ font:70%/126% verdana, arial, helvetica, sans-serif; }strong{ font-style:normal; font-weight:bold; }h1{ font:160% verdana, arial, helvetica, sans-serif; margin:0px 0px 8px 0px; }h2{ font:bold 130% verdana, arial, helvetica, sans-serif; margin:0px 0px 12px 0px; }h3{ font:bold 120% verdana, arial, helvetica, sans-serif; margin:0px 0px 12px 0px; }h4{ font:bold 110% verdana, arial, helvetica, sans-serif; margin:0px 0px 12px 0px; }h5{ font:bold 90% verdana, arial, helvetica, sans-serif; letter-spacing:1px; margin:10px 0px; }h2.dev{ font:bold 140% verdana, arial, helvetica, sans-serif; color:#65816a; }h2.sol{ font:bold 140% verdana, arial, helvetica, sans-serif; color:#ea8a29; }p.s, #footer p { font-size:90%; }#tabs li, th{ font:90% verdana, arial, helvetica, sans-serif; }#tabs li #current { font:bold 90% verdana, arial, helvetica, sans-serif; }.frm, select, textarea, .submit, .submit2, .submit3 { font-family:verdana, arial, helvetica, sans-serif; }.frm, select{ font-size:95%; }p .orange{ color:#ea8a29; }pre { color:#74240f; }code{ color:#761596; }code.md5    { color:inherit; }tt{ color:#761596; }samp{ color:#761596; }.border{ border:1px solid #7f7f7f; padding:10px 10px 4px 10px; margin:30px 0px; }/* Lists */#page ul{ font-size:inherit; margin:0px 4px 8px 16px; padding:0px; }#page ul li{ margin-bottom:1px; }#page ul .date{ font-size:90%; }body.www #page ul{ list-style:url("list-ora.png"); }body.dev #page ul{ list-style:url("list-gre.png"); }body.solutions #page ul{ list-style:url("list-ora.png"); }body.order #page ul{ list-style:url("list-ora.png"); }body.dev #page ul ul { list-style-type:none; list-style-image:none; margin-left:0px; }ul.orange{ margin:0px 4px 8px 16px; padding:0px; list-style:url("list-ora.png"); }#page dt{ font-weight:bold; }#toc .top{ list-style:url("top00000.png"); }#toc .gp, #toc .p{ list-style:url("up000000.png"); }/* The text at the top */body.dev #tag p{ font-weight:bold; letter-spacing:0.3em; color:#bdcebb; margin-left:87px; }body.solutions #tag p{ font-weight:bold; letter-spacing:0.3em; color:#ea8a29; margin-left:87px; }body.order #tag p{ font-weight:bold; letter-spacing:0.3em; color:#004e61; margin-left:87px; }/* Footer menu*/#page #footer{ width:99%; margin:8px 0px; padding:8px 0px; border-top:1px solid #006486; color:#555; }#page #footer p{ margin:0px 12px 0px 12px; float:left; }#page #footer p img  { position:relative; top:4px; }#page #footer ul{ margin:0px; padding:0px; list-style:none; float:left; width: 60%; }#page #footer li{ font-size:90%; margin:0px; padding:0px 8px 0px 6px; float:left; background:url("sep00000.png") no-repeat right top; }#page #footer li.last{ background:none; }/* Forms*/form{ margin:0px; padding:0px; }.radio, .check{ position:relative; top:3px; } /* ...makes it look corny on Safari. Must check. */fieldset{ margin:8px 0px; padding:12px; border:1px solid #ccc; }legend{ font-weight:bold; color:#333; margin:0px 4px; }.frm{ border:1px solid #7f7f7f; padding:2px 1px 0px 1px; line-height:110%; }.submit{ background:#006486; border:0px; padding:0px; color:#fff; font-weight:bold; font-size:100%; border:1px solid #006486; }.submit2{ background:#006486; padding:0px; margin:0px; color:#fff; font-weight:bold; font-size:90%; border:1px solid #006486; }.submit3{ background:#006486; padding:0px; margin:0px; color:#fff; font-weight:bold; font-size:90%; position:relative; top:-1px; border:1px solid #006486; }/* Tables */table.solutionlisting th { margin:0px; padding:3px 4px; background:#fffbc9; font-weight:bold; }table.solutionlisting td { margin:0px; padding:8px 8px 4px 4px; border-top:1px solid #ffde84; }body.www table.styled           { border-bottom:1px solid #e2e9eb; margin: 1em 0px; }body.www table.styled th{ margin:0px; padding:3px 4px; background:#e2e9eb; font-weight:bold; }body.www table.styled td { margin:0px; padding:8px 8px 4px 4px; border-top:1px solid #e2e9eb; }body.dev table.styled   { border-bottom:1px solid #bdcebb; margin: 1em 0px; }body.dev table.styled th{ margin:0px; padding:3px 4px; background:#bdcebb; font-weight:bold; }body.dev table.styled td { margin:0px; padding:8px 8px 4px 4px; border-top:1px solid #bdcebb; }body.solutions table.styled    { border-bottom:1px solid #fffbc9; margin: 1em 0px; }body.solutions table.styled th{ margin:0px; padding:3px 4px; background:#fffbc9; font-weight:bold; }body.solutions table.styled td { margin:0px; padding:8px 8px 4px 4px; border-top:1px solid #fffbc9; }body.order table.styled    { border-bottom:1px solid #e2e9eb; margin: 1em 0px; }body.order table.styled th{ margin:0px; padding:3px 4px; background:#e2e9eb; font-weight:bold; }body.order table.styled td { margin:0px; padding:8px 8px 4px 4px; border-top:1px solid #e2e9eb; }table.styled th.title{ font-size: 120%; }/* Promo boxes */.promo1{ padding:6px 10px; margin:10px 0px; background:#dae6ea; }.promo2{ padding:6px 10px; margin:10px 0px; background:#1d93b6; color:#fff; }.promo3{ padding:6px 10px; margin:10px 0px; background:#004e61; color:#fff; }.promo4{ padding:6px 10px; margin:10px 0px; background:#d0670a; color:#fff; }.promo5{ padding:6px 10px; margin:10px 0px; background:#bdcebb; }.promo6{ padding:6px 10px; margin:10px 0px; background:#fffbc9; }.promo7{ padding:6px 10px; margin:10px 0px; background:#ffde84; }.promo2 a:link { color:#fff; }.promo2 a:visited{ color:#fff; }.promo2 a:hover{ color:#64bfdb; }.promo2 a:active{ color:#64bfdb; }.promo3 a:link { color:#fff; }.promo3 a:visited{ color:#fff; }.promo3 a:hover{ color:#64bfdb; }.promo3 a:active{ color:#64bfdb; }.promo4 a:link { color:#fff; }.promo4 a:visited{ color:#fff; }.promo4 a:hover{ color:#64bfdb; }.promo4 a:active{ color:#64bfdb; }.getcert{ background:#ffde84 url("getcert-.jpg") no-repeat; width:100%; height:118px; margin:8px 0px; }.getcerttext{ padding:42px 0px 0px 114px; }.becpart{ background:#004e61 url("becpart-.gif") no-repeat top right; width:100%; height:128px; text-align:right; color:#fff; margin:8px 0px; }.becparttext{ padding:40px 90px 0px 10px; }.getbox{ background:#e2e9eb url("getbox-b.gif") no-repeat; padding:17px 0px 8px 100px; margin:8px 0px; }.tcobox{ background:#1d93b6; color:#fff; padding:12px 8px 8px 16px; margin:8px 0px; }.clusterbox{ border:1px solid #999; padding:8px 16px; margin:8px 0px; }.enercon { border:1px solid #999; background:#fff url("sap-part.png") no-repeat; background-position:8px 14px; padding:12px 8px 8px 110px; margin:8px 0px; } .yahoo{ border:1px solid #d0670a; background:#fff url("yahoo000.gif") no-repeat; background-position:16px 18px; margin:8px 0px; }.yahootext{ padding:10px 10px 10px 110px; }.coxbox{ background:#006486; color:#fff; padding:12px 8px 8px 16px; margin:8px 0px; }a.white:link { color:#fff; }a.white:visited{ color:#fff; }a.white:hover { color:#64bfdb; }a.white:active{ color:#64bfdb; }p.byline { font-size: smaller; font-weight: bold;}/* downloads.mysql.com */body.downloads #page ul, body.lists #page ul { list-style:url("list-gre.png"); }body.downloads #header { background:#004e61 url("download.jpg") repeat-y; }body.downloads #tag p{ font-weight:bold; letter-spacing:0.3em; color:#bdcebb; margin-left:87px; }.snap1{ width:45%; margin:0px 2% 10px 0px; float:left; padding:0px; }.snap1 h4{ margin:0px 0px 1px 0px; padding:0px 0px 0px 8px; }body.downloads #page .snap1 ul{ background:url("devbigdo.gif") repeat-x; list-style:none; margin:0px; padding:4px 0px 8px 0px; }.snap1 li{ margin:0px; padding:4px 0px 2px 8px; line-height:120%; }.snap1 code{ color:#000; }body.downloads #page .odd ul{ background-color:#e3ebe2; }body.downloads #page .even ul{ background-color:#f4f4ee; }.archive p{ margin:1px 0px 0px 0px; padding:2px 4px; }.archive code{ color:#000; }.odd p{ background-color:#e3ebe2; }.even p{ background-color:#f4f4ee; }/* lists.mysql.com */body.lists #header { background:#004e61 url("lists000.jpg") repeat-y; }body.lists #tag p{ font-weight:bold; letter-spacing:0.3em; color:#bdcebb; margin-left:87px; }.headerlabel{ background:#e3ebe2; }.headervalue{ background:#f4f4ee; }body.lists pre{ color:#202020; }.quote1 { color: #006486; }.quote2 { color: #900; }.quote3 { color: #a36008; }.quote0 { color: #909; }.thread { background:#f4f4ee; padding:4px; }#datenav { list-style: none; margin: 0px; padding: 0px; font-weight: bold; font-size:90%;}#datenav li { display: inline;}/* bugs.mysql.com */body.bugs #header { background:#004e61 url("bugs0000.jpg") repeat-y; }body.bugs #tag p{ font-weight:bold; letter-spacing:0.3em; color:#bdcebb; margin-left:87px; }.bugs td{ padding:4px 8px 4px 0px; }.lightgreenbox{ margin:0px; padding:10px 16px 12px 12px; background:#f4f4ee; }.greenbox{ margin:0px; padding:10px 16px 12px 12px; background:#e3ebe2; }.buglist{ width:100%; }.buglist th{ background:#bdcebb; padding:6px 8px; font-weight:bold; }.buglist td{ padding:2px 8px; }.buglist tr.open td{ background:#ea8a29; }.buglist tr.closed td{ background:#f4f4ee; }.buglist tr.duplicate td{ background:#d9d9d9; }.buglist tr.verified td{ background:#bdcebb; }.buglist tr.pending td{ background:#ffde84; }.buglist tr.approved td{ background:#fffbc9; }.buglist tr.deferred td{ background:#d9d9d9; }.buglist tr.wontfix td{ background:#d9d9d9; }.buglist tr.cantrepeat td{ background:#d9d9d9; }.buglist tr.nofeed td{ background:#a0cddb; }.buglist tr.needfeed td{ background:#64bfdb; }.buglist tr.oldfeed td{ background:#64bfdb; }.buglist tr.nobug td{ background:#d9d9d9; }.buglisttop{ background:#e3ebe2; width:100%; border:2px solid #fff; }.buglisttop td { padding:4px 8px; }/* hosting */.blueborder{ margin:0px; padding:10px 16px 8px 12px; border:1px solid #006486; }.blueborder h3{ margin-bottom:2px; }.whiteborder{ margin:0px; padding:2px 8px; border:1px solid #fff; }.lbborder{ margin:0px; padding:2px 8px; border:1px solid #64bfdb; }li.mark{ background:#e2e9eb; font-weight:bold; }p.price { font-size:110%; font-weight:bold; color:#006486; }.go{ float:right; color:#fff; background:#006486; padding:3px; font-weight:bold; }.hostingfeat { background:#1d93b6 url("hosting0.jpg") no-repeat right bottom; padding:20px 150px 16px 16px; color:#fff; }.hostingfeat2 { background:#1d93b6; padding:20px 8px 16px 16px; color:#fff; }.stamp{ float:right; position:relative; top:-8px; }.emh{ margin:0px; padding:10px 8px 8px 12px; background:#006486 url("emh-bg00.jpg") no-repeat; }.emh h3{ color:#fffbc9; }.emh p{ color:#fff; }strong.orange{ color:#ea8a29; }/* Added For Hosting Signup */.mainButton{ background:#c8e0e8; border:1px solid #004e61; padding:2px 8px 4px 8px; font-weight:bold; font-size:120%; }.focusBox{ background:#e3ebe2; border:1px solid #004e61; padding:3px 3px 3px 3px; }.shadedArea{ background:#ececec; }.notice {font-weight: bold;color: #990000;}.signupTitle{ font-weight:bold; font-size:120%; width:99%; margin:8px 0px; color:#64bfdb; padding-bottom: 5px; border-bottom:1px solid #006486; color:#555; }.signupContent {margin-left: 20px; margin-right: 20px;}.accbillhead {color: #000000; background-color: #ececec}.accdethead {font-weight: bold; color: #000000; background-color: #ececec}.accdetprice {color: #000000}.accdettable {background-color: #CCCCCC; border: none; border-color: #ececec}.accdetvalue {font-weight: bold; color: #000000; background-color: #FFFFFF}.accfeatspec {font-weight: bold; color: #004e61}.accprice {color: #FFCC00}.accpricetable {background-color: #cccccc}.accspec {color: #CC0000; font: bold 12px Arial, Helvetica}.accspecprice {font-weight: bold; color: #009900}.acctablebgc {background-color: #004e61}.acctitle {font-weight: bold}.acctype {font-weight: bold; color: #FFFFFF; background-color: #004e61}</style>
Type Conversions Supported by MySQL Connector/J

MySQL Connector/J is flexible in the way it handles conversions between MySQL data types and Java data types.
In general, any MySQL data type can be converted to a java.lang.String, and any numerical type can be converted to any of the Java numerical types, although round-off, overflow, or loss of precision may occur.
The conversions that are always guaranteed to work are listed in the following table:
<div class="table"><a name="id2805782" />Table A.1. Conversion Table
[table][tr]These MySQL Data TypesCan always be converted to these Java types[/tr][tr][td]CHAR, VARCHAR, BLOB, TEXT, ENUM, and SET[/td][td]java.lang.String, java.io.InputStream, java.io.Reader, java.sql.Blob, java.sql.Clob[/td][/tr][tr][td]FLOAT, REAL, DOUBLE PRECISION, NUMERIC, DECIMAL, TINYINT, SMALLINT, MEDIUMINT, INTEGER, BIGINT[/td][td]java.lang.String, java.lang.Short, java.lang.Integer, java.lang.Long, java.lang.Double, java.math.BigDecimal <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">Note

round-off, overflow or loss of precision may occur if you choose a Java numeric data type that has less precision or capacity than the MySQL data type you are converting to/from.
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表