You need to set the path to HSQLDB jar. in NetBeans6.5 you can use * Right click on project -> * Click Properties * Select Libraries on Left Pane * Select Add Jar/Folder * Browse to find hsqldb.jar * Click ok * try again
Atul On Wed, Jan 28, 2009 at 8:32 AM, glopezcis <glopez...@gmail.com> wrote: > > Hi friends, > > I'm using NetBeans and I have this code: > > package org.me; > > import java.sql.*; > import java.util.Vector; > > public class Test { > > public static void main(String[] args) { > Vector regs = new Vector(); > > System.out.println("hai"); > > > try { > Class.forName("org.hsqldb.jdbcDriver"); > } > catch(ClassNotFoundException e) { > System.out.println(e); > } > > try { > Connection con=null; > try{ > con=DriverManager.getConnection("jdbc:hsqldb:peru"); > }catch(Exception e){ > System.out.println(e.getMessage()); > } > //System.out.println(con.toString()); > //Statement st=con.createStatement(); > //System.out.println(st.toString()); > //String s="create table test (name varchar(20))"; > //String s="insert into login values('jitto')"; > //ResultSet rs=st.executeQuery("select * from > departamentos"); > Statement st = con.createStatement(); > String sql = "select * from departamentos"; > ResultSet rs = st.executeQuery(sql); > ResultSetMetaData rm = rs.getMetaData(); > int numCols = rm.getColumnCount(); > > st.executeQuery(sql); > > > // Toma los títulos de las columnas > String[] titCols= new String[numCols]; > for(int i=0; i<numCols; ++i) > titCols[i]= rm.getColumnName(i+1); > > // la fila 0 del vector lleva los títulos de las columnas > regs.add(titCols); > > // toma las filas de la consulta > while(rs.next()) { > String[] reg= new String[numCols]; > > for(int i=0; i<numCols; i++) { > reg[i] = rs.getString(i + 1); > } > > regs.add(reg); > } > System.out.println(regs); > > st.close(); > con.close(); > > } > catch(SQLException e){ > System.out.println(e); > } > > } > } > > And it returns this error: > > Exception in thread "main" java.lang.NullPointerException > java.lang.ClassNotFoundException: org.hsqldb.jdbcDriver > at org.me.Test.main(Test.java:34) > No suitable driver found for jdbc:hsqldb:peru > Java Result: 1 > > Do you know why? > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Java EE (J2EE) Programming with Passion!" group. To post to this group, send email to java-ee-j2ee-programming-with-passion@googlegroups.com To unsubscribe from this group, send email to java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en -~----------~----~----~----~------~----~------~--~---