Kursuse/teemade ülevaade

  • Tools and Technologies

  • White Board Photos

  • The Group Task

  • This & That

    • The file show the screenshot of the database that belongs to the example program BasicDBAccessCloud in the file baseCode.java. In order to adjust to your own database you need to change the following lines in the program BasicDBAccessCloud

      String url = "jdbc:postgresql://babar.elephantsql.com:5432/qqwtblyv";
      String username = "qqwtblyv";
      String password = "ALo8tyV9bxRKkXm6691WELtjdYbX8L4p";

      The username and password change are obvious, compare with the screenshot. W.r.t the url care must be taken. You need to replace the server 'babar.' and the user 'qqwtblyv' in the url. Here the server name might be more complex as e.g., 'elmed.db.', compare your elepanthSQL database details with the screenshot. 

    • A simple means to invoke some Java code (business logic) from a Java Server Page is to fully qualify the called entity with its path (e.g. package.class.method). A simple example is in the file. Note that the called entity must be visibly to the Java Server Page, i.e., it must be public.

    • Importing a class in Java Server Pages looks like that:

      <%@ page import = "javax.xml.soap.MessageFactory" %>

    • In order to delete a project in Eclipse it is "not sufficient" to delete it in Eclipse (this will show when you try to create a new project with the same name as the deleted)

      So, if you want to create a new project with the same name as the deleted, you also need to delete the project explicitly yourself in the file system, for example:

      C:\Users\didrah\eclipse-workspace\CourseEgov

    • Tallinn Declaration on eGovernment

    • A simple way to realize Sting arrays of flexible length (for example useful as return values of methods and Web services) is to declare the String array in terms of a variable length 'n' and to defer the declaration 'new String[n];' after the concrete length of the String is known (it is not a "nice" solution but works for our purposes), see the following example:


          @WebMethod // compiler directive to turn this into a web method
          public String[] getStrings (){
            int n;
            /*
            n is created dynamically, e.g., by determining the length
            of a JDBC database query result set, for example:
              resultSet.last(); size = resultSet.getRow();
            */
            n=7; // ... n set to some value, see comment before
            String[] s = new String[n];
            for (int i=0;i<n;i++){
              s[i]="BLA ";
            }
            return s;
          }

  • Important Issues

    • In the last week the PCs in ICT-637 has been re-installed (new image). Now, please use

      Eclipse Oxygen Java EE

      (Start Menu -> E -> Eclipse Platform -> Eclipse Oxygen Java EE

      instead of

      Eclipse Neon (which is not installed anymore)


    • In classEgovTutorials.txt we have described how to place the Postgres driver into the build path.

      It turned out that with the current Eclipse version this is not sufficient to run Java Server Pages that invoke JDBC directly. If you want to invoke JDBC from a Java Server Page, you need to copy the driver also to the following directory of your current project in Eclipse:

      'YourProject' -> WebContent -> WEB-INF -> lib

      (thanks to your fellow course participant for figuring this out!)

      ++++

      Compare also with:

      https://stackoverflow.com/questions/24649440/jsp-mysql-class-forname-error

      ++++

      Recall where to find the Postgres driver, i.e.:

      https://jdbc.postgresql.org/download.html

      Download PostgreSQL JDBC 4.0 Driver, 42.1.4.jre6, actually:

      https://jdbc.postgresql.org/download/postgresql-42.1.4.jre6.jar