hsqldb

2010-03-29  来源:本站原创  分类:Java  人气:330 

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class HSQLDB {

        public static void main(String[] args) {

                 try {
                        Class.forName("org.hsqldb.jdbcDriver" );
                    } catch (Exception e) {
                        System.out.println("ERROR: failed to load HSQLDB JDBC driver.");
                        e.printStackTrace();
                        return;
                    }   

                    try {
                                Connection conn = DriverManager.getConnection("jdbc:hsqldb:mem:mydb", "sa", "");

                                conn.createStatement().execute("CREATE TABLE hsql(NAME VARCHAR(30),CODE VARCHAR(6))");

                                PreparedStatement pstmt = conn.prepareStatement("insert into hsql (NAME,CODE) values('jizhong1','hehe')");

                                pstmt.executeUpdate();
                                Statement  st = conn.createStatement();
                    ResultSet  rs = st.executeQuery("select * from hsql");
                    while(rs.next()){
                        String s1=rs.getString("name");
                        System.out.println(s1);
                    }
                    st.close();
//                  st = conn.createStatement();
//                  st.execute("SHUTDOWN");
                    conn.close(); 

                        } catch (SQLException e) {
                                e.printStackTrace();
                        }  

        }

}

Server mode:

java Code:

Connection conn = DriverManager.getConnection("jdbc:hsqldb:hsql://localhost:9001/refresh", "sa", "");

The establishment of databases:

This mode, the HSQLDB database server with other, like the form to the server was activated.

By java-cp .. / lib / hsqldb.jar org.hsqldb.Server-database.0 mydb-dbname.0 myDbName sort of order to start HSQLDB daemon.

jdbc: hsqldb: hsql: / / localhost: 9001/myDbName to access the

相关文章
  • hsqldb 2010-03-29

    import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class HSQLDB { public static void main(String[] args) { try { Cla

  • Ext2.0 + struts2 + spring2.5 + ibatis2 + Hsqldb (Oracle) + velocity1.5 + semi-automatic "3" 2009-03-05

    http://www.blogjava.net/ilovezmh/archive/2008/12/27/248675.html The third part of the database used Hsqldb HSQLDB brief under four modes of operation: Almost four kinds of mode usage, mainly in the URL database, there are some differences in wording,

  • Ext2.0 + struts2 + spring2.5 + ibatis2 + Hsqldb (Oracle) + velocity1.5 + semi-automatic "4" 2010-03-25

    http://www.blogjava.net/ilovezmh/archive/2008/12/27/248681.html The fourth section for the database table structure in order to automatically generate code The main principle is through JDBC's DatabaseMetaData class to obtain information about the da

  • hsqldb Source Analysis 2010-03-06

    hsqldb, only 700 k of a small database. Built-in support for JDBC drivers and database engine. Server mode boot process: org.hsqldb.Server.java public static void main(String[] paramArrayOfString) { // Obtain and read server.properties file , If no d

  • hsqldb an optimal experience - update statements can not write in excess of the select 2010-03-20

    Original Posted :2009-06-18 Environment - hsqldb 1.8.0.10, sun jdk 1.6 Hsqldb in operation in 800 records, the implementation of 35 update statements required for each update statement takes about 2 seconds. Check the official forums that, if you use

  • Ups and downs in the various documents or databases derby hsqldb h2 2010-03-20

    Original Posted :2009-09-10 After several days of agonizing finally was heartbroken, fro a total cost to the database about two weeks time ... ... System is a classic technique used in the framework of Spring 2.0.5 + Hibernate 3.2 + iBatis 2.2.0 Used

  • hsqldb database to use 2010-04-08

    I. Introduction: hsql Database is a free database written in pure Java, is a BSD-style license agreement. Compared to other databases, its small size, only 563kb. Hsqldb.jar file to include only a database engine, database-driven, there are other use

  • hsqldb - 100% Java Database 2010-04-24

    I. Introduction: hsql Database is a free database written in pure Java, is a BSD-style license agreement. Compared to other databases, its small size, only 3276605bytes. Hsqldb.jar file to include only a database engine, database-driven, there are ot

  • HSQLDB installation and testing [Memo] 2010-04-26

    Download HSQLDB, hsqldb-1.8.0.12 Extract copied to D: \ hsqldb Enter cd D: \ hsqldb \ lib New database, start the service D: \ hsqldb \ lib> Java-cp hsqldb.jar org.hsqldb.Server-database.0 File: .. / Data / yisnow -dbname.0 yisnow In D: \ hsqldb \ da

  • HSQLDB database and JDBC connection installation starts 2010-05-22

    HSQLDB is the development of a lightweight pure Java open-source relational database system. Because HSQLDB lightweight (small footprint), easy to use, support for memory operation mode, etc., HSQLDB is widely used development environment and some sm

  • Access.SQLite.HSQLDB.Sybase.MySQL.DB4O 2010-06-24

    1, Access Some of the data type of alternative, and the password is too easy to break, the performance is not high, only the procedures used in Windows. Generally speaking, a single table does not more than 100,000 records less is better, the entire

  • HSQLDB of In-Process 2010-07-01

    Just a small application to be embedded in a small database, search the following information, intended to try HSQLDB. 1 Shangguan net, good things, the new version 2.0, try this on a. Since it is to be embedded into applications where, of course, in

  • Access.SQLite.HSQLDB.Sybase.MySQL.DB4O comparison 2010-07-17

    This carried over: http://blog.sina.com.cn/s/blog_465bc6c90100eums.html 1, Access Some alternative data types, and the password is too easy to break, the performance is not high, only the procedures used in Windows. Generally speaking, a single table

  • Install and run hsqldb 2010-08-11

    1. Download: http://sourceforge.net/projects/hsqldb/files/ 2. Description: Pure java prepared for development and testing, is very small, just download the compressed more than 3M, extracting more than 10M after installation only, as long as the refe

  • Installation and use HSQLDB 2010-09-28

    Reprinted: http://www.josdoc.com/html/shujuku/HSQLDB/rumenjiaocheng/200904/19-52.html Learning project assets, the process engine when the HSQLDB database uses matching For learning the following knowledge about HSQL The development of lightweight pu

  • [Transferred] to recommend a good gadget ---- HSQLDB 2010-10-23

    Transfer from: http://www.javaeye.com/topic/469483 A long time ago heard that there is a pure Java data, since a long time, forget the name, is finally with the "enemy" once again. Hibernate cache recently been doing the work, so we brought the

  • Hsqldb install and use 2011-07-04

    Transfer: http://fengyongfa2006.blog.163.com/blog/static/3665465920106288451611/ HSQLDB is a lightweight pure Java open source relational database system, its small size, small footprint, easy to use, support for memory operation mode and so on. Can

  • HSQLDB database and create a basic database access 2011-07-26

    I. Introduction Hsqldb is a lightweight database written in pure java, there are three operating modes: 1. Server model 2. Standlone mode 3. Memory-Only Mode One server mode is divided into: 1. Hsqldb Server mode 2. Hsqldb Web Server mode 3. Hsqldb S

  • [Switch] recommend a good gadget ---- HSQLDB 2010-10-23

    Transfer: http://www.iteye.com/topic/469483 A long time ago heard that there is a pure Java data, because a long time, forget the name, is finally with the "enemy" reunion. Hibernate cache recently been doing work, so I used the Hibernate docume

  • Install and start the HSQLDB database JDBC connection 2011-02-12

    HSQLDB is a lightweight pure Java open source relational database system. Because the HSQLDB lightweight (small footprint), easy to use, support for memory operation mode, etc., HSQLDB is widely used development environment and some small systems. In