JavaÁ¬½ÓÊý¾Ý¿âµÄ·½·¨
JavaÁ¬½ÓÊý¾Ý¿âµÄ·½·¨
×¢£º×ªÓÚhttp://www.newasp.net/tech/java/15826.html
JAVAÁ¬½ÓÊý¾Ý¿âÖ÷ÒªÓÐÁ½ÖÖ·½Ê½:
Ò»ÊÇÓÃJDBC-ODBCÇÅÀ´Á¬½Ó
¶þÊÇÓÃÏà¹Ø³§ÉÌÌṩµÄÏàÓ¦Çý¶¯³ÌÐòÀ´Á¬½Ó
ÓÃJDBC-ODBCÇÅÀ´Á¬½Ó
JDBC-ODBCÇŽÓÆ÷ÊÇÓÃJdbcOdbc.ClassºÍÒ»¸öÓÃÓÚ·ÃÎÊODBCÇý¶¯³ÌÐòµÄ±¾µØ¿âʵÏֵġ£¶ÔÓÚWINDOWSƽ̨£¬¸Ã±¾µØ¿âÊÇÒ»¸ö¶¯Ì¬Á¬½Ó¿âDLL(JDBCODBC.DLL)¡£
ÓÉÓÚJDBCÔÚÉè¼ÆÉÏÓëODBCºÜ½Ó½ü¡£ÔÚÄÚ²¿£¬Õâ¸öÇý¶¯³ÌÐò°ÑJDBCµÄ·½·¨Ó³Éäµ½ODBCµ÷ÓÃÉÏ£¬ÕâÑù£¬JDBC¾Í¿ÉÒÔºÍÈκοÉÓõÄODBCÇý¶¯³ÌÐò½øÐн»»¥ÁË¡£ÕâÖÖÇŽÓÆ÷µÄÓŵãÊÇ£¬ËüʹJDBCÄ¿Ç°ÓÐÄÜÁ¦·ÃÎʼ¸ºõËùÓеÄÊý¾Ý¿â¡£Í¨Ðз½Ê½ÈçͼËùʾ£º
Ó¦ÓóÌÐò---JDBC API---JDBC-ODBC---ODBC API---ODBC²ã---Êý¾ÝÔ´
¾ßÌå²Ù×÷·½·¨Îª£º
Ê×ÏÈ´ò¿ª¿ØÖÆÃæ°åµÄ¹ÜÀí¹¤¾ß£¬´ò¿ªÊý¾ÝÔ´£¨ODBC£©£¬ÔÚÓû§DSNÀïÃæÌí¼ÓÊý¾ÝÔ´£¨¼´ÄãÒªÁ¬½ÓµÄÊý¾Ý¿âµÄÃû×Ö£©£¬ÔÚÕâÀï¼Ù¶¨Á¬½ÓSQL SERVER 2000µÄGoodsSupplyÊý¾Ý¿â¡£Ãû³ÆÌîдÄãÒªÁ¬½ÓµÄÊý¾Ý¿âµÄÃû³Æ£¨GoodsSupply£©£¬È»ºóÖð²½ÉèÖã¬Èç¹ûÑ¡ÓÃÁËʹÓÃSQL-SERVERÃÜÂëÈÏÖ¤µÄ»°£¬¾ÍÒªÊäÈëÏàÓ¦µÄÓû§Ãû¼°ÃÜÂëÁ¬½Óµ½Êý¾Ý¿â¡£Ò»Â·ÏÂÒ»²½ÉèÖÃÍê³É¡£
ÔÚJAVAÀïÃæ±àд³ÌÐò½øÐвâÊÔ£¬ÔÚÕâÀïÎҵijÌÐòÊÇÈÃÓû§ÊäÈëÈÎÒâµÄ±íÃûÓëÓëÁÐÃû£¬°Ñ¸ÃÁеÄËùÓÐÊý¾ÝÊä³ö¡£
Ô´´úÂëÈçÏ£º
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.sql.*;
public class ODBCBridge {
public static void main(String[] args) {
String url="jdbc:odbc:GoodsSupply";
Statement sm=null;
String command=null;
ResultSet rs=null;
String tableName=null;
String cName=null;
String result=null;
BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
try {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); //¼ÓÔØÇý¶¯
}catch(ClassNotFoundException e){
System.out.println("Can not load Jdbc-Odbc Bridge Driver");
System.err.print("ClassNotFoundException:");
System.err.println(e.getMessage());
}
Connection con=DriverManager.getConnection(url,"USER","PASSWORD"); //ʹÓÃSQL-SERVER2000ÈÏÖ¤
DatabaseMetaData dmd=con.getMetaData(); //DMDΪÁ¬½ÓµÄÏàÓ¦Çé¿ö
System.out.println("Á¬½ÓµÄÊý¾Ý¿â:"+dmd.getURL());
System.out.println("Çý¶¯³ÌÐò:"+dmd.getDriverName());
sm=con.createStatement();
System.out.print
Ïà¹ØÎĵµ£º
ÔÚÓ¦Óÿª·¢ÖУ¬¾³£ÐèҪһЩÖÜÆÚÐԵIJÙ×÷£¬±ÈÈçÿ5·ÖÖÓÖ´ÐÐijһ²Ù×÷µÈ¡£ÔÚWEBÏîÄ¿ÖпÉÄÜÐèҪÿ¸ôÒ»¶Îʱ¼ä×Ô¶¯Éú³É¾²Ì¬Ò³£¬×Ô¶¯¼ì²âÊÇ·ñÓÐÐÂÓʼþ£¬¶¨Ê±×Ô¶¯±¸·ÝÎļþµÈ²Ù×÷¡£ÕâЩ¶¼¿ÉÒÔͨ¹ý¶¨Ê±Æ÷TimerÀ´½â¾ö¡£
ÕâÀï½öÌṩ¶¨Ê±Æ÷µÄ²¿·Ö·½·¨ºÍ˵Ã÷£¬¾²Ì¬Ò³Éú³ÉµÈ²Ù×÷¶ÁÕß¿ÉÒÔͨ¹ýÏà¹Ø·½·¨×ÔÐнâ¾ö¡£
¡£¡£¡£°Ù¶È¿Õ¼äÌù´úÂë×ÜÊ ......
package thread;
class QQ{
private String name;
private String sex;
boolean flag=false;
public synchronized void put(String name,String sex){
if(flag)
try {
wait();
} catch (InterruptedException e ......
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class GB2UTF
{
public static String GBK2Unicode(String str)
{
StringBuffer result = new StringBuffer();
for (int i = 0; i < str.length(); i++)
&n ......
ÔÚ´¦Àí¼à²âÊý¾Ýʵʱ¼Èëʱ,ÐèÒªÌṩµ±Ç°°à´ÎÐÅÏ¢{´ó°×°à,Сҹ°à,´óÒ¹°à}£¬°à´ÎÐÅÏ¢ÊǸù¾Ý¸ø¶¨Ê±¼ä¶Î½øÐÐÉ趨ÀàËÆ{{"8:00","16:00"},{"16:00","00:00"},{"00:00","8:00"}}
´¦Àí°ì·¨
· È¡µ±Ç°Ê±¼ä¡¢×ª»»ÑéÖ¤Æðʼ¡¢½áÊøʱ¼ä½øÐбȽϡ£
Ïà¹Ø´úÂë
/**
* ʱ¼ä¶Î²âÊÔ
......
Java 7ÒѾÍê³ÉµÄ7´óй¦ÄÜ£º
1£©¶Ô¼¯ºÏÀàµÄÓïÑÔÖ§³Ö£»
2£©×Ô¶¯×ÊÔ´¹ÜÀí£»
3£©¸Ä½øµÄͨÓÃʵÀý´´½¨ÀàÐÍÍƶϣ»
4£©Êý×Ö×ÖÃæÁ¿Ï»®ÏßÖ§³Ö£»
5£©switchÖÐʹÓÃstring£»
6£©¶þ½øÖÆ×ÖÃæÁ¿£»
7£©¼ò»¯¿É±ä²ÎÊý·½·¨µ÷Óá£
ÏÂÃæÎÒÃÇÀ´×Ðϸ¿´Ò»ÏÂÕâ7´óй¦ÄÜ£º
¶Ô¼¯ºÏÀàµÄÓïÑÔÖ§³Ö
Java½«°üº¬¶Ô´´½¨¼¯ºÏÀàµÄµÚÒ»ÀàÓïÑÔÖ§³Ö¡ ......