On the first line, enter under Field Name ID and set the Field Type to Integer. We will have just three fields: Name, Address and Telephone. Use the Table Design window (Figure 382) to tell Base which fields to create. Here we are going to create a small table as an example.Ĭhoose Tables in the left-hand column, then choose Create Table in Design View under Tasks. Again, this is covered in more detail in the “Getting Started with Base†chapter in the Getting Started guide. The left-hand panel is Database, with icons for Tables, Queries, Forms and Reports. Unlike creating other documents in OOo, databases have to be saved when you first create them.Īfter saving the database, you should see the main Base window (Figure 381), which contains three panels. You need to do this if you want to link your forms into it.Ĭlick Finish and save your new database, giving it a name. Registering the database just means that it can be accessed from other OOo components such as Writer and Calc. On the next page, select Yes, register the database for me and Open the database for editing. Select Create a new database and click Next. Select File > New > Database to start the Database Wizard (Figure 380). We will give a short guide here to creating a very simple database with OOo Base. Logger.getLogger(()).log(Level.The chapter titled “Getting Started with Base†in the Getting Started guide covers in more detail how to create a database. Logger.getLogger(()).log(Level.SEVERE, null, ex) (" last name: " rs.getString("lastname")) (" first name: " rs.getString("firstname")) ResultSet rs = statement.executeQuery("SELECT * FROM \"User\"") Statement statement = con.createStatement() ![]() It can contain directory names relative to theĬon = DriverManager.getConnection("jdbc:hsqldb:file:" db_file_name_prefix, // filenames prefix db_file_name_prefix is used to open or create files that hold the state This will load the db files and start the hsqldb.jar should be in the class path or made part of the current jar ![]() Load the HSQL Database Engine JDBC driver String db_file_name_prefix = "c:\\mydbdir\\mydb" Public static void main(String args) throws ParseException */ public static void main ( String args ) throws ParseException Import import import import import import import import public class Main The other is to use the Java JDBC API to connect to the database, topic not covered in this post. I will just show you the code that you can use as a example.Put hsqldb.jar and into classpath project.Extract the zip file, search and find jdbc driver files inside lib directory: hsqldb.jar.That is the specific driver for HSQL in Java. Download “ hsqldb_1_8_0_10.zip” (HSQLD DB ENGINE) from.Rename all the files by putting the same prefix before the file name, thus leaving: mydb.backup, mydb.data, mydb.properties, mydb.script.Copy the files into a separate location, i.e C:\mydb.Rename the mydb.odb file in mydb.zip, extract “database” directory from it, so you can find these files: backup, data, properties, script.Create three columns inside the above table (i.e ID, firtsname, lastname).Ģ. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |