CS

JDBC

Driver system

??? https://www.emblogic.com/22/linux-device-drivers

Printer manager

Menu -> Print -> Print using system dialog…

ODBC (Open Database Connectivity)

ODBC is an API for accessing DBMS (Database Management Systems)

ODBC Model (Oracle): https://docs.oracle.com/database/121/ADFNS/adfns_odbc.htm#BABEIGEE

Windows odbc manager: odbcad32
With Windows 64 bits: C:\Windows\System32\odbcad32.exe (yes, System32 is for 64 bits systems)
With Windows 32 bits: C:\Windows\SysWOW64\odbcad32.exe (WOW64 means Windows on Windows 64, so it’s for 32 bits systems)

JDBC architecture

JDBC Architecture

Oracle tutorial: http://docs.oracle.com/javase/tutorial/jdbc/overview/index.html

Examples:

File ResultAppSQL.java

import java.sql.*;
class basicJDBC {
    public static void main(String args[]) throws ClassNotFoundException, SQLException {
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        Connection connection = DriverManager.getConnection("jdbc:odbc:basic");
        Statement statement = connection.createStatement();
        ResultSet result = statement.executeQuery("Select titulo, autor from datos");
        while(result.next()) {
            System.out.print(  result.getString("titulo")+", ");
            System.out.println(result.getString("autor"));
        }
        connection.close();
    }
}

JDBC and Dates

References

JDBC and Servlets

Servlet structure with JDBC (methods init and doGet)

API java.sql

API java.sql

Metadate

jdbc:odbc without DSN

ODBC driver in JDBC:

java firstJDBC "Driver={Microsoft Access Driver (*.mdb)};Dbq=Libros.mdb" "Select * from datos" autor titulo  

ServletContext context = getServletConfig( ).getServletContext();
String url=new String("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};Dbq=" + context.getRealPath("Libros.mdb"));

PreparedStatement

PreparedStatement

Derby

F:\Java\db-derby-10.9.1.0-bin iniciar.bat
F:
SET JAVA_PC=F:\Java
SET JAVA_HOME=%JAVA_PC%\jdk1.6.0_04
SET PATH=%JAVA_HOME%\bin;%PATH%
set install=%JAVA_PC%\db-derby-10.9.1.0-bin
set classpath=%install%\lib\derbytools.jar;%install%\lib\derby.jar;%install%
cd %install%\demo\programs
java org.apache.derby.tools.ij

Para crear la base de datos Derby:
CONNECT 'jdbc:derby:firstdb;create=true';

Comandos:
ij> connect 'jdbc:derby:dbdetective';
ij> show tables;
ij> select * from user1.employee where Last_name like 'T%';

Squirrel

set path=C:\Java\Squirrel-sql-2.6.5a;%path%
squirrel-sql.bat

Derby in server mode

set the driver with file: derbynet.jar in CLASSPATH:

     set classpath=F:\Java\db-derby-10.9.1.0-bin\lib\derbynet.jar;%classpath%

start the server

java org.apache.derby.drda.NetworkServerControl start

Explianed in http://db.apache.org/derby/integrate/SQuirreL_Derby.html

Example of Squirrel with DerbyNet (server mode): url: jdbc:derby://localhost:1527/d:/folderpath//Java/ClientDB;create=true

Uses of data

JS charts and graphs

SOA (Service Oriented Architecture)

Server Sent Events


Edit