[ת]JavaÁ¬½ÓSQLite dbÊý¾Ý¿âÎļþ
JavaÁ¬½ÓSQLiteÊý¾Ý¿âÏê½â ÏÂÔØSQLiteÊý¾Ý¿âµÄJDBC ÕâÀï¸ø³öÒ»¸öÖÐÎÄÕ¾µãµÄURL: ÉèÖû·¾³±äÁ¿£º ½«ÏÂÔص½µÄ°ü½âѹºóµÃµ½jar°ü sqlitejdbc-v033-nested.jar ·Åµ½%JAVA_HOME%\lib Ï£¬²¢ÇÒ½«ÆäÌí¼Óµ½classpathϵͳ»·¾³±äÁ¿ÖÐ,ÎÒµÄclasspathϵͳ»·¾³±äÁ¿ÏÖÔÚΪ: .;%JAVA_HOME%\lib;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\sqlitejdbc-v033-nested.jar
3 ÔÚÄãµÄ´úÂëÖÐÒýÓÃÕâ¸öÇý¶¯:
Class.forName("org.sqlite.JDBC");
Connection conn = DriverManager.getConnection("jdbc:sqlite:filename");//filenameΪÄãµÄSQLiteÊý¾ÝÃû³Æ
// ... use the database ...
conn.close();
ʾÀý³ÌÐòÈçÏ£º
import java.sql.*;
import org.sqlite.JDBC;
/**
* ÕâÊǸö·Ç³£¼òµ¥µÄSQLiteµÄJava³ÌÐò,
* ³ÌÐòÖд´½¨Êý¾Ý¿â¡¢´´½¨±í¡¢È»ºó²åÈëÊý¾Ý£¬
* ×îºó¶Á³öÊý¾ÝÏÔʾ³öÀ´
* @author zieckey (http://zieckey.cublog.cn)
*/
public class TestSQLite
{
public static void main(String[] args)
{
try
{
//Á¬½ÓSQLiteµÄJDBC
Class.forName("org.sqlite.JDBC");
//½¨Á¢Ò»¸öÊý¾Ý¿âÃûzieckey.dbµÄÁ¬½Ó£¬Èç¹û²»´æÔÚ¾ÍÔÚµ±Ç°Ä¿Â¼Ï´´½¨Ö®
Connection conn = DriverManager.getConnection("jdbc:sqlite:zieckey.db");
Statement stat = conn.createStatement();
stat.executeUpdate( "create table tbl1(name varchar(20), salary int);" );//´´½¨Ò»¸ö±í£¬Á½ÁÐ
stat.executeUpdate( "insert into tbl1 values('ZhangSan',8000);" ); //²åÈëÊý¾Ý
stat.executeUpdate( "insert into tbl1 values('LiSi',7800);" );
stat.executeUpdate( "insert into tbl1 values('WangWu',5800);" );
stat.executeUpdate( "insert into tbl1 values('ZhaoLiu',9100);" );
ResultSet rs = stat.executeQuery("select * from tbl1;"); //²éѯÊý¾Ý
while (rs.next()) { //½«²éѯµ½µÄÊý¾Ý´òÓ¡³öÀ´
System.out.print("name = " + rs.getString("name") + " "); //ÁÐÊôÐÔÒ»
System.out.println("salary = " + rs.getString("salary
Ïà¹ØÎĵµ£º
import lotus.domino.*;
import java.io.*;
import java.util.Vector;
import jxl.*;
/*******************************************************************************
* @saveSQMessageToOracle
* @×÷ÕߣºÐ컪Ïé
* @2009Äê10ÔÂ28ÈÕ
* @˵Ã÷£ºExeclÎļþµÄµ¼Èë
********** ......
import java.io.*;
class FileTest
{
public static void main(String[] args) throws Exception
{
//File f=new File("1.txt");
//f.createNewFile();
//f.mkdir();
//File f=new File("E:\\JavaLesson\\Lesson7\\1.txt");//ÔÚWindowsϵͳÏÂ,Óþø¶Ô ......
¼Ì³Ð£º
javaÖ»Óе¥¼Ì³Ð£¬²»ÄÜͬʱ¼Ì³Ð¶à¸öÀà
class Animal{}
class Fish extends Aniaml{}
super.(¸¸ÀàÖÐÓë×ÓÀàÏàͬµÄ·½·¨£©();//super-ÌØÊâµÄ±äÁ¿£¬ÓÃÓÚ·ÃÎʸ¸ÀàÖÐÓë×ÓÀàÏàͬµÄ·½·¨£¬ÈçÏÂ
//¸¸Àà
class Fish extends animal
{
void output()
{
System.out.println("Fish");
&n ......
Calendar ÀàÊÇÒ»¸ö³éÏóÀ࣬ËüΪÌض¨Ë²¼äÓëÒ»×éÖîÈç YEAR¡¢MONTH¡¢DAY_OF_MONTH¡¢HOUR µÈ ÈÕÀú×Ö¶ÎÖ®¼äµÄת»»ÌṩÁËһЩ·½·¨£¬²¢Îª²Ù×÷ÈÕÀú×ֶΣ¨ÀýÈç»ñµÃÏÂÐÇÆÚµÄÈÕÆÚ£©ÌṩÁËһЩ·½·¨¡£Ë²¼ä¿ÉÓúÁÃëÖµÀ´±íʾ£¬ËüÊǾàÀúÔª£¨¼´¸ñÁÖÍþÖαê׼ʱ¼ä 1970 Äê 1 Ô 1 ÈÕµÄ 00:00:00.000£¬¸ñÀï¸ßÀûÀú£©µÄÆ«ÒÆÁ¿¡£
Àý:
Calenda ......
//java.io
---------------------------------------------------------------
/**
* Title: ÎļþµÄ¸÷ÖÖ²Ù×÷
* Copyright: Copyright (c) 2004
* Company: ¹ã¶« ÓÐÏÞ¹«Ë¾
* @author ÍøÂçÐÅÏ¢²¿ Çì·á
* @version 1.0
*/
p ......