Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 23-03-2009
Member
 
Join Date: Nov 2008
Posts: 85
Problem Connecting Hsqldb from Portlet Program

I am not a good programmer in java programming language and thus facing a big problem with a concept. can anyone help me in getting a small program to understand. I am not able to understand the connecting concept of hsqldb from porlet program. Can any one help me in understanding this concept.

Your help will be appreciated
Reply With Quote
  #2  
Old 23-03-2009
Member
 
Join Date: May 2008
Posts: 2,293
Re: Problem Connecting Hsqldb from Portlet Program

Code:
package pms; 
import java.sql.*; 


public class First { 
public static void main(String args[]) 
{ 
try { 
Class.forName("org.hsqldb.jdbcDriver" ); 
System.out.println("hi"); 
Connection con= DriverManager.getConnection("jdbc:hsqldb:hsql:pms", "sa", ""); 
System.out.println("connection established"); 
Statement st=con.createStatement(); 
String s="create table student(sid integer,sname varchar(20))"; 
ResultSet rs=st.executeQuery(s); 
System.out.println("values inserted"); 
} 
catch (Exception e) { 
System.out.println("ERROR: failed to load HSQLDB JDBC driver."); 
e.printStackTrace(); 
return; 
} 

} 
} 

but i am getting an exception at 
Connection con= DriverManager.getConnection("jdbc:hsqldb:hsql:pms", "sa", "");
Reply With Quote
  #3  
Old 23-03-2009
Member
 
Join Date: Oct 2005
Posts: 2,389
Re: Problem Connecting Hsqldb from Portlet Program

Connect to Jahia public CVS server:
Check out the 'jforum_JSR168' module
Add the attached project.xml and project.properties to the Eclipse project
Generate and populate the tables in the HSQL database using the provided SQL files
Update systemglobals.properties to switch the database to 'hsqldb'
Update hsqldb.properties with the correct URL
Update the web.xml to include the Pluto portlet servlet
Build the WAR using the 'war' Maven goal
Deploy the WAR into Tomcat
Publish the portlet as 'jforum-portlet.JForum'
Reply With Quote
  #4  
Old 23-03-2009
Member
 
Join Date: May 2008
Posts: 2,383
Re: Problem Connecting Hsqldb from Portlet Program

The HSQLDB jar package is located in the /lib directory and contains several components and programs. Different commands are used to run each program.

Components of the Hsqldb jar package

HSQLDB RDBMS

HSQLDB JDBC Driver

Database Manager (Swing and AWT versions)

Query Tool (AWT)

Sql Tool (command line)

The HSQLDB RDBMS and JDBC Driver provide the core functionality. The rest are general-purpose database tools that can be used with any database engine that has a JDBC driver.
Reply With Quote
  #5  
Old 23-03-2009
Member
 
Join Date: Feb 2008
Posts: 1,848
Re: Problem Connecting Hsqldb from Portlet Program

All tools can be run in the standard way for archived Java classes. In the following example the AWT version of the Database Manager, the hsqldb.jar is located in the directory ../lib relative to the current directory.
Code:
 java -cp ../lib/hsqldb.jar org.hsqldb.util.DatabaseManager
If hsqldb.jar is in the current directory, the command would change to:
Code:
   java -cp hsqldb.jar org.hsqldb.util.DatabaseManager
Main classes for the Hsqldb tools

org.hsqldb.util.DatabaseManager

org.hsqldb.util.DatabaseManagerSwing

org.hsqldb.util.Transfer

org.hsqldb.util.QueryTool

org.hsqldb.util.SqlTool

Some tools, such as the Database Manager or SQL Tool, can use command line arguments or entirely rely on them. You can add the command line argument -? to get a list of available arguments for these tools. Database Manager features a graphical user interface and can be explored interactively.
Running Hsqldb

HSQLDB can be run in a number of different ways. In general these are divided into Server Modes and In-Process Mode (also called Standalone Mode). A different sub-program from the jar is used to run HSQLDB in each mode.

Each HSQLDB database consists of between 2 to 5 files, all named the same but with different extensions, located in the same directory. For example, the database named "test" consists of the following files:

test.properties

test.script

test.log

test.data

test.backup

The properties files contains general settings about the database. The script file contains the definition of tables and other database objects, plus the data for non-cached tables. The log file contains recent changes to the database. The data file contains the data for cached tables and the backup file is a zipped backup of the last known consistent state of the data file. All these files are essential and should never be deleted. If the database has no cached tables, the test.data and test.backup files will not be present. In addition to those files, HSQLDB database may link to any formatted text files, such as CSV lists, anywhere on the disk.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Problem Connecting Hsqldb from Portlet Program"
Thread Thread Starter Forum Replies Last Post
Problem with connecting Nokia C5 in PC bhaski Portable Devices 1 22-03-2012 01:44 PM
How to Install and use Hsqldb? Common Software Development 5 24-03-2010 03:46 AM
Problem connecting to mysql Damodar Software Development 3 25-02-2009 03:16 PM
ipod connecting problem venkateshsmv Portable Devices 5 13-01-2009 09:20 AM
Problem in ps3 connecting to wi-fi Dietrich Networking & Security 4 29-12-2008 10:36 PM


All times are GMT +5.5. The time now is 04:05 AM.