JAVAÁ¬½ÓACCESS£¬SQL Server,MySQL,Oracle
import java.sql.*;
/*
* JAVAÁ¬½ÓACCESS£¬SQL Server,MySQL,OracleÊý¾Ý¿â
*
* */
public class JDBC {
public static void main(String[] args)throws Exception {
Connection conn=null;
//====Á¬½ÓACCESSÊý¾Ý¿â====
//Á¬½ÓACCESS(·ÇODBCÁ¬½Óģʽ)
//String dbURL ="jdbc:odbc:Driver={MicroSoft Access Driver (*.mdb)};DBQ=f:/db1.mdb";
//Á¬½ÓACCESS(ODBC -ϵͳDSNÁ¬½Óģʽ)
//String dbURL="jdbc:odbc:odbcName";
//conn = DriverManager.getConnection(dbURL);//´´½¨Á¬½Ó¶ÔÏó
//System.out.println("ACCESSÊý¾Ý¿âÁ¬½Ó³É¹¦£¡");
//====Á¬½ÓSQLÊý¾Ý¿â====
/*
* String dbURL="jdbc:microsoft:sqlserver://localhost:Êý¾Ý¿â¶Ë¿Ú;DatabaseName=Êý¾Ý¿âÃû";
*
* */
//String dbURL="jdbc:microsoft:sqlserver://localhost:7788;DatabaseName=msdb";
//String userName = "sa";
//String userPwd = "admin";
//Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");//¼ÓÔØÇý¶¯
//conn = DriverManager.getConnection(dbURL,userName,userPwd);//´´½¨Á¬½Ó¶ÔÏó
//System.out.println("SQLÊý¾Ý¿âÁ¬½Ó³É¹¦£¡");
//====Á¬½ÓMySQlÊý¾Ý¿â====
/*
* "jdbc:mysql://localhost/Êý¾Ý¿âÃû×Ö?user=Óû§Ãû&password=ÃÜÂë&useUnicode=true&characterEncoding=gb2312";
*
* */
//String dbURL="jdbc:mysql://localhost/hackwang?user=root&password=hackwang&useUnicode=true&characterEncoding=gb2312";
//Class.forName("org.gjt.mm.mysql.Driver");//¼ÓÔØÇý¶¯
//conn = DriverManager.getConnection(dbURL);//´´½¨Á¬½Ó¶ÔÏó
//System.out.printl
Ïà¹ØÎĵµ£º
ÊìϤSQL SERVER 2000µÄÊý¾Ý¿â¹ÜÀíÔ±¶¼ÖªµÀ£¬ÆäDTS¿ÉÒÔ½øÐÐÊý¾ÝµÄµ¼Èëµ¼³ö£¬Æäʵ£¬ÎÒÃÇÒ²¿ÉÒÔʹÓÃTransact-SQLÓï¾ä½øÐе¼Èëµ¼³ö²Ù×÷¡£ÔÚTransact-SQLÓï¾äÖУ¬ÎÒÃÇÖ÷ҪʹÓÃOpenDataSourceº¯Êý¡¢OPENROWSET º¯Êý£¬¹ØÓÚº¯ÊýµÄÏêϸ˵Ã÷£¬Çë²Î¿¼SQLÁª»ú°ïÖú¡£ÀûÓÃÏÂÊö·½·¨£¬¿ÉÒÔÊ®·ÖÈÝÒ×µØʵÏÖSQL SERVER¡¢ACCESS¡¢EXCELÊý¾Ýת»»£ ......
¼´Ê¹ÎÒ½«Êý¾Ý¿â·ÅÔÚÏîÄ¿ÄÚ½¨µÄÎļþ¼ÐdbÏ£¬¿ÉÊǽøÐд洢²Ù×÷µÄʱºò£¬Êý¾Ý±íûÓÐÈκα仯¡£ºóÀ´·¢ÏÖ´¢´æ¸Ä±ä·¢ÉúÔÚbin\\debug\\dbĿ¼ÏµÄÊý¾Ý¿âÖУ¬Õâ¸öÊý¾Ý¿âÊÇÔÚ³ÌÐòÔËÐÐʱ×Ô¶¯¸´ÖƹýÈ¥µÄ£¬¿ÉÊÇΪʲô´æ´¢±ä»¯Ã»Óз´Ó¦µ½ÍâÃæÏîÄ¿ÄÚµÄÊý¾Ý¿âdbÏÂÄØ£¿ÎÒÏëÁ¬½Ó×Ö·û´®ÖÐdatasourceÖеÄdatadirectory´æÔÚһЩÐþ»ú£¬ÓÚÊÇÎÒÕÒµ½Ò ......
Ç°ÌâÊDZØÐë°²×°ºÃactiveperl £¨505ÒÔÉÏ£©£¬ÒÔ¼°MS Access 97
¡¡¡¡
¡¡¡¡Ò».
°²×°Win32-ODBCÄ£¿é
¡¡¡¡²½Öè1£º
¡¡¡¡´ÓTOOLSÀ¸Ä¿ÖÐÏÂÔØWin32-ODBC.zip,ÏÂÔØÍêºóÓÃwinzip½â¿ªµ½Ò»¸ötempĿ¼,¹²ÓÐÈý¸öÎļþ£º
¡¡¡¡Readme
¡¡¡¡Win32-ODBC.ppd
¡¡¡¡Win32-ODBC.tar.gz
¡¡¡¡²½Öè2£º
¡¡¡¡ÔÚDOS´°¿ÚÏ£¬tempĿ¼ÖÐÔËÐÐÏÂÃæµÄD ......
Õ⼸Ìì°ïͬѧ×öÒ»¸öСµÄ¹ÜÀíϵͳ£¬B/S½á¹¹µÄ£¬ÓÉÓںܾÃûÓÐ×öB/S½á¹¹µÄ¶«Î÷ÁË£¬×öµÄʱºòºÜÉúÊè¡£Ò»¸öÏÂÎ磬Óöµ½ÁËÒ»¸öÎÊÌ⣺ÍùAccessÀï²åÈëÊý¾ÝµÄʱºò£¬ÀÏÊÇÌáʾÎÒsqlÓï¾ä´íÎ󣬵«ÊǾͺÜÄÉÃÆÁË£¬ÕâÖÖsqlÓï¾äдÁ˲»ÏÂ500±éÁË°É£¬¾ÍËãÊÇ×öÃÎÒ²²»»áд´íµÄ£¬Ôõô»ØÊ£¿sqlÓï¾ ......
PBÖÐÁ¬½ÓAccessÊý¾Ý¿âµÄÈýÖÖ·½·¨
·½Ê½Ò»£º
SQLCA.DBMS = "ODBC"
SQLCA.AutoCommit = False
SQLCA.DBParm = "ConnectString='driver=Microsoft Access Driver (*.mdb);DBQ=c:\foodmart.mdb'"
CONNECT;
IF SQLCA.SQLCode <> 0 THEN
MessageBo ......