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

sql server2005 jdbc½â¾ö×Ô¶¯Ôö³¤ÁÐͳһ´¦ÀíÎÊÌâ

±³¾°£ºÏµÍ³ÒªÖ§³Ö¶àÖÖÊý¾Ý¿â£¬Í³Ò»insertµÄʱºò»ñÈ¡×Ô¶¯Ôö³¤ÁеĴ¦Àí·½Ê½
ÎÊÌâ1£ºinsert select·½°¸
sqlserver2000Äܹ»Ê¹ÓÃinsertSql SELECT @@IDENTITY AS 'Identity'µÄ·½Ê½À´»ñµÃ£¬µ«ÊÇmysqlÔòÖ»ÄÜʹÓÃexecuteUpdate(insertSql);
executeQuery('SELECT last_insert_id() ')ÕâÑùµÄ·½Ê½£¬·ñÔò»áÅ׳öÒì³££ºjava.sql.SQLException: Can not issue data manipulation statements with executeQuery()
¶øÁ½¾ä»°·Ö¿ª´¦Àí£¬×ÜÈÃÈ˸оõ²»·ÅÐÄ£¬¼ÙÈç²¢·¢²Ù×÷±È½Ï¶à£¬´æÔÚDZÔÚµÄΣÏÕ¡£
ÎÊÌâ2£ºgetGeneratedKeys·½°¸
mysqlµÄÇý¶¯Ö§³Öjdbc3.0,ʵÏÖÁËgetGeneratedKeys()£¬µ«sqlserver2000 jdbcÇý¶¯²»Ö§³ÖgetGeneratedKeys()
½â¾ö˼·£º
googleÁËһϣ¬¾Ý˵2005ÊÇÖ§³ÖµÄ£¬ËùÒÔÏÂÏÂÀ´¿´¿´
ÏÂÔصØÖ·£ºurl£ºhttp://download.microsoft.com/download/2/8/9/289dd6a3-eeeb-46dc-9045-d0c6b59bfbc1/sqljdbc_1.1.1501.101_chs.exe
ʹÓÃС½á£º
1.2005jdbcÇý¶¯ÊÇÖ§³Öjdbc 3.0 µÄ¡£Ò²¾ÍÊÇ˵£¬µÄÈ·Ö§³ÖgetGeneratedKeys()·½·¨¡£
2.2005jdbcÇý¶¯urlºÍ°ü×éÖ¯±ä¶¯½Ï´ó¡£
¾ÙÀý¶Ô±È£º
================
2000
================
url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=mydb;SelectMethod=cursor"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
================
2005
================
url="jdbc:sqlserver://localhost:1433;DatabaseName=mydb;SelectMethod=cursor"
driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver"
¼ÙÈçûעÒâÕâµã£¬±Ø½«³öÏÖÒì³££ºCannot load JDBC driver class'com.microsoft.jdbc.sqlserver.SQLServerDriver'
×öºÃµÚ¶þ²½£¬³öÏÖ
3.°üµÄλÖ㺻·¾³±äÁ¿CLASSPATH²»ÊDZØÐëµÄ¡£µ«sqljdbc.jar±ØÐë·ÅÖÃÔÚtomcat/common/libÖУ¨¼ÙÈçÊÇ×âÓÿռ䣬¿ÉÄܵøú¶Ô·½ÉÌÁ¿ÁË£¬¿´ÊÇ·ñÖ§³Ö2005µÄÇý¶¯£©¡£
·ñÔò»á·¢ÉúÒì³££ºCannot load JDBC driver class'com.microsoft.sqlserver.jdbc.SQLServerDriver'
²âÊÔʾÀý·½·¨£º
public String executeUpdate(String sql) throws SQLException ...{
Connection conn = getConnection();
PreparedStatement pstmt = null;
try ...{
/**//*×¢Ò⣺jdbc3.0ÌṩÁËStatement.RETURN_GENERATED_KEYS"ÓÃÀ´Ö¸Ã÷ÐèÒª´ÓStatementÖлñµÃ×Ô¶¯Ôö³¤ÁÐÖµ£¬
¼ÙÈç²»ÅäÖøòÎÊý£¬ÔÚÖ´ÐÐgetGeneratedKeys()ʱ»áÅ׳öÒì³££º"Ö»ÓÐÔËÐиÃÓï¾ä,Éú³ÉµÄ


Ïà¹ØÎĵµ£º

ѧϰoracle sql loader µÄʹÓÃ

Ò»£ºsql loader µÄÌصã
oracle×Ô¼º´øÁ˺ܶàµÄ¹¤¾ß¿ÉÒÔÓÃÀ´½øÐÐÊý¾ÝµÄǨÒÆ¡¢±¸·ÝºÍ»Ö¸´µÈ¹¤×÷¡£µ«ÊÇÿ¸ö¹¤¾ß¶¼ÓÐ×Ô¼ºµÄÌص㡣
 ±ÈÈç˵expºÍimp¿ÉÒÔ¶ÔÊý¾Ý¿âÖеÄÊý¾Ý½øÐе¼³öºÍµ¼³öµÄ¹¤×÷£¬ÊÇÒ»ÖֺܺõÄÊý¾Ý¿â±¸·ÝºÍ»Ö¸´µÄ¹¤¾ß£¬Òò´ËÖ÷ÒªÓÃÔÚÊý¾Ý¿âµÄÈȱ¸·ÝºÍ»Ö¸´·½Ãæ¡£ÓÐ×ÅËٶȿ죬ʹÓüòµ¥£¬¿ì½ÝµÄÓŵ㣻ͬʱҲÓÐһР......

SQL Server ±à³Ì(Ò») ×Ö·û´®´¦Àí

      ×Ö·û´®º¯Êý¶Ô¶þ½øÖÆÊý¾Ý¡¢×Ö·û´®ºÍ±í´ïʽִÐв»Í¬µÄÔËËã¡£´ËÀຯÊý×÷ÓÃÓÚCHAR¡¢VARCHAR¡¢ BINARY¡¢ ºÍVARBINARY Êý¾ÝÀàÐÍÒÔ¼°¿ÉÒÔÒþʽת»»ÎªCHAR »òVARCHARµÄÊý¾ÝÀàÐÍ¡£¿ÉÒÔÔÚSELECT Óï¾äµÄSELECT ºÍWHERE ×Ó¾äÒÔ¼°±í´ïʽÖÐʹÓÃ×Ö·û´®º¯Êý¡£
Ò»¡¢×Ö·ûת»»º¯Êý
1¡¢ASCII()
·µ»Ø×Ö·û±í´ïʽ ......

SQL SERVER ºÍEXCELµÄÊý¾Ýµ¼Èëµ¼³ö

 SQL SERVER ºÍEXCELµÄÊý¾Ýµ¼Èëµ¼³ö
1¡¢ÔÚSQL SERVERÀï²éѯExcelÊý¾Ý:
-- ======================================================
SELECT *
from OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="c:\book1.xls";User ID=Admin;Password=;Extended properties=Excel 5.0')...[Sheet1$]
ÏÂÃæÊǸö²éÑ ......

PB Êý¾Ý¿âÁ¬½ÓÒÔ¼°sqlÓï¾äÔËÐÐÐÅÏ¢·µ»Ø´úÂë½âÊÍ´óÈ«


Èç¹ûÒ»¸ö SQL Óï¾ä·¢ÉúÁË´íÎó£¬ÄÇô sqlca.sqlcode ½«ÊÇ·ÇÁãÖµ¡£
Èç¹û sqlca.sqlcode СÓÚ 0 ÄÇô¾ÍÊÇ·¢ÉúÁËijÖÖÑÏÖصĴíÎó£¬ÏóÊý¾Ý¿â¶¨ÒåÓë²éѯ¶¨Òå²»Ò»Öµȣ®
Èç¹û´óÓÚ 0 ÔòÊÇͨ³£µÄ´íÎó£¬Ïó±í²»°üÀ¨ËùÒªÇóµÄÐеȣ®
sqlca.sqlcode == 0£¬³É¹¦
sqlca.sqlcode == -1 ʧ°Ü     £¨»ñÈ¡¾ßÌåʧ°ÜÐÅÏ¢ ......

ORACLEPL/SQL»ù´¡

 ORACLEPL/SQL»ù´¡--ÓαêµÄѧϰÀ´Ô´£º
    Óαê×ÖÃæÀí½â¾ÍÊÇÓζ¯µÄ¹â±ê¡£
    ÓÃÊý¾Ý¿âÓïÑÔÀ´ÃèÊö£ºÓαêÊÇÓ³ÉäÔÚ½á¹û¼¯ÖÐÒ»ÐÐÊý¾ÝÉϵÄλÖÃʵÌ壬ÓÐÁËÓαêÓû§¾Í¿ÉÒÔ·ÃÎʽá¹û¼¯ÖеÄÈÎÒâÒ»ÐÐÊý¾ÝÁË£¬½«Óαê·ÅÖõ½Ä³Ðк󣬼´¿É¶Ô¸ÃÐÐÊý¾Ý½øÐвÙ×÷£¬ÀýÈçÌáÈ¡µ±Ç°ÐеÄÊý¾ÝµÈµÈ¡£
  ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ