Incorporar banco de dados h2 em uma aplicação

como faço de fato para configurar um banco h2, a um jar, para funcionar tudo junto com banco e projeto…??
estou pesquisando mais com dúvidas, qualquer luz é bem vinda.

olhei este tópico mas tive problemas…
http://www.guj.com.br/java/257609-off-topic-iniciando-o-h2-db-pela-aplicacao-j2se#1611763

nestas linhas

try { Server s = Server.createTcpServer(new String[]{"-tcp","-tcpAllowOthers","-tcpPort","9001","-trace"}); //aqui crio e defino o servidor TCP com seus parametros s.start(); //inicia o servidor ele não consegue usar este metodo .createTcpServer

quero um banco local talvez nao precise disso… … do TCP no caso. ou Server… estou tentando sem … mas nao deu…

[code]
/*

  • To change this template, choose Tools | Templates
  • and open the template in the editor.
    */
    package h2databasetestes;

import com.sun.corba.se.spi.activation.Server;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

public class Conexao {

public static Connection getConnection() throws SQLException{
try {
Class.forName(“org.h2.Driver”); //driver para h2 db
return DriverManager.getConnection(“jdbc:h2:~/test/localhost:8082/TEST/”,“SA”,""); //retorna conexao h2 db
}catch (ClassNotFoundException e) {
JOptionPane.showMessageDialog(null, e.getMessage());
throw new SQLException();
}

}

public static void main(String[] args){
//inicia o servidor e testa a conexao tcp com h2 db
try {
// Server s = Server.createTcpServer(new String[]{"-tcp","-tcpAllowOthers","-tcpPort",“9001”,"-trace"}); //aqui crio e defino o servidor TCP com seus parametros
// s.start(); //inicia o servidor
Connection con = Conexao.getConnection();
PreparedStatement stm = con.prepareStatement(“SELECT * FROM TEST”);
ResultSet rs = stm.executeQuery();
while(rs.next()){
System.out.println(rs.getString(“NAME”));
}
} catch (SQLException ex) {
Logger.getLogger(Conexao.class.getName()).log(Level.SEVERE, null, ex);
}

}  

}[/code]

segue o teste que faço

Achei um sample, mas

[code]
/*

  • To change this template, choose Tools | Templates
  • and open the template in the editor.
    */
    package h2databasetestes;

/*

  • Copyright 2004-2013 H2 Group. Multiple-Licensed under the H2 License,
  • Version 1.0, and under the Eclipse Public License, Version 1.0
  • (http://h2database.com/html/license.html).
  • Initial Developer: H2 Group
    */

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import org.h2.tools.DeleteDbFiles;

/**

  • A very simple class that shows how to load the driver, create a database,

  • create a table, and insert some data.
    */
    public class ASD {

    /**

    • Called when ran from command line.

    • @param args ignored
      */
      public static void main(String… args) throws Exception {
      // delete the database named ‘test’ in the user home directory
      DeleteDbFiles.execute("~", “test”, true);

      Class.forName(“org.h2.Driver”);
      Connection conn = DriverManager.getConnection(“jdbc:h2:~/test”);
      Statement stat = conn.createStatement();

      // this line would initialize the database
      // from the SQL script file ‘init.sql’
      // stat.execute(“runscript from ‘init.sql’”);

      stat.execute(“create table test(id int primary key, name varchar(255))”);
      stat.execute(“insert into test values(1, ‘Hello’)”);
      ResultSet rs;
      rs = stat.executeQuery(“select * from test”);
      while (rs.next()) {
      System.out.println(rs.getString(“name”));
      }
      stat.close();
      conn.close();
      }

}
[/code] ele não acha este import…

porque??

Go to the downloads page of the H2 website as you did. Download the INSTALLATION file for H2 and install it. Then, go to the folder where you installed it. The path to that folder (on a windows pc) should be C:\Program Files (x86)\H2\bin There will be a jar file there which looks like h2-some version number.jar. That is your driver. Bin means binary and that is usually the place where i look for any jar file.

faltava um drive… informo aos que acompanham…