Re: How to supply a Database enabled Application?
In article
<f58e4390-2165-4b48-b62b-d861badc84d5@p25g2000pri.googlegroups.com>,
"Atharvan :-)" <code333@gmail.com> wrote:
What I mean is, if I use any specific DataBase, then whether I need
to supply that database package ( firebird, H2, MySQL,...) together
with my application or not? I think now It's clear.
Yes, but H2 and Derby are jars; they are perhaps easier to deploy.
Surely I will check derby to know about it's possibilities.
I checked H2. Another small one as Firebird. And that DBDSL, I cannot
able to understand it. I will reread their site again.
The xslt part is very well done, but a bit opaque at first; it's not
essential. I recommend studying the convenient ant build.xml:
<http://dbsdl.svn.sourceforge.net/viewvc/dbsdl/trunk/build.xml>
The parameters used in the "test-sql" ant target are precisely the one's
needed in your Java code.
I'll not jump into a big application before trying it on small
application, or rather How can I ?
Try writing a query against the sample database:
svn co https://dbsdl.svn.sourceforge.net/svnroot/dbsdl/trunk dbsdl
cd dbsdl
ant
javac -cp h2.jar Query.java
java -cp .:h2.jar Query
import java.sql.*;
/**
* Test enbedded H2
* @author John B. Matthews
*/
class Query
{
public static void main (String args []) throws Exception
{
Class.forName("org.h2.Driver");
Connection conn = DriverManager.getConnection
("jdbc:h2:db/album-archive", "sa", "");
Statement stmt = conn.createStatement ();
ResultSet rset = stmt.executeQuery
("SELECT Albums.Name FROM Albums");
while (rset.next ()) {
String name = rset.getString(1);
System.out.println(name);
}
}
}
John
--
John B. Matthews
trashgod at gmail dot com
home dot woh dot rr dot com slash jbmatthews