Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

java access sql

JDBCÁ¬½ÓMySQL
¼ÓÔؼ°×¢²áJDBCÇý¶¯³ÌÐò
Class.forName("com.mysql.jdbc.Driver");
Class.forName("com.mysql.jdbc.Driver").newInstance();
JDBC URL ¶¨ÒåÇý¶¯³ÌÐòÓëÊý¾ÝÔ´Ö®¼äµÄÁ¬½Ó
±ê×¼Óï·¨£º
<protocol£¨Ö÷ҪͨѶЭÒ飩>:<subprotocol£¨´ÎҪͨѶЭÒ飬¼´Çý¶¯³ÌÐòÃû³Æ£©>:<data source identifier£¨Êý¾ÝÔ´£©>
MySQLµÄJDBC URL¸ñʽ£º
jdbc:mysql//[hostname][:port]/[dbname][?param1=value1][&param2=value2]….

ʾÀý£ºjdbc:mysql://localhost:3306/sample_db?user=root&password=your_password

³£¼û²ÎÊý£º
user ̞
password ÃÜÂë
autoReconnect Áª»úʧ°Ü£¬ÊÇ·ñÖØÐÂÁª»ú£¨true/false£©
maxReconnect ³¢ÊÔÖØÐÂÁª»ú´ÎÊý
initialTimeout ³¢ÊÔÖØÐÂÁª»ú¼ä¸ô
maxRows ´«»Ø×î´óÐÐÊý
useUnicode ÊÇ·ñʹÓÃUnicode×ÖÌå±àÂ루true/false£©
characterEncoding ºÎÖÖ±àÂ루GB2312/UTF-8/…£©
relaxAutocommit ÊÇ·ñ×Ô¶¯Ìá½»£¨true/false£©
capitalizeTypeNames Êý¾Ý¶¨ÒåµÄÃû³ÆÒÔ´óд±íʾ
½¨Á¢Á¬½Ó¶ÔÏó
String url="jdbc:mysql://localhost:3306/sample_db?user=root&password=your_password";
Connection con = DriverManager.getConnection(url);
½¨Á¢SQL³ÂÊöʽ¶ÔÏó£¨Statement Object£©
Statement stmt = con.createStatement()£»
Ö´ÐÐSQLÓï¾ä
executeQuery()
String query = "select * from test";
ResultSet rs=stmt.executeQuery(query);
½á¹û¼¯ResultSet
while(rs.next())
{rs.getString(1);rs.getInt(2);}
executeUpdate()
String upd="insert into test (id,name) values(1001,xuzhaori)";
int con=stmt.executeUpdate(upd);
execute()


Ïà¹ØÎĵµ£º

JavaÖÐ ArrayList¡¢VectorºÍLinkedList µÄʹÓÃ


ArrayListÊÇ×î³£ÓõÄListʵÏÖÀ࣬ÄÚ²¿ÊÇͨ¹ýÊý×éʵÏֵģ¬ËüÔÊÐí¶ÔÔªËؽøÐпìËÙËæ»ú·ÃÎÊ¡£Êý×éµÄȱµãÊÇÿ¸öÔªËØÖ®¼ä²»Äܺ¬ÓГ¿Õ϶”£¬µ±Êý×é´óС²»Âú×ãʱÐèÒªÔö¼Ó´æ´¢ÄÜÁ¦£¬¾ÍÒª½«ÒÑÓÐÊý×éÊý¾Ý¸´ÖƵ½ÐµĴ洢¿Õ¼äÖС£µ±´ÓArrayListµÄÖмäλÖòåÈë»òÕßɾ³ýÔªËØʱ£¬ÐèÒª¶ÔÊý×é½øÐи´ÖÆ¡¢Òƶ¯£¬´ú¼Û±È½Ï¸ß¡£Òò´Ë£¬ ......

javaʱ¼äº¯Êý

 http://blog.sina.com.cn/s/blog_503cf9f80100b9lf.html
javaʱ¼äº¯Êý(2008-12-06 22:25:46)
<> ±êÇ©£ºÔÓ̸ 
×¢Ò⣺java.utilºÍjava.sqlÖж¼ÓÐDateÕâ¸öÀ࣬²»ÖªµÀÓÃÄÄÒ»¸öÁË£¬Äã¿ÉÒÔдËÀjava.sql.Date time = .....
1. Java¼ÆËãʱ¼äÒÀ¿¿1970Äê1ÔÂ1ÈÕ¿ªÊ¼µÄºÁÃëÊý.     &nbs ......

java¸ñʽ»¯ÈÕÆÚʱ¼äµÄº¯Êý

Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyÄêMMÔÂddÈÕ HH:mm:ss");
System.out.println(sdf.format(date));
SimpleDateFormat sdf2 = new SimpleDateFormat("MM");
System.out.println(sdf2.format(date));
Calendar c = Calendar.getInstance();
System.out.println(c.get(C ......

×·MMÓëJavaµÄ23ÖÖÉè¼Æģʽ

'   ¡¡1¡¢FACTORY—×·MMÉÙ²»ÁËÇë³Ô·¹ÁË£¬Âóµ±À͵ļ¦³áºÍ¿ÏµÂ»ùµÄ¼¦³á¶¼ÊÇMM°®³ÔµÄ¶«Î÷£¬ËäÈ»¿ÚζÓÐËù²»Í¬£¬µ«²»¹ÜÄã´øMMÈ¥Âóµ±ÀÍ»ò¿ÏµÂ»ù£¬Ö»¹ÜÏò·þÎñԱ˵“À´Ëĸö¼¦³á”¾ÍÐÐÁË¡£Âóµ±ÀͺͿϵ»ù¾ÍÊÇÉú²ú¼¦³áµÄFactory
¡¡¡¡¹¤³§Ä£Ê½£º¿Í»§ÀàºÍ¹¤³§Àà·Ö¿ª¡£Ïû·ÑÕßÈκÎʱºòÐèҪijÖÖ²úÆ·£¬Ö»ÐèÏò¹¤³ ......

VCÐÞ¸ÄAccessÃÜÂë

void ModifyDBCode()
{
 CString strPath;
 ::GetModuleFileName(GetModuleHandle(NULL),strPath.GetBuffer(256),256);
 strPath.ReleaseBuffer();
 int flag=strPath.ReverseFind('\\');
 int size=strPath.GetLength();
 strPath.Delete(flag,size-flag);
 strPath= strPath+ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ