Note that there are some explanatory texts on larger screens.

plurals
  1. POinternet site Java Applet with firebird database
    primarykey
    data
    text
    <p>i have some project to make for mys self, but i can not resolve a puzzle :) for example i have such a code, but it is nor working on my website</p> <p>it throws: <code>NoClassDefFoundError</code></p> <ol> <li><p>I create file .java and link it with database(?)</p> <pre><code>package firebird; import java.sql.*; public class Firebird { public static void main(String[] args) throws ClassNotFoundException { String pathToDatabase; String userName; String password; String sql; sql = "SELECT * FROM EMPLOYEE"; password = "masterkey"; userName = "sysdba"; pathToDatabase = "C:/Program Files/Firebird/Firebird_2_5/examples/empbuild/EMPLOYEE.FDB"; try { Class.forName("org.firebirdsql.jdbc.FBDriver"); } catch(ClassNotFoundException cnfe) { System.out.println(cnfe.toString()); System.out.println("org.firebirdsql.jdbc.FBDriver not found"); } // Retrieve a connection. try { Statement stmt = null; ResultSet rst = null; Connection conn = DriverManager.getConnection( "jdbc:firebirdsql:localhost/3050:" + pathToDatabase, userName, password); try { stmt = conn.createStatement(); rst = stmt.executeQuery(sql); int columnCount = rst.getMetaData().getColumnCount(); int recordIndex = 0; while(rst.next()) { recordIndex++; System.out.println("Record: " + recordIndex); for (int i=1;i&lt;=columnCount;i++) { System.out.print(rst.getMetaData().getColumnName(i)); System.out.print(": "); System.out.println(rst.getString(i)); } } } finally { // close the database resources immediately, rather than waiting // for the finalizer to kick in later if (rst != null) { rst.close(); } if (stmt != null) { stmt.close(); } conn.close(); } } catch(SQLException se) { System.out.println(se.toString()); } } } </code></pre></li> <li><p>I compile code with console and get .class file</p></li> <li><p>I create a .html file with following code:</p> <pre><code>&lt;HTML&gt; &lt;HEAD&gt; &lt;TITLE&gt;Java_DB&lt;/TITLE&gt; &lt;/HEAD&gt; &lt;BODY&gt; Svetainė parašyta su java ir joje duombazė &lt;BR&gt;&lt;BR&gt; &lt;applet code="Firebird.class" width="1000" height ="500"&gt; &lt;/BODY&gt; &lt;/HTML&gt; </code></pre></li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload