JavaSP Samples
--------------
1 JavaSP Sample Files Purpose
2 How to Run JavaSP Samples
3 Limitations

1 JavaSP Sample Files Purpose
------------------------------

    Sample: 
        C:\DBMaker\5.4\Samples\JavaSP\AddEmployee.java
    Purpose:
        This sample demonstrates how to use JavaSP to insert data 
        with parameters into database.

        1. register dbmaker  driver
        2. connect to database
        3. insert constant data into table sample.employee
        4. close statements
        5. close connection


2 How to Run JavaSP Samples
---------------------------
    Steps:
        1. Check whether Java Development Kit (JDK) is installed 
           on your machine. Because later you need to compile the 
           java method and zip a class using the Javac and Jar tool.
           
        2. Set PATH for the directory of JDKs bin. 		   
		   set PATH=%JAVA_HOME%\bin;%PATH%
           
        3. Set CLASSPATH environment variable, make it include the 
           binary files for DBMaker JDBC Driver.
		   set CLASSPATH=.;C:\DBMaker\5.4\bin\dmjdbc30.jar;%CLASSPATH%
           
        4. Start the "DBSAMPLE5" database in client-server mode, 
           and use the dmSQL tool connecting to the DB to manipulate 
           the DB. In later sample, we will use the default user 
           SYSADM as login user.

        5. Set the dmconfig.ini file. 
		   Add the following content in the section of "DBSAMPLE5" 
		   in the dmconfig.ini file.
           
           DB_SPDIR= C:\DBMaker\5.4\samples\DATABASE\sp
           
        6. Compile the AddEmployee.java file in DOS command line, 
           then it will create the AddEmployee.class file in the 
           current directory.
           
           C:\DBMaker\5.4\samples\JavaSP>javac AddEmployee.java
           
        7. Move AddEmployee.class to folder C:\DBMaker\5.4\samples\JavaSP\employee.
        
        8. zip the class, It will create the addEmployee.jar file in 
           the current directory. 
           
           C:\DBMaker\5.4\samples\JavaSP>jar cvf addEmployee.jar 
           employee\AddEmployee.class

        9. Make directory jar\SYSADM in <DB_SPDIR>, Then move the 
           addEmployee.jar file into <DB_SPDIR>\jar\SYSADM.
           
           Note: SYSADM must is uppercase.
          
        10. In dmSQL tool, Using the SQL statement to register 
            the JAR file.
            
            dmSQL>ADD JARFILE addEmployee addEmployee.jar;
            
        11. In dmSQL tool, Using the SQL statement to create the 
            stored procedure.
            
            dmSQL>CREATE PROCEDURE addEmployee(int id,char(12) name) 
            RETURNS STATUS LANGUAGE JAVA FROM 
            'employee.AddEmployee.addEmployee(int,String)',addEmployee;
        
        12. In dmSQL tool, Using the SQL statement to execute the 
            java SP. If the SP executed successfully, the 
            sample.EMPLOYEE table will add a new tuple (123,'SYSADM').

            dmSQL> CALL addEmployee(123,'SYSADM');

3 Limitations
---------------------------       
    The javasp works on JRE 1.7 and earlier. Java 1.8 and later are not supported.       
