Salary Database
Hello experts...
i am thinking of designing a database that calculates "Salary" of the organization depending upon attendance of the employees, allowances etc.
i would be glad if someone share with me some links that can help me to lay down some basic architecture. i have googled a bit but no luck.
Here is a sample (MySQL) employee database documentation: downloads.mysql.com/docs/employee-en.pdf
Payroll System ( Entity Relationship Diagram):
http://creately.com/diagram/example/hm53glpl/Payroll+System
Kalman Toth Database & OLAP Architect
SQL Server 2014 Design & Programming
New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012
Similar Messages
-
Change in non based table record status does not propagate to block or form
Hi,
I have an non based table field (call it X) which mirrors an actual column in database. I found out that when I create a record in that block, X's record status will change to 'INSERT', but the block it resides in refuses to change its block_status to 'CHANGED'. In fact, get_block_property shows that the block_status is 'QUERY'.
This is causing a problem for me because I am relying on :system.form_status in my KEY_COMMIT trigger to find out if there is any changes.
Any hint/help/comment are greatly appreciated.
Thank youHi,
Here is my form:
KEY-COMMIT:
if :system.form_status = 'CHANGED' then
commit_form;
end if;
EMPLOYEE: (database table)
id (database field, invisible)
name (database field, invisible)
mirror_name (non database field, but mirroring name, visible)
salary (database field, invisible)
mirror_salary (non database field but mirroring salary, visible)
I would like to use the mirror fields to display information from employee.name and employee.salary on my form. Those mirror fields should capture insert, delete, update actions from user then pass them on to the actual database fields quietly in KEY-COMMIT trigger.
But the problem is when employee.mirror_name's status is INSERT, the block status remains as QUERY becuase employee.mirror_name is not a database field.
Thank you very much! -
View links in oracle ADF/query featching from Database
Please any one help for this query
I have two tables Emp, Dept
I have query like this select * from Emp e, Dept d where e.deptno=d.deptno
Query is fetching like this
Empno Ename job Salary Comm deptno deptno dname Loc
15 i1 support 50000 11 5 5 IT sss
15 i1 support 50000 11 3 3 Account sss
16 i2 support 8000 10 5 5 IT sss
16 i2 support 8000 10 3 3 Account sss
16 i2 support 8000 10 3 3 Software sss
16 i2 support 8000 10 4 4 Operation sss
Query is fetching 6 rows.
but my requirement is what ever records fetching from database with same employee number is one record that is same employee number dept names grouped I will show it as one record how to fetch records from data base.
Here is the example (My Requirement):
This is first row:
Empno Ename job Salary Comm
15 i1 support 50000 11
Deptno dname Loc
5 IT sss
3 Account sss
This is second row:
Empno ename job Salary Comm
16 i2 support 8000 10
Deptno dname Loc
5 IT sss
3 Account sss
2 Software sss
4 Operation sss
i am useing oracle ADF if any possibility in view links either i get from the query as i mentioned.
plz any one can help
thanksPlease any one help for this query
I have two tables Emp, Dept
I have query like this select * from Emp e, Dept d where e.deptno=d.deptno
Query is fetching like this
Empno Ename job Salary Comm deptno deptno dname Loc
15 i1 support 50000 11 5 5 IT sss
15 i1 support 50000 11 3 3 Account sss
16 i2 support 8000 10 5 5 IT sss
16 i2 support 8000 10 3 3 Account sss
16 i2 support 8000 10 3 3 Software sss
16 i2 support 8000 10 4 4 Operation sss
Query is fetching 6 rows.
but my requirement is what ever records fetching from database with same employee number is one record that is same employee number dept names grouped I will show it as one record how to fetch records from data base.
Here is the example (My Requirement):
This is first row:
Empno Ename job Salary Comm
15 i1 support 50000 11
Deptno dname Loc
5 IT sss
3 Account sss
This is second row:
Empno ename job Salary Comm
16 i2 support 8000 10
Deptno dname Loc
5 IT sss
3 Account sss
2 Software sss
4 Operation sss
i am useing oracle ADF if any possibility in view links either i get from the query as i mentioned.
plz any one can help
thanks -
Using JDBC to write a DAT file with delimiters to a database
Hi Everybody
I am new to JDBC and i am trying out some small applications: I downloaded this small program and tried to compile it and and I got the following errors: ( I have MySql installed). I have to set the classpath for the driver. But I am not sure why I am gettting the NullPointerException though)
I will be very gratefull to your help. Thanks a lot..
Loading JDBC Driver -> oracle.jdbc.driver.OracleDriver
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at us.ilango.WriteFileToTable.<init>(WriteFileToTable.java:69)
at us.ilango.WriteFileToTable.main(WriteFileToTable.java:367)
java.lang.NullPointerException
at us.ilango.WriteFileToTable.createTable(WriteFileToTable.java:97)
at us.ilango.WriteFileToTable.main(WriteFileToTable.java:368)
Exception in thread "main"
the Program is as follows:
package us.ilango;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.StringTokenizer;
import java.io.FileReader;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.Date;
import java.text.SimpleDateFormat;
import java.text.NumberFormat;
import java.text.ParseException;
* The following class provides an example of how to read a simple text file
* of records and then insert them into a table in a database. A text file
* named Employee.txt will contain employee records to be inserted into the
* following table:
* SQL> desc emp
* Name Null? Type
* EMP_ID NOT NULL NUMBER
* DEPT_ID NUMBER
* NAME NOT NULL VARCHAR2(30)
* DATE_OF_BIRTH NOT NULL DATE
* DATE_OF_HIRE NOT NULL DATE
* MONTHLY_SALARY NOT NULL NUMBER(15,2)
* POSITION NOT NULL VARCHAR2(100)
* EXTENSION NUMBER
* OFFICE_LOCATION VARCHAR2(100)
* NOTE: This example will provide and call a method that creates the EMP
* table. The name of the method is called createTable() and is called
* from the main() method.
public class WriteFileToTable {
final static String driverClass = "oracle.jdbc.driver.OracleDriver";
final static String connectionURL = "jdbc:oracle:thin:@localhost:1521:CUSTDB";
final static String userID = "scott";
final static String userPassword = "tiger";
final static String inputFileName = "Employee.txt";
final static String TABLE_NAME = "EMP";
final static String DELIM = ",";
Connection con = null;
* Construct a WriteFileToTable object. This constructor will create an
* Oracle database connection.
public WriteFileToTable() {
try {
System.out.print(" Loading JDBC Driver -> " + driverClass + "\n");
Class.forName(driverClass).newInstance();
System.out.print(" Connecting to -> " + connectionURL + "\n");
this.con = DriverManager.getConnection(connectionURL, userID, userPassword);
System.out.print(" Connected as -> " + userID + "\n");
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
* Method used to create the initial EMP table. Before attempting to create
* the table, this method will first try to drop the table.
public void createTable() {
Statement stmt = null;
try {
stmt = con.createStatement();
System.out.print(" Dropping Table: " + TABLE_NAME + "\n");
stmt.executeUpdate("DROP TABLE " + TABLE_NAME);
System.out.print(" - Dropped Table...\n");
System.out.print(" Closing Statement...\n");
stmt.close();
} catch (SQLException e) {
System.out.print(" - Table " + TABLE_NAME + " did not exist.\n");
try {
stmt = con.createStatement();
System.out.print(" Creating Table: " + TABLE_NAME + "\n");
stmt.executeUpdate("CREATE TABLE emp (" +
" emp_id NUMBER NOT NULL " +
" , dept_id NUMBER " +
" , name VARCHAR2(30) NOT NULL " +
" , date_of_birth DATE NOT NULL " +
" , date_of_hire DATE NOT NULL " +
" , monthly_salary NUMBER(15,2) NOT NULL " +
" , position VARCHAR2(100) NOT NULL " +
" , extension NUMBER " +
" , office_location VARCHAR2(100))");
System.out.print(" - Created Table...\n");
System.out.print(" Closing Statement...\n");
stmt.close();
} catch (SQLException e) {
e.printStackTrace();
* Method used to read records from Employee.txt file then write the records
* to an Oracle table within the database named "EMP".
public void performLoadWrite() {
Statement stmt = null;
int insertResults = 0;
StringTokenizer st = null;
String emp_id;
String dept_id;
String name;
String date_of_birth;
String date_of_hire;
String monthly_salary;
String position;
String extension;
String office_location;
try {
System.out.print(" Creating Statement...\n");
stmt = con.createStatement ();
System.out.print(" Create FileReader Object for file: " + inputFileName + "...\n");
FileReader inputFileReader = new FileReader(inputFileName);
System.out.print(" Create BufferedReader Object for FileReader Object...\n");
BufferedReader inputStream = new BufferedReader(inputFileReader);
String inLine = null;
while ((inLine = inputStream.readLine()) != null) {
st = new StringTokenizer(inLine, DELIM);
emp_id = st.nextToken();
dept_id = st.nextToken();
name = st.nextToken();
date_of_birth = st.nextToken();
date_of_hire = st.nextToken();
monthly_salary = st.nextToken();
position = st.nextToken();
extension = st.nextToken();
office_location = st.nextToken();
System.out.print(" Inserting value for [" + name + "]\n");
insertResults = stmt.executeUpdate(
"INSERT INTO " + TABLE_NAME + " VALUES (" +
emp_id +
" , " + dept_id +
" , '" + name + "'" +
" , '" + date_of_birth + "'" +
" , '" + date_of_hire + "'" +
" , " + monthly_salary +
" , '" + position + "'" +
" , " + extension +
" , '" + office_location + "')");
System.out.print(" " + insertResults + " row created.\n");
System.out.print(" Commiting Transaction...\n");
con.commit();
System.out.print(" Closing inputString...\n");
inputStream.close();
System.out.print(" Closing Statement...\n");
stmt.close();
} catch (SQLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
* Method used to query records from the database table EMP. This method
* can be used to verify all records have been correctly loaded from the
* example text file "Employee.txt".
public void queryRecords() {
Statement stmt = null;
ResultSet rset = null;
int deleteResults = 0;
int rowNumber = 0;
int emp_id;
int dept_id;
String name;
String date_of_birth;
Date date_of_birth_p;
String date_of_hire;
Date date_of_hire_p;
float monthly_salary;
String position;
int extension;
String office_location;
try {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
NumberFormat defaultFormat = NumberFormat.getCurrencyInstance();
System.out.print(" Creating Statement...\n");
stmt = con.createStatement ();
System.out.print(" Opening query for table: " + TABLE_NAME + "...\n");
rset = stmt.executeQuery ("SELECT * FROM emp ORDER BY emp_id");
while (rset.next ()) {
rowNumber = rset.getRow();
emp_id = rset.getInt(1);
if ( rset.wasNull() ) {emp_id = -1;}
dept_id = rset.getInt(2);
if ( rset.wasNull() ) {dept_id = -1;}
name = rset.getString(3);
if ( rset.wasNull() ) {name = "<null>";}
date_of_birth = rset.getString(4);
if ( rset.wasNull() ) {date_of_birth = "1900-01-01";}
try {
date_of_birth_p = formatter.parse(date_of_birth);
} catch (ParseException e) {
date_of_birth_p = new Date(0);
date_of_hire = rset.getString(5);
if ( rset.wasNull() ) {date_of_hire = "1900-01-01";}
try {
date_of_hire_p = formatter.parse(date_of_hire);
} catch (ParseException e) {
date_of_hire_p = new Date(0);
monthly_salary = rset.getFloat(6);
if ( rset.wasNull() ) {monthly_salary = 0;}
position = rset.getString(7);
if ( rset.wasNull() ) {position = "<null>";}
extension = rset.getInt(8);
if ( rset.wasNull() ) {extension = -1;}
office_location = rset.getString(9);
if ( rset.wasNull() ) {office_location = "<null>";}
System.out.print(
"\n" +
" RESULTS -> [R" + rowNumber + "] " + "\n" +
" Employee ID : " + emp_id + "\n" +
" Department ID : " + dept_id + "\n" +
" Employee Name : " + name + "\n" +
" D.O.B. : " + date_of_birth_p + "\n" +
" Date of Hire : " + date_of_hire_p + "\n" +
" Monthly Salary : " + defaultFormat.format(monthly_salary) + "\n" +
" Position : " + position + "\n" +
" Extension : x" + extension + "\n" +
" Office Location : " + office_location +
"\n");
System.out.print(" Closing ResultSet...\n");
rset.close();
System.out.print(" Closing Statement...\n");
stmt.close();
} catch (SQLException e) {
e.printStackTrace();
* Close down Oracle connection.
public void closeConnection() {
try {
System.out.print(" Closing Connection...\n");
con.close();
} catch (SQLException e) {
e.printStackTrace();
* Sole entry point to the class and application.
* @param args Array of String arguments.
* @exception java.lang.InterruptedException
* Thrown from the Thread class.
public static void main(String[] args)
throws java.lang.InterruptedException {
WriteFileToTable runExample = new WriteFileToTable();
runExample.createTable();
runExample.performLoadWrite();
runExample.queryRecords();
runExample.closeConnection();
}Hi
Thanks a lot. I ran the program with the MySql driver as follows:
The errors are as follows: I will ttry to place the Driver in the Classpath. As far as I know the driver has been specified correctly this time.
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at us.ilango.WriteAntennas.<init>(WriteAntennas.java:41)
at us.ilango.WriteAntennas.main(WriteAntennas.java:377)
java.lang.NullPointerException
at us.ilango.WriteAntennas.createTable(WriteAntennas.java:70)
at us.ilango.WriteAntennas.main(WriteAntennas.java:378)
Exception in thread "main" Loading JDBC Driver -> com.mysql.jdbc.Driver
The program is as follows:
package us.ilango;
* @author ilango
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.StringTokenizer;
import java.io.FileReader;
import java.io.BufferedReader;
import java.io.IOException;
public class WriteAntennas {
final static String driverClass = "com.mysql.jdbc.Driver";
final static String connectionURL = "jdbc:mysql://localhost/test2";
final static String userID = "brian";
final static String userPassword = " ";
final static String inputFileName = "CO.DAT";
final static String TABLE_NAME = "CELL";
final static String DELIM = "|";
Connection con = null;
public WriteAntennas() {
try {
System.out.print(" Loading JDBC Driver -> " + driverClass + "\n");
Class.forName(driverClass).newInstance();
System.out.print(" Connecting to -> " + connectionURL + "\n");
this.con = DriverManager.getConnection(connectionURL, userID, userPassword);
System.out.print(" Connected as -> " + userID + "\n");
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
* Method used to create the initial EMP table. Before attempting to create
* the table, this method will first try to drop the table.
public void createTable() {
Statement stmt=null;
try {
stmt = con.createStatement();
System.out.print(" Dropping Table: " + TABLE_NAME + "\n");
stmt.executeUpdate("DROP TABLE " + TABLE_NAME);
System.out.print(" - Dropped Table...\n");
System.out.print(" Closing Statement...\n");
stmt.close();
} catch (SQLException e) {
System.out.print(" - Table " + TABLE_NAME + " did not exist.\n");
try {
stmt = con.createStatement();
System.out.print(" Creating Table: " + TABLE_NAME + "\n");
stmt.executeUpdate("create table TOWER_PUBACC_CO (" +
"record_type char(2) null" +
", content_indicator char(3) null" +
", file_number char(8) null" +
", registration_number char(7) null" +
", unique_system_identifier long(9,0) not null" +
", coordinate_type char(1) not null" +
",latitude_degrees int null" +
",latitude_minutes int null" +
",latitude_seconds int(4,1) null" +
",latitude_direction char(1) null" +
",latitude_total_seconds int(8,1) null" +
",longitude_degrees int null" +
",longitude_minutes int null" +
",longitude_seconds int(4,1) null" +
",longitude_direction char(1) null" +
",longitude_total_seconds int(8,1) null)" );
System.out.print(" created Table...\n");
System.out.print(" closing Statement...\n");
stmt.close();
} catch (SQLException e) {
e.printStackTrace();
public void performLoadWrite() {
Statement stmt = null;
int insertResults = 0;
StringTokenizer st = null;
String record_type ;
String content_indicator;
String file_number ;
String registration_number;
String unique_system_identifier ;
String coordinate_type;
String latitude_degrees;
String latitude_minutes;
String latitude_seconds;
String latitude_direction;
String latitude_total_seconds;
String longitude_degrees;
String longitude_minutes;
String longitude_seconds;
String longitude_direction;
String longitude_total_seconds;
try {
System.out.print(" Creating Statement...\n");
stmt = con.createStatement ();
System.out.print(" Create FileReader Object for file: " + inputFileName + "...\n");
FileReader inputFileReader = new FileReader(inputFileName);
System.out.print(" Create BufferedReader Object for FileReader Object...\n");
BufferedReader inputStream = new BufferedReader(inputFileReader);
String inLine = null;
while ((inLine = inputStream.readLine()) != null) {
st = new StringTokenizer(inLine, DELIM);
record_type = st.nextToken();
content_indicator = st.nextToken();
file_number = st.nextToken();
registration_number = st.nextToken();
unique_system_identifier = st.nextToken();
coordinate_type =st.nextToken();
latitude_degrees = st.nextToken();
latitude_minutes = st.nextToken();
latitude_seconds=st.nextToken();
latitude_direction = st.nextToken();
latitude_total_seconds =st.nextToken();
longitude_degrees= st.nextToken();
longitude_minutes = st.nextToken();
longitude_seconds = st.nextToken();
longitude_direction=st.nextToken();
longitude_total_seconds =st.nextToken();
System.out.print(" Inserting value for [" + unique_system_identifier + "]\n");
insertResults = stmt.executeUpdate(
"INSERT INTO " + TABLE_NAME + " VALUES (" +
record_type +
" , " + content_indicator +
" , '" + file_number + "'" +
" , '" + registration_number + "'" +
" , '" + unique_system_identifier + "'" +
" , " + coordinate_type + "'" +
" , '" + latitude_degrees + "'" +
" , " + latitude_minutes + "'" +
" , '" + latitude_seconds + "'" +
" , '" + latitude_direction + "'" +
" , '" + latitude_total_seconds + "'" +
" , '" + longitude_minutes + "'" +
" , '" + longitude_seconds + "'" +
" , '" + longitude_direction + "'" +
" , '" + longitude_total_seconds + "')");
System.out.print(" " + insertResults + " row created.\n");
System.out.print(" Commiting Transaction...\n");
con.commit();
System.out.print(" Closing inputString...\n");
inputStream.close();
System.out.print(" Closing Statement...\n");
stmt.close();
} catch (SQLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
public void queryRecords() {
Statement stmt = null;
ResultSet rset = null;
int deleteResults = 0;
int rowNumber = 0;
String record_type;
String content_indicator;
String file_number;
String registration_number ;
long unique_system_identifier;
String coordinate_type ;
int latitude_degrees ;
int latitude_minutes ;
int latitude_seconds;
String latitude_direction;
int latitude_total_seconds;
int longitude_degrees;
int longitude_minutes;
int longitude_seconds;
String longitude_direction;
int longitude_total_seconds;
try {
System.out.print(" Creating Statement...\n");
stmt = con.createStatement ();
System.out.print(" Opening query for table: " + TABLE_NAME + "...\n");
rset = stmt.executeQuery ("SELECT * FROM cell ORDER BY unique_system_identifier");
while (rset.next ()) {
rowNumber = rset.getRow();
unique_system_identifier = rset.getInt (1);
if ( rset.wasNull() ) {unique_system_identifier = -1;}
record_type = rset.getString (2);
if ( rset.wasNull() ) {record_type = "<null>";}
content_indicator = rset.getString(3);
if ( rset.wasNull() ) {content_indicator = "<null>";}
file_number = rset.getString(4);
if ( rset.wasNull() ) {file_number = "<null>";}
registration_number = rset.getString(5);
if ( rset.wasNull() ) {registration_number = "<null>";}
coordinate_type = rset.getString(6);
if ( rset.wasNull() ) {coordinate_type = "<null>";}
latitude_degrees = rset.getInt(7);
if ( rset.wasNull() ) {latitude_degrees = 1;}
latitude_minutes = rset.getInt(8);
if ( rset.wasNull() ) {latitude_minutes = 1;}
latitude_seconds = rset.getInt(9);
if ( rset.wasNull() ) {latitude_seconds = 1;}
latitude_direction = rset.getString(10);
if ( rset.wasNull() ) {latitude_direction = "<null>";}
latitude_total_seconds = rset.getInt(11);
if ( rset.wasNull() ) {latitude_total_seconds = 1;}
longitude_degrees = rset.getInt(12);
if ( rset.wasNull() ) {longitude_degrees = 1;}
longitude_minutes = rset.getInt(13);
if ( rset.wasNull() ) {longitude_minutes = 1;}
longitude_seconds = rset.getInt(14);
if ( rset.wasNull() ) {longitude_seconds = 1;}
longitude_direction = rset.getString(15);
if ( rset.wasNull() ) {longitude_direction = "<null>";}
longitude_total_seconds = rset.getInt(16);
if ( rset.wasNull() ) {longitude_total_seconds = 1;}
System.out.print(
"\n" +
" RESULTS -> [R" + rowNumber + "] " + "\n" +
" Unique_System_Identifier : " + unique_system_identifier + "\n" +
" Record_type : " + record_type + "\n" +
" Content_Indicator : " + content_indicator + "\n" +
" Registration_Number : " + registration_number + "\n" +
" File_Number : " + file_number + "\n" +
" Coordinate_Type : " + coordinate_type + "\n" +
" Latitude_Degrees : " + latitude_degrees + "\n" +
" Latitude_Minutes : " + latitude_minutes + "\n" +
" Latitude_Seconds : " + latitude_seconds + "\n" +
" Latitude_Direction : " + latitude_direction + "\n" +
" Latitude_Total_Seconds : " + latitude_total_seconds + "\n" +
" Longitude_Degrees : " + longitude_degrees + "\n" +
" longitude_minutes : " + longitude_minutes + "\n" +
" Longitude_Seconds : " + longitude_seconds + "\n" +
" longitude_direction : " + longitude_direction + "\n" +
" Longitude_Total_Seconds : " + longitude_total_seconds +
"\n");
System.out.print(" Closing ResultSet...\n");
rset.close();
System.out.print(" Closing Statement...\n");
stmt.close();
} catch (SQLException e) {
e.printStackTrace();
public void closeConnection() {
try {
System.out.print(" Closing Connection...\n");
con.close();
} catch (SQLException e) {
e.printStackTrace();
public static void main(String[] args)
throws java.lang.InterruptedException {
WriteAntennas runJob = new WriteAntennas();
runJob.createTable();
runJob.performLoadWrite();
runJob.queryRecords();
runJob.closeConnection();
} -
Insert an image from a Database
Hi - I am trying to insert an image from a database into a webpage. Basically when clients register on the site they upload their logo which i want to come up when they look at their account details and when they post a job. When I test the file upload the file name is in an "image" field in my database and the image is in the website files on the server but I am having problems trying to get the logo to shop up on the webpage. I have one table called Recruiters where all the client's contact details (and logo upload goes) and a table called jobs where all the job details go when they post a job (this does not hold the logo upload).
At the moment i am trying to insert the image into the Recruiter account Details page where all the clients contact details are and all this information comes from the Recruiter table (including the image) but the image does not appear. the query in my recordset is:-
SELECT *
FROM recruiters
WHERE RecruiterID = colname
(colname = $_GET['RecruiterID'])
<?php require_once('../Connections/laura.php'); ?>
<?php
//initialize the session
if (!isset($_SESSION)) {
session_start();
// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
$logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
//to fully log out a visitor we need to clear the session varialbles
$_SESSION['MM_Username'] = NULL;
$_SESSION['MM_UserGroup'] = NULL;
$_SESSION['PrevUrl'] = NULL;
unset($_SESSION['MM_Username']);
unset($_SESSION['MM_UserGroup']);
unset($_SESSION['PrevUrl']);
$logoutGoTo = "../index.php";
if ($logoutGoTo) {
header("Location: $logoutGoTo");
exit;
?>
<?php
if (!isset($_SESSION)) {
session_start();
$MM_authorizedUsers = "Recruiter";
$MM_donotCheckaccess = "false";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
if (($strUsers == "") && false) {
$isValid = true;
return $isValid;
$MM_restrictGoTo = "../Unavailablepage.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0)
$MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
return $theValue;
$colname_rsAccountDetails = "-1";
if (isset($_GET['RecruiterID'])) {
$colname_rsAccountDetails = $_GET['RecruiterID'];
mysql_select_db($database_laura, $laura);
$query_rsAccountDetails = sprintf("SELECT * FROM recruiters WHERE RecruiterID = %s", GetSQLValueString($colname_rsAccountDetails, "int"));
$rsAccountDetails = mysql_query($query_rsAccountDetails, $laura) or die(mysql_error());
$row_rsAccountDetails = mysql_fetch_assoc($rsAccountDetails);
$totalRows_rsAccountDetails = mysql_num_rows($rsAccountDetails);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Nursery and Childcare Jobs in the UK</title>
<link href="../CSS/Global.css" rel="stylesheet" type="text/css" />
<script src="../SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="../SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
<link href="../SpryAssets/SpryMenuBarVertical.css" rel="stylesheet" type="text/css" />
<!-- google adwords -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-6435415-4']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
</script>
</head>
<body>
<div class="container">
<div class="header"><!-- end .header --><a href="../index.php"><img src="../Images/Logo.png" width="900" height="200" alt="Logo" /></a></div>
<ul id="MenuBar1" class="MenuBarHorizontal">
<li><a href="../index.php">Home</a> </li>
<li><a href="#" class="MenuBarItemSubmenu">Recruiters</a>
<ul>
<li><a href="recruiterbenefits.php">Benefits</a></li>
<li><a href="recruiterfees.php">Fees</a></li>
<li><a href="recreg.php">Register</a></li>
<li><a href="reclogin.php">Login </a></li>
</ul>
</li>
<li><a class="MenuBarItemSubmenu" href="#">Jobseekers</a>
<ul>
<li><a href="../Jobseekerarea/jobseekerbenefits.php">Benefits</a> </li>
<li><a href="../Jobseekerarea/jobseekerreg1.php">Register</a></li>
<li><a href="../Jobseekerarea/jslogin.php">Login</a></li>
</ul>
</li>
<li><a href="../contactus.php">Contact Us</a></li>
</ul>
<div class="sidebar1">
<p> </p>
<div class="recruitsidebar">
<ul id="MenuBar2" class="MenuBarVertical">
<li><a href="postajob.php">Post a Job</a></li>
<li><a href="recruiterjobs1.php">My Jobs</a></li>
<li><a href="recAccdetails.php?RecruiterID=<?php echo $row_rsAccountDetails['RecruiterID']; ?>">My Details</a></li>
<li><a href="Saferrecruitment.php">Safer Recruitment</a></li>
<li><a href="Interview1.php" class="MenuBarItemSubmenu">Interviewing Staff</a>
<ul>
<li><a href="recInterviewquestions.php">Nursery Staff Interview Questions</a></li>
</ul>
</li>
<li><a href="Nurseryjobsdescriptions.php">Nursery Job Descriptions</a></li>
<li><a href="recruiterarea.php">Recruiter Home</a></li>
<li><a href="<?php echo $logoutAction ?>">Log Out</a></li>
</ul>
<p> </p>
</div>
</div>
<div class="content">
<h1>Account Details</h1>
<p>Below are the details you have provided us with about your nursery/setting.</p>
<p> </p>
<form id="accountdetailsform" name="accountdetailsform" method="post" action="recUpdate.php?RecruiterID=<?php echo $row_rsAccountDetails['RecruiterID']; ?>">
<table width="580" border="0" cellpadding="3" cellspacing="3" id="accountdetails">
<tr>
<td width="212" scope="col">Nursery/Setting Name</td>
<td width="347" scope="col"><?php echo $row_rsAccountDetails['client']; ?></td>
</tr>
<tr>
<td>Contact Name</td>
<td><?php echo $row_rsAccountDetails['contactname']; ?></td>
</tr>
<tr>
<td>Setting Type</td>
<td><?php echo $row_rsAccountDetails['settingtype']; ?></td>
</tr>
<tr>
<td>Nursery/Setting</td>
<td><?php echo $row_rsAccountDetails['Setting']; ?></td>
</tr>
<tr>
<td>Building Name/Number</td>
<td><?php echo $row_rsAccountDetails['buildingnumber']; ?></td>
</tr>
<tr>
<td>Street Name</td>
<td><?php echo $row_rsAccountDetails['streetname']; ?></td>
</tr>
<tr>
<td>Address</td>
<td><?php echo $row_rsAccountDetails['address3']; ?></td>
</tr>
<tr>
<td>Town/City</td>
<td><?php echo $row_rsAccountDetails['town']; ?></td>
</tr>
<tr>
<td>Post Code</td>
<td><?php echo $row_rsAccountDetails['postcode']; ?></td>
</tr>
<tr>
<td>Region</td>
<td><?php echo $row_rsAccountDetails['region']; ?></td>
</tr>
<tr>
<td>Telephone</td>
<td><?php echo $row_rsAccountDetails['telephone']; ?></td>
</tr>
<tr>
<td>Email</td>
<td><?php echo $row_rsAccountDetails['email']; ?></td>
</tr>
<tr>
<td>Website</td>
<td><?php echo $row_rsAccountDetails['WebAddress']; ?></td>
</tr>
<tr>
<td>Password</td>
<td> </td>
</tr>
<tr>
<td>Logo</td>
<td><img src="<?php echo $row_rsAccountDetails['Image']; ?>" alt="Logo" /></td>
</tr>
<tr>
<td>Date Registered</td>
<td><?php echo $row_rsAccountDetails['dateregistered']; ?></td>
</tr>
</table>
<p>
<input name="hiddenField" type="hidden" id="hiddenField" value="<?php echo $row_rsAccountDetails['RecruiterID']; ?>" />
</p>
<p>
<input type="submit" name="Update" id="Update" value="Update Details" />
</p>
<p> </p>
</form>
<p> </p>
<table width="600" border="0" cellpadding="3" cellspacing="3" class="postform">
<tr> </tr>
<tr> </tr>
<tr> </tr>
</table>
<p> </p>
<p> </p>
</div>
<div class="sidebar2">
<h4> </h4>
<!-- end .sidebar2 --></div>
<div class="footer">
<p><a href="../index.php">Home</a> | <a href="../contactus.php">Contact us</a> | <a href="../PrivacyPolicy.php">Privacy</a> | <a href="../termsandconditions.php">Terms of Business</a></p>
<p>© theNurseryJobSite.com 2011</p>
<!-- end .footer --></div>
<!-- end .container --></div>
<script type="text/javascript">
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
var MenuBar2 = new Spry.Widget.MenuBar("MenuBar2", {imgRight:"../SpryAssets/SpryMenuBarRightHover.gif"});
</script>
</body>
</html>
<?php
mysql_free_result($rsAccountDetails);
?>Hi
You were right – I had to insert full path and it has worked so thanks.
Would you be able to help me out with inserting the logo into a job post page and the recordset I will need to insert the logo?
Basically I want to add the logo that is uploaded when a client registers on the site onto a job info page. To access the the details about a job, jobseekers just click on the job that interests them which takes them to the job details page which pulls all the information from the "Job" table in the database. However, the logo is stored in the "image" field in the "Recruiter" table in the database. I have tried setting up a recordset as:-
SELECT Image
FROM recruiters
WHERE RecruiterID = colname
(colname = $_GET['RecruiterID'])
<?php require_once('../Connections/laura.php'); ?>
<?php
//initialize the session
if (!isset($_SESSION)) {
session_start();
// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
$logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
//to fully log out a visitor we need to clear the session varialbles
$_SESSION['MM_Username'] = NULL;
$_SESSION['MM_UserGroup'] = NULL;
$_SESSION['PrevUrl'] = NULL;
unset($_SESSION['MM_Username']);
unset($_SESSION['MM_UserGroup']);
unset($_SESSION['PrevUrl']);
$logoutGoTo = "../index.php";
if ($logoutGoTo) {
header("Location: $logoutGoTo");
exit;
?>
<?php
if (!isset($_SESSION)) {
session_start();
$MM_authorizedUsers = "Recruiter";
$MM_donotCheckaccess = "false";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
if (($strUsers == "") && false) {
$isValid = true;
return $isValid;
$MM_restrictGoTo = "../Unavailablepage.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0)
$MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
return $theValue;
$colname_rsDetails = "-1";
if (isset($_GET['JobID'])) {
$colname_rsDetails = $_GET['JobID'];
mysql_select_db($database_laura, $laura);
$query_rsDetails = sprintf("SELECT * FROM jobs WHERE JobID = %s", GetSQLValueString($colname_rsDetails, "text"));
$rsDetails = mysql_query($query_rsDetails, $laura) or die(mysql_error());
$row_rsDetails = mysql_fetch_assoc($rsDetails);
$totalRows_rsDetails = "-1";
if (isset($_GET['JobID'])) {
$totalRows_rsDetails = $_GET['JobID'];
mysql_select_db($database_laura, $laura);
$query_rsDetails = sprintf("SELECT recruiters.Image, jobs.JobID, jobs.RecruiterID, jobs.jobtitle, jobs.`Position`, jobs.Nursery, jobs.branchlocation, jobs.ContactName, jobs.JobDescription, jobs.Location, jobs.town, jobs.employmenttype, jobs.Hours, jobs.qualifications, jobs.Salary, jobs.ContactNo, jobs.Email, jobs.dateposted FROM jobs, recruiters WHERE JobID = %s", GetSQLValueString($colname_rsDetails, "int"));
$rsDetails = mysql_query($query_rsDetails, $laura) or die(mysql_error());
$row_rsDetails = mysql_fetch_assoc($rsDetails);
$totalRows_rsDetails = "-1";
if (isset($_GET['JobID'])) {
$totalRows_rsDetails = $_GET['JobID'];
mysql_select_db($database_laura, $laura);
$query_rsDetails = sprintf("SELECT recruiters.Image, jobs.JobID, jobs.RecruiterID, jobs.jobtitle, jobs.`Position`, jobs.Nursery, jobs.branchlocation, jobs.ContactName, jobs.JobDescription, jobs.Location, jobs.town, jobs.employmenttype, jobs.Hours, jobs.qualifications, jobs.Salary, jobs.ContactNo, jobs.Email, jobs.dateposted FROM jobs, recruiters WHERE JobID = %s", GetSQLValueString($colname_rsDetails, "int"));
$rsDetails = mysql_query($query_rsDetails, $laura) or die(mysql_error());
$row_rsDetails = mysql_fetch_assoc($rsDetails);
$totalRows_rsDetails = "-1";
if (isset($_GET['JobID'])) {
$totalRows_rsDetails = $_GET['JobID'];
mysql_select_db($database_laura, $laura);
$query_rsDetails = sprintf("SELECT recruiters.Image, jobs.JobID, jobs.RecruiterID, jobs.jobtitle, jobs.`Position`, jobs.Nursery, jobs.branchlocation, jobs.ContactName, jobs.JobDescription, jobs.Location, jobs.town, jobs.employmenttype, jobs.Hours, jobs.qualifications, jobs.Salary, jobs.ContactNo, jobs.Email, jobs.dateposted FROM jobs, recruiters WHERE JobID = %s", GetSQLValueString($totalRows_rsDetails, "int"));
$rsDetails = mysql_query($query_rsDetails, $laura) or die(mysql_error());
$row_rsDetails = mysql_fetch_assoc($rsDetails);
$totalRows_rsDetails = mysql_num_rows($rsDetails);
$colname_rsRecruiterID2 = "-1";
if (isset($_GET['RecruiterID'])) {
$colname_rsRecruiterID2 = $_GET['RecruiterID'];
mysql_select_db($database_laura, $laura);
$query_rsRecruiterID2 = sprintf("SELECT RecruiterID FROM recruiters WHERE RecruiterID = %s", GetSQLValueString($colname_rsRecruiterID2, "int"));
$rsRecruiterID2 = mysql_query($query_rsRecruiterID2, $laura) or die(mysql_error());
$row_rsRecruiterID2 = mysql_fetch_assoc($rsRecruiterID2);
$totalRows_rsRecruiterID2 = mysql_num_rows($rsRecruiterID2);
$colname_rsRecruiterID = "-1";
if (isset($_SESSION['MM_Username'])) {
$colname_rsRecruiterID = $_SESSION['MM_Username'];
mysql_select_db($database_laura, $laura);
$query_rsRecruiterID = sprintf("SELECT RecruiterID FROM recruiters WHERE email = %s", GetSQLValueString($colname_rsRecruiterID, "text"));
$rsRecruiterID = mysql_query($query_rsRecruiterID, $laura) or die(mysql_error());
$row_rsRecruiterID = mysql_fetch_assoc($rsRecruiterID);
$totalRows_rsRecruiterID = mysql_num_rows($rsRecruiterID);
$colname_Recordset1 = "-1";
if (isset($_GET['RecruiterID'])) {
$colname_Recordset1 = $_GET['RecruiterID'];
mysql_select_db($database_laura, $laura);
$query_Recordset1 = sprintf("SELECT Image FROM recruiters WHERE RecruiterID = %s", GetSQLValueString($colname_Recordset1, "int"));
$Recordset1 = mysql_query($query_Recordset1, $laura) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
$query_rsJobs = "SELECT * FROM jobs";
$rsJobs = mysql_query($query_rsJobs, $laura) or die(mysql_error());
$row_rsJobs = mysql_fetch_assoc($rsJobs);
$totalRows_rsJobs = mysql_num_rows($rsJobs);
$colname_rsJobs = "-1";
if (isset($_GET['Position'])) {
$colname_rsJobs = $_GET['Position'];
$varLocation_rsJobs = "-1";
if (isset($_GET['Location'])) {
$varLocation_rsJobs = $_GET['Location'];
mysql_select_db($database_laura, $laura);
$query_rsJobs = sprintf("SELECT `Position`, Nursery, Location, Salary, Email, ContactNo, JobDescription, JobID FROM jobs WHERE `Position` = %s AND jobs.Location = %s", GetSQLValueString($colname_rsJobs, "text"),GetSQLValueString($varLocation_rsJobs, "text"));
$rsJobs = mysql_query($query_rsJobs, $laura) or die(mysql_error());
$row_rsJobs = mysql_fetch_assoc($rsJobs);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Nursery and Childcare Jobs in the UK</title>
<link href="../CSS/Global.css" rel="stylesheet" type="text/css" />
<script src="../SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="../SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
<link href="../SpryAssets/SpryMenuBarVertical.css" rel="stylesheet" type="text/css" />
<!-- google adwards -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-6435415-4']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
</script>
</head>
<body>
<div class="container">
<div class="header"><!-- end .header --><a href="../index.php"><img src="../Images/Logo.png" width="900" height="200" alt="the Nursery Job Site" /></a></div>
<div class="navbar"> <ul id="MenuBar1" class="MenuBarHorizontal">
<li><a href="thenurseryjobsite.php">About the Nursery Job Site</a> </li>
<li><a href="#" class="MenuBarItemSubmenu">Recruiters</a>
<ul>
<li><a href="Recruiterarea/recruiterbenefits.php">Benefits</a></li>
<li><a href="Recruiterarea/recruiterfees.php">Fees</a></li>
<li><a href="Recruiterarea/reclogin.php">Login</a></li>
<li><a href="Recruiterarea/recreg.php">Register</a></li>
</ul>
</li>
<li><a class="MenuBarItemSubmenu" href="#">Jobseekers</a>
<ul>
<li><a href="Jobseekerarea/jobseekerbenefits.php">Benefits</a> </li>
<li><a href="Jobseekerarea/jslogin.php">Login</a></li>
<li><a href="Jobseekerarea/jobseekerreg1.php">Register</a></li>
</ul>
</li>
<li><a href="contactus.php">Contact Us</a></li>
</ul> </div> <!--end navbar div -->
<div class="sidebar1">
<p> </p>
<div class="recruitsidebar">
<ul id="MenuBar2" class="MenuBarVertical">
<li><a href="postajob.php">Post a Job</a></li>
<li><a href="recAccdetails.php?RecruiterID=<?php echo $row_rsRecruiterID['RecruiterID']; ?>">My Details </a></li>
<li><a href="recruiterjobs1.php">My Jobs</a></li>
<li><a href="Saferrecruitment.php">Safer Recruitment</a></li>
<li><a href="Interview1.php" class="MenuBarItemSubmenu">Interviewing Staff</a>
<ul>
<li><a href="recInterviewquestions.php">Nursery Staff Interview Questions</a></li>
</ul>
</li>
<li><a href="Nurseryjobsdescriptions.php">Nursery Job Descriptions</a></li>
<li><a href="recruiterarea.php">Recruiter Home</a></li>
<li><a href="<?php echo $logoutAction ?>">Log Out</a></li>
</ul>
<p> </p>
</div>
</div>
<div class="content">
<h1> </h1>
<div class="detailheading" id="detailheading">
<h1> </h1>
<table width="564" border="0" align="center" cellpadding="3" cellspacing="3" id="headingtable">
<tr>
<td width="89" height="44" align="center" class="headertext"><h1>Nursery:</h1></td>
<td width="283" class="headertext"><?php echo $row_rsDetails['Nursery']; ?></td>
<td width="162" rowspan="2"><img src="<?php echo $row_Recordset1['Image']; ?>" alt="" name="nurserylogo" align="right" id="nurserylogo" /></td>
</tr>
<tr align="left" class="headertext">
<td width="89" height="44" align="center"><h1 class="headertext">Job Title:</h1></td>
<td align="left"><?php echo $row_rsDetails['jobtitle']; ?></td>
</tr>
</table>
<p> </p>
</div>
<table width="568" border="0" align="center" cellpadding="3" cellspacing="3" class="detail" id="detailtable">
<tr>
<td width="162" scope="col">Job Title</td>
<td width="381" scope="col"><?php echo $row_rsDetails['jobtitle']; ?></td>
</tr>
<tr>
<td>Nursery</td>
<td><?php echo $row_rsDetails['Nursery']; ?></td>
</tr>
<tr>
<td>Branch Name/Location</td>
<td><?php echo $row_rsDetails['branchlocation']; ?></td>
</tr>
<tr>
<td>Location</td>
<td><?php echo $row_rsDetails['Location']; ?>,<?php echo $row_rsDetails['town']; ?></td>
</tr>
<tr>
<td valign="top">Job Description</td>
<td><p> </p>
<p><?php echo $row_rsDetails['JobDescription']; ?></p>
<p> </p></td>
</tr>
<tr>
<td>Qualifications Required</td>
<td><?php echo $row_rsDetails['qualifications']; ?></td>
</tr>
<tr>
<td>Employment Type</td>
<td><?php echo $row_rsDetails['employmenttype']; ?></td>
</tr>
<tr>
<td>Hours</td>
<td><?php echo $row_rsDetails['Hours']; ?></td>
</tr>
<tr>
<td>Salary</td>
<td>£<?php echo $row_rsDetails['Salary']; ?></td>
</tr>
<tr>
<td>Contact Number</td>
<td><?php echo $row_rsDetails['ContactNo']; ?></td>
</tr>
<tr>
<td>Email</td>
<td><?php echo $row_rsDetails['Email']; ?></td>
</tr>
<tr>
<td>Date Posted</td>
<td><?php echo $row_rsDetails['dateposted']; ?></td>
</tr>
<tr>
<td>Job ID</td>
<td><?php echo $row_rsDetails['JobID']; ?></td>
</tr>
</table>
<p><br />
</p>
<form id="recruiterjobsform" name="recruiterjobsform" method="post" action="recruiterjobs1.php">
<input name="RecruiterIDjobs" type="hidden" id="RecruiterIDjobs" value="<?php echo $row_rsDetails['RecruiterID']; ?>" />
<input type="submit" name="button" id="button" value="return to my jobs" />
</form>
<p> </p>
<script type="text/javascript">
var MenuBar2 = new Spry.Widget.MenuBar("MenuBar2", {imgRight:"../SpryAssets/SpryMenuBarRightHover.gif"});
</script><script type="text/javascript">
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
var MenuBar2 = new Spry.Widget.MenuBar("MenuBar2", {imgRight:"../SpryAssets/SpryMenuBarRightHover.gif"});
</script>
<p> </p>
</div>
<div class="sidebar2">
<h4> </h4>
<!-- end .sidebar2 --></div>
<div class="footer">
<p><a href="../index.php">Home</a> | <a href="../contactus.php">Contact us</a> | <a href="../PrivacyPolicy.php">Privacy</a> | <a href="../termsandconditions.php">Terms of Business</a></p>
<p>© theNurseryJobSite.com 2011</p>
<!-- end .footer --></div>
<!-- end .container --></div>
<script type="text/javascript">
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
var MenuBar2 = new Spry.Widget.MenuBar("MenuBar2", {imgRight:"../SpryAssets/SpryMenuBarRightHover.gif"});
</script>
</body>
</html>
<?php
mysql_free_result($rsDetails);
mysql_free_result($rsRecruiterID2);
mysql_free_result($rsRecruiterID);
mysql_free_result($Recordset1);
?> -
How to retrieve 5th highest salary in a single statement
Hi,
How can we retrieve 5th highest salary in a single statementAnother method
select top 1
OrderID
, Quantity
from
select top 5
OrderID
, Quantity = sum (Quantity)
from
[Order Details]
group by
OrderID
order by
2 desc
) q
order by
2 asc
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
How to Get Previous Month Salary for a particular employee?
Hi
I am developing a report to get the Net Pay Difference from Previous month.
I am using logical database pnp.
My question is how can we get the last month (Previous from current selected month) salary of perticular employee. I read the thread which is related to this but I can't understand the reply's. I think it is due to that I am new in ABAP and my experience in only 22 days. If someone reply with code example then it will more helpful for me.
Also If you can tell me the table name from where we can get the salary of particular month of particular employee then it will also helpful for me.
Regards
IftikharHi,
Payroll data is stored in cluster tables.
You can either use macro for retrieving the data or Function module.
1. Use FM -CU_READ_RGDIR for getting the RG directory values.Pass
employee Number and molga.You will get all the sequence Numbers from this
FM.
The last record will be the latest one.
2. Then Use FM - PYXX_READ_PAYROLL_RESULT for getting the payroll
results table.Pass cluster ID- 'IN' ,pernr ,sequence number for which period
you want (In your case ,current period minus 1) and
READ_ONLY_INTERNATIONAL = 'X',
3. You will get all the results from PAYROLL_RESULT = it_result
Then you can loop this internal table like LOOP at it_result-inter-rt into wa..
Get the net pay value(/560 wage type)
Reward points if helpful.
Regards,
Manoj. -
Cannot View the Employee Salary Report in BI Publisher
Hi, everyone,
I have installed the Standalone version of bi publisher for windows (bipublisher_windows_x86_101341).
I have logged in as administrator, I have connected to my oracle database 11g thru jdbc succesfully. i cannot view the Employee Salary report. It gives me the error
Paramter name: dept Io exception: Invalid number format for port number.
The sample schemas are also installed on my database.
Could anyone guide me as i am very new to bi publisher.
Thanks in advance....Hi Can you please let me know what did you do to fix this issue. I am having same issue. Thanks in advance.
-
Another Error Executing Database Query.
I am getting this error.
12:40:54.054 - Database Exception - in
C:\CFusionMX7\wwwroot\Author\dropdown2\EmployeeAddAction.cfm : line
26
Error Executing Database Query.
i have added extra fields in the mdb and added extra code to
the form page and the action page.
i am getting this error still.
this is how i broke it down.
If I run my 2 files EmployeeAddForm.cfm and
EmployeeAddAction.cfm
I get this error:
NOTE: if i take out the comments from the code and ignore the
new fields added to the db it works fine!!!!!
The web site you are accessing has experienced an unexpected
error.
Please contact the website administrator.
The following information is meant for the website developer
for debugging purposes.
Error Occurred While Processing Request
Error Executing Database Query.
[Macromedia][SequeLink JDBC Driver][ODBC
Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error in
INSERT INTO statement.
Resources:
Enable Robust Exception Information to provide greater detail
about the source of errors. In the Administrator, click Debugging
& Logging > Debugging Settings, and select the Robust
Exception Information option.
Check the ColdFusion documentation to verify that you are
using the correct syntax.
Search the Knowledge Base to find a solution to your problem.
Browser Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;
SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
Remote Address 127.0.0.1
Referrer
http://127.0.0.1:8500/Author/dropdown2/EmployeeAddForm.cfm
Date/Time 06-Jun-07 12:40 PM
NOTE: if i take out the comments from the code and ignore the
new fields added to the db it works fine!!!!!Try using '###CreateODBCDate(Form.DateOfBirth)###'. Access is
strange on
handling dates. It has a been a while since I have used
Access so it could
be as simple as wrapping it single quotes as well. I am
assuming the
"<!-----------" wasn't intended, but I could be wrong.
Bryan Ashcraft (remove brain to reply)
Web Application Developer
Wright Medical Technology, Inc.
Macromedia Certified Dreamweaver Developer
Adobe Community Expert (DW) ::
http://www.adobe.com/communities/experts/
"Coldfusionstudent" <[email protected]>
wrote in message
news:[email protected]...
>I am getting this error.
> 12:40:54.054 - Database Exception - in
>
C:\CFusionMX7\wwwroot\Author\dropdown2\EmployeeAddAction.cfm : line
26
> Error Executing Database Query.
>
> i have added extra fields in the mdb and added extra
code to the form page
> and
> the action page.
> i am getting this error still.
> this is how i broke it down.
>
> If I run my 2 files EmployeeAddForm.cfm and
EmployeeAddAction.cfm
> I get this error:
>
> The web site you are accessing has experienced an
unexpected error.
> Please contact the website administrator.
>
> The following information is meant for the website
developer for debugging
> purposes.
>
> Error Occurred While Processing Request
> Error Executing Database Query.
> [Macromedia][SequeLink JDBC Driver][ODBC
Socket][Microsoft][ODBC Microsoft
> Access Driver] Syntax error in INSERT INTO statement.
>
>
> Resources:
> Enable Robust Exception Information to provide greater
detail about the
> source
> of errors. In the Administrator, click Debugging &
Logging > Debugging
> Settings, and select the Robust Exception Information
option.
> Check the ColdFusion documentation to verify that you
are using the
> correct
> syntax.
> Search the Knowledge Base to find a solution to your
problem.
>
>
> Browser Mozilla/4.0 (compatible; MSIE 6.0; Windows NT
5.1; SV1; .NET CLR
> 1.1.4322; .NET CLR 2.0.50727)
> Remote Address 127.0.0.1
> Referrer
http://127.0.0.1:8500/Author/dropdown2/EmployeeAddForm.cfm
> Date/Time 06-Jun-07 12:40 PM
>
>
>
> EmployeeAddForm.cfm
>
> <cfquery name="GetCompanies"
> datasource="#Request.MainDSN#">
> SELECT
> CompanyID,
> CompanyName
> FROM
> Company
> ORDER BY
> CompanyName
> </cfquery>
>
> <html>
> <head>
> <title>ColdFusion MX Bible</title>
> <link rel="stylesheet" href="styles.css">
> </head>
>
> <body>
>
> <h1> </h1>
>
> <table>
> <cfform action="EmployeeAddAction.cfm"
method="POST">
>
> <tr>
> <td>Company</td>
> <td>
> <cfselect name="CompanyID"
> size="1"
> query="GetCompanies"
> value="CompanyID"
> display="CompanyName"
> required="Yes"
> message="Please select a Company."></cfselect>
> </td>
> </tr>
>
> <tr>
> <td>SSN</td>
> <td>
> <cfinput type="Text"
> name="SSN"
> message="Please enter the employee's Social Security
Number."
> validate="social_security_number"
> required="Yes"
> size="12"
> maxlength="11">
> </td>
> </tr>
>
> <tr>
> <td>First Name</td>
> <td>
> <cfinput type="Text"
> name="Firstname"
> message="Please enter the employee's first name."
> required="Yes"
> size="22"
> maxlength="20">
> </td>
> </tr>
>
> <tr>
> <td>Last Name</td>
> <td>
> <cfinput type="Text"
> name="Lastname"
> message="Please enter the employee's last name."
> required="Yes"
> size="22"
> maxlength="20">
> </td>
> </tr>
>
> <tr>
> <td>Salary</td>
> <td>
> <cfinput type="Text"
> name="Salary"
> message="Please enter a valid salary."
> validate="float"
> required="Yes"
> size="22"
> maxlength="20">
> </td>
> </tr>
>
> <tr>
> <td>DOB</td>
> <td>
> <cfinput type="Text"
> name="DateOfBirth"
> message="Please enter a valid date of birth in the
format mm/dd/yyyy"
> validate="date"
> required="Yes"
> size="11"
> maxlength="10">
> </td>
> </tr><!-------------
> <tr>
> <td>device_typ</td>
> <td>
> <cfinput type="Text"
> name="device_typ"
> message="Please enter the employee's device_typ."
> required="Yes"
> size="22"
> maxlength="20">
> </td>
> </tr><tr>
> <td>device_Email</td>
> <td>
> <cfinput type="Text"
> name="device_Email"
> message="Please enter the employee's device_Email."
> required="Yes"
> size="22"
> maxlength="20">
> </td>
> </tr><tr>
> <td>Work_email</td>
> <td>
> <cfinput type="Text"
> name="Work_email"
> message="Please enter the employee's Work_email."
> required="Yes"
> size="22"
> maxlength="20">
> </td>
> </tr><tr>
> <td>Pin_Number</td>
> <td>
> <cfinput type="Text"
> name="Pin_Number"
> message="Please enter the employee's Pin_Number."
> required="Yes"
> size="22"
> maxlength="20">
> </td>
> </tr>------------------>
> <tr>
> <td> </td>
> <td>
> <input type="submit" value="Add to Database">
> </td>
> </tr>
>
> </cfform>
> </table>
>
> </body>
> </html>
> ---------------------------
> EmployeeAddAction.cfm
>
> <cfquery name="InsertEmployee"
> datasource="#Request.MainDSN#">
> INSERT INTO Employee(
> SSN,
> CompanyID,
> Firstname,
> Lastname,
> Salary,
> DateOfBirth<!----------,
> device_typ,
> device_Email,
> Work_email,
> Pin_Number-------------->
>
> )
> VALUES (
> '#Trim(Form.SSN)#',
> #Val(Form.CompanyID)#,
> '#Trim(Form.Firstname)#',
> '#Trim(Form.Lastname)#',
> #Val(Form.Salary)#,
> #CreateODBCDate(Form.DateOfBirth)#<!-----------,
> '#Trim(Form.device_typ)#',
> '#Trim(Form.device_Email)#',
> '#Trim(Form.Work_email)#',
> '#Trim(Form.Pin_Number)#'------------------>
> )
> </cfquery>
>
> <cfmail
to="#Form.Firstname#.#Form.Lastname#@somewhere.com"
> from="[email protected]"
> subject="Welcome to your new company!">
> Welcome to your new company, #Form.Firstname#
#Form.Lastname#!
> </cfmail>
> <!----
> <cflocation url="EmployeeList.cfm">----->
> -
Saving data in database using textbox and save button
Hello. I just want a help about my code because when i close the application the data that i add is not been saved.
Here is my code of save:
function saveData(event:MouseEvent):void
status.text = "Saving data";
insertStmt = new SQLStatement();
insertStmt.sqlConnection = conn;
var sql:String = "INSERT INTO employees (firstName, lastName, salary) VALUES (:param, :param1, :param2)";
insertStmt.text = sql;
insertStmt.parameters[":param"] = firstName.text;
insertStmt.parameters[":param1"] = lastName.text;
insertStmt.parameters[":param2"] = salary.text;
insertStmt.addEventListener(SQLEvent.RESULT, insertResult);
insertStmt.addEventListener(SQLErrorEvent.ERROR, insertError);
insertStmt.execute();
Here is the full code:
import fl.data.DataProvider;
import flash.data.SQLResult;
import flash.data.SQLConnection;
import flash.filesystem.File;
import flash.data.SQLStatement;
import flash.data.SQLConnection;
var conn:SQLConnection;
var createStmt:SQLStatement;
var insertStmt:SQLStatement;
var insertStmt2:SQLStatement;
var insertStmt3:SQLStatement;
var selectStmt:SQLStatement;
var insert1Complete:Boolean = false;
var insert2Complete:Boolean = false;
saveBtn.addEventListener(MouseEvent.CLICK, saveData);
loadBtn.addEventListener(MouseEvent.CLICK, getData);
init();
function init():void
conn = new SQLConnection();
conn.addEventListener(SQLEvent.OPEN, openSuccess);
conn.addEventListener(SQLErrorEvent.ERROR, openFailure);
status.text = "Creating and opening database";
// Use these two lines for an on-disk database
// but be aware that the second time you run the app you'll get errors from
// creating duplicate records.
// var dbFile:File = File.applicationStorageDirectory.resolvePath("DBSample.db");
// conn.openAsync(dbFile);
// Use this line for an in-memory database
conn.openAsync(null);
function openSuccess(event:SQLEvent):void
conn.removeEventListener(SQLEvent.OPEN, openSuccess);
conn.removeEventListener(SQLErrorEvent.ERROR, openFailure);
createTable();
function openFailure(event:SQLErrorEvent):void
conn.removeEventListener(SQLEvent.OPEN, openSuccess);
conn.removeEventListener(SQLErrorEvent.ERROR, openFailure);
status.text = "Error opening database";
trace("event.error.message:", event.error.message);
trace("event.error.details:", event.error.details);
function createTable():void
status.text = "Creating table";
createStmt = new SQLStatement();
createStmt.sqlConnection = conn;
var sql:String = "";
sql += "CREATE TABLE IF NOT EXISTS employees (";
sql += " empId INTEGER PRIMARY KEY AUTOINCREMENT,";
sql += " firstName TEXT,";
sql += " lastName TEXT,";
sql += " salary NUMERIC CHECK (salary >= 0) DEFAULT 0";
sql += ")";
createStmt.text = sql;
createStmt.addEventListener(SQLEvent.RESULT, createResult);
createStmt.addEventListener(SQLErrorEvent.ERROR, createError);
createStmt.execute();
function createResult(event:SQLEvent):void
createStmt.removeEventListener(SQLEvent.RESULT, createResult);
createStmt.removeEventListener(SQLErrorEvent.ERROR, createError);
addData();
function createError(event:SQLErrorEvent):void
status.text = "Error creating table";
createStmt.removeEventListener(SQLEvent.RESULT, createResult);
createStmt.removeEventListener(SQLErrorEvent.ERROR, createError);
trace("CREATE TABLE error:", event.error);
trace("event.error.message:", event.error.message);
trace("event.error.details:", event.error.details);
function addData():void
status.text = "Adding data to table";
insertStmt = new SQLStatement();
insertStmt.sqlConnection = conn;
var sql:String = "";
sql += "INSERT INTO employees (firstName, lastName, salary) ";
sql += "VALUES ('Bob', 'Smith', 8000)";
insertStmt.text = sql;
insertStmt.addEventListener(SQLEvent.RESULT, insertResult);
insertStmt.addEventListener(SQLErrorEvent.ERROR, insertError);
insertStmt.execute();
insertStmt2 = new SQLStatement();
insertStmt2.sqlConnection = conn;
var sql2:String = "";
sql2 += "INSERT INTO employees (firstName, lastName, salary) ";
sql2 += "VALUES ('John', 'Jones', 8200)";
insertStmt2.text = sql2;
insertStmt2.addEventListener(SQLEvent.RESULT, insertResult);
insertStmt2.addEventListener(SQLErrorEvent.ERROR, insertError);
insertStmt2.execute();
function insertResult(event:SQLEvent):void
var stmt:SQLStatement = event.target as SQLStatement;
stmt.removeEventListener(SQLEvent.RESULT, insertResult);
stmt.removeEventListener(SQLErrorEvent.ERROR, insertError);
if (stmt == insertStmt)
insert1Complete = true;
else
insert2Complete = true;
if (insert1Complete && insert2Complete)
status.text = "Ready to load data";
function insertError(event:SQLErrorEvent):void
status.text = "Error inserting data";
insertStmt.removeEventListener(SQLEvent.RESULT, insertResult);
insertStmt.removeEventListener(SQLErrorEvent.ERROR, insertError);
trace("INSERT error:", event.error);
trace("event.error.message:", event.error.message);
trace("event.error.details:", event.error.details);
function getData(event:MouseEvent):void
status.text = "Loading data";
selectStmt = new SQLStatement();
selectStmt.sqlConnection = conn;
var sql:String = "SELECT empId, firstName, lastName, salary FROM employees";
selectStmt.text = sql;
selectStmt.addEventListener(SQLEvent.RESULT, selectResult);
selectStmt.addEventListener(SQLErrorEvent.ERROR, selectError);
selectStmt.execute();
function saveData(event:MouseEvent):void
status.text = "Saving data";
insertStmt = new SQLStatement();
insertStmt.sqlConnection = conn;
var sql:String = "INSERT INTO employees (firstName, lastName, salary) VALUES (:param, :param1, :param2)";
insertStmt.text = sql;
insertStmt.parameters[":param"] = firstName.text;
insertStmt.parameters[":param1"] = lastName.text;
insertStmt.parameters[":param2"] = salary.text;
insertStmt.addEventListener(SQLEvent.RESULT, insertResult);
insertStmt.addEventListener(SQLErrorEvent.ERROR, insertError);
insertStmt.execute();
function selectResult(event:SQLEvent):void
status.text = "Data loaded";
selectStmt.removeEventListener(SQLEvent.RESULT, selectResult);
selectStmt.removeEventListener(SQLErrorEvent.ERROR, selectError);
var result:SQLResult = selectStmt.getResult();
resultsGrid.dataProvider = new DataProvider(result.data);
// var numRows:int = result.data.length;
// for (var i:int = 0; i < numRows; i++)
// var output:String = "";
// for (var prop:String in result.data[i])
// output += prop + ": " + result.data[i][prop] + "; ";
// trace("row[" + i.toString() + "]\t", output);
function selectError(event:SQLErrorEvent):void
status.text = "Error loading data";
selectStmt.removeEventListener(SQLEvent.RESULT, selectResult);
selectStmt.removeEventListener(SQLErrorEvent.ERROR, selectError);
trace("SELECT error:", event.error);
trace("event.error.message:", event.error.message);
trace("event.error.details:", event.error.details);Your database system may well have a setting for character encoding when creating new databases. If you set that to unicode JDBC should store and retrieve UNICODE strings automatically.
As to the HTML side, you should generally use UTF-8 encoding. You need an editor which understands UTF-8. JSPs and servlets have ways of specifying the encoding which goes into the http headers. For static HTML pages you may have to add a header like:
<META http-equiv="Content-type" value="text/HTML; charset=UTF-8">
When receiving form data you need to do
request.setCharacterEncoding("UTF-8"); -
Use of sql group function in orcl:query-database - urgent
All,
Version: 10.1.3.4
Two requirements for me:
1. I want to use sum function in orcl:query-database. How to use it?
For ex: I tried the following
<xsl:value-of select='orcl:query-database("select sum(salary) from emp",false(),false(),"jdbc/DB1")'/>
I got the following error
oracle.xml.sql.OracleXMLSQLException: Character ')' is not allowed in an XML tag name.
When I tried without sum function, it works fine
2. I used the same table, but without the sum function as below
<xsl:value-of select='orcl:query-database("select salary from emp",false(),false(),"jdbc/DB1")'/>
This time, it returns the first employees salary!! I dont understand this logic. I expected either the query returns all the rows else it throws error, but none of them were true!
Can anyone pls explain what is the behavior? I want your reply for both the queries!
Currently I'm in a project where I'm working in the similar scenario, so please guru's let me know ASAP.
Thanks,
SenHi Sen,
Create a normal variable variable in XSLT.
Then use that variable.
I mean variable name='Var_1' select='Your Query'
Now use Var_1/yourcollection/...
I am giving some example
<xsl:variable name="Stopdetails" select="/ns0:MyEBM/ns0:DataArea/ns0:MyEBO/ns0:Stops/ns0:Stop[ns0:StopID=$TempStopId]"/>
<xsl:variable name="AccStopTypeVar">
<xsl:value-of select="$Stopdetails/ns0:StopType"/>
</xsl:variable>If you want you can loop on the created variable.
You can do these in XSL.
But DB calls those things ...it would be better , if u take them out. Spme debugging problems are there with XSL.
Regards
PavanKumar.M -
How to use dynamic database item in Fast formula
Dear All
How to use Element Pay value in Fast Formula
Element Name: Transport_Allowance
Input Values : Name Units User Enterable Database Item
Pay Value Money No Yes
Amount Money Yes Yes
Balance Feeds : Value Name Balance Name Units
Pay Value Transportation Amount Money
Formula
DEFAULT FOR ASG_SALARY IS 0
DEFAULT FOR TRANSPORTATION_AMOUNT_ASG_RUN IS 0
ALIAS ASG_SALARY AS Emp_Salary
ALIAS TRANSPORTATION_AMOUNT_ASG_RUN AS Emp_Trans_Amt
V_CALCULATED_SALARY = Emp_Salary + Emp_Trans_Amt
RETURN V_CALCULATED_SALARY
Using the above formula, I got only Basic Salary only
How to get the Basic Salary + Transportation allowance in the return value
Please help me..
Thanks in advancePlease check whether the priority of the element with which the fast formula is attached has a priority higher than the Transport_Allowance. If not then cahange the priority of the element to a prriority higher than Transport_Allowance.
HTH -
Someone please help me Design the database of bill of materials with 1 item can have mutiple parent
I got this sample from Uri
Dimant (MCC, MVP) ,
The problem is i want 1 item to have multiple parent but this example don t let 1 item to have multiple parents. this is not suit for my objective.
CREATE TABLE Employees
empid int NOT NULL,
mgrid int NULL,
empname varchar(25) NOT NULL,
salary money NOT NULL,
CONSTRAINT PK_Employees PRIMARY KEY(empid),
CONSTRAINT FK_Employees_mgrid_empid
FOREIGN KEY(mgrid)
REFERENCES Employees(empid)
CREATE INDEX idx_nci_mgrid ON Employees(mgrid)
SET NOCOUNT ON
INSERT INTO Employees VALUES(1 , NULL, 'Nancy' , $10000.00)
INSERT INTO Employees VALUES(2 , 1 , 'Andrew' , $5000.00)
INSERT INTO Employees VALUES(3 , 1 , 'Janet' , $5000.00)
INSERT INTO Employees VALUES(4 , 1 , 'Margaret', $5000.00)
INSERT INTO Employees VALUES(5 , 2 , 'Steven' , $2500.00)
INSERT INTO Employees VALUES(6 , 2 , 'Michael' , $2500.00)
INSERT INTO Employees VALUES(7 , 3 , 'Robert' , $2500.00)
INSERT INTO Employees VALUES(8 , 3 , 'Laura' , $2500.00)
INSERT INTO Employees VALUES(9 , 3 , 'Ann' , $2500.00)
INSERT INTO Employees VALUES(10, 4 , 'Ina' , $2500.00)
INSERT INTO Employees VALUES(11, 7 , 'David' , $2000.00)
INSERT INTO Employees VALUES(12, 7 , 'Ron' , $2000.00)
INSERT INTO Employees VALUES(13, 7 , 'Dan' , $2000.00)
INSERT INTO Employees VALUES(14, 11 , 'James' , $1500.00)
WITH EmpCTE(empid, empname, mgrid, lvl)
AS
-- Anchor Member (AM)
SELECT empid, empname, mgrid, 0
FROM Employees
WHERE empid = 1
UNION ALL
-- Recursive Member (RM)
SELECT E.empid, E.empname, E.mgrid, M.lvl+1
FROM Employees AS E
JOIN EmpCTE AS M
ON E.mgrid = M.empid
SELECT * FROM EmpCTE
My object is
I want to design the database of bill of materials which contain item and amount.
So the amount of child will depend on amount of parent in term of ratio. For example
A(1) A(2)
| ----> |
B(2) B(4)
My problem is when i try to add the parent and child . Let A is the parent of B , If i try to add A to be the child of C
I want B to come along with A as well. For example
A C
| C ---> | For this I have to store the relation of all item in my list to check that this item have a child or not if yes
B
A The child must come along with its parent , What the Er-diagram should be for all of my requirement?
|
B
Base on the example that Uri
Dimant gave me , i have to stroe 1 item wtih multi parents for example if b is a child of a And b have c as child , When i insert D as a parent of B , c will automatic come along with B , But this not seem gonna work.
item Parent
A NULL
B A
C B
B D
Am i wrong to go this way , any ideathanks Uri
Dimant
I am
little confuse about how can i write
hierarchy sql from this relation , Thanks
so far i got
WITH EmpCTE(cid, cname, pid, lvl)
AS
SELECT cid , cname , children.pid , 0
FROM children INNER JOIN
parents ON children.pid = parents.pid
where cid = 1
UNION ALL
SELECT E.cid , E.cname , E.pid , M.lvl+1
FROM ( select cid , cname , children.pid FROM children INNER JOIN
parents ON children.pid = parents.pid) AS E JOIN EmpCTE AS M
ON E.pid = M.cid
SELECT * FROM EmpCTE -
Urgent help with simple BPEL process for reading data from database
Hello there,
I need help with BPEL project.
i have created a table Employee in Database.
I did create application, BPEL project and connection to the database properly using Database Adapter.
I need to read the records from the database and convert into xml fomat and it should to go approval for BPM worklist.
Can someone please describe me step by step what i need to do.
Thx,
DpsI have created a table in Database with data like Empno,name,salary,comments.
I created Database Connection in jsp page and connecting to BPEL process.
It initiates the process and it goes automatically for approval.
Please refer the code once which i created.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.util.Map" %>
<%@page import="com.oracle.bpel.client.Locator" %>
<%@page import="com.oracle.bpel.client.NormalizedMessage" %>
<%@page import="com.oracle.bpel.client.delivery.IDeliveryService" %>
<%@page import="javax.naming.Context" %>
<%@page import="java.util.Hashtable" %>
<%@page import="java.util.HashMap" %>
<%@ page import="java.sql.*"%>
<%@ page import= "jspprj.DBCon"%>
<html>
<head>
<title>Invoke CreditRatingService</title>
</head>
<body>
<%
DBCon dbcon=new DBCon();
Connection conn=dbcon.createConnection();
Statement st=null;
PreparedStatement pstmt=null;
Hashtable env= new Hashtable();
ResultSet rs = null;
Map payload =null;
try
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
env.put(Context.PROVIDER_URL, "opmn:ormi://localhost:port:home/orabpel");//bpel server
env.put("java.naming.security.principal", "username");
env.put("java.naming.security.credentials", "password");//bpel console
Locator locator = new Locator("default","password",env);
IDeliveryService deliveryService =
(IDeliveryService)locator.lookupService(IDeliveryService.SERVICE_NAME );
// construct the normalized message and send to Oracle BPEL Process Manager
NormalizedMessage nm = new NormalizedMessage();
java.util.HashMap map = new HashMap();
st=conn.createStatement();
out.println("connected");
String query1="Select * from EMPLOYEE";
rs=st.executeQuery(query1);
/*reading Data From Database and converting into XML format
so that no need of going to BPEL console and entering the details.
while (rs.next()){
String xml1 = "<AsynchBPELProcess1ProcessRequest xmlns='http://xmlns.oracle.com/AsynchBPELProcess1'>"+
"<Empno>"+rs.getString(1)+"</Empno>"+
"<EmpName>"+rs.getString(2)+"</EmpName>"+
"<Salary>"+rs.getString(3)+"</Salary>"+
"<Comments>"+rs.getString(4)+"</Comments>"+
"</AsynchBPELProcess1ProcessRequest>";
out.println(xml1);
nm.addPart("payload", xml1 );
// EmployeeApprovalProcess is the BPEL process in which human task is implemented
deliveryService.post("EmployeeApprovalProcess", "initiate", nm);
// payload = res.getPayload();
out.println( "BPELProcess CreditRatingService executed!<br>" );
// out.println( "Credit Rating is " + payload.get("payload") );
//Incase there is an exception while invoking the first server invoke the second server i.e lsgpas13.
catch(Exception ee) {
//("BPEL Server lsgpas14 invoking error.\n"+ee.toString());
%>
</body>
</html>
Its working fine.And i want it for Bulk approvals.please help me step by step procedure if any other way to implement this. -
Problem in accessing database using a java class
Hy Folks,
I have written a class to retrive data from data base and compiled it.when I said java QueryExample, I am getting the following error message.It is as below.
E:\>java QueryExample
Loading JDBC Driver -> oracle.jdbc.driver.OracleDriver
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:120)
at QueryExample.<init>(QueryExample.java:37)
at QueryExample.main(QueryExample.java:129)
Creating Statement...
Exception in thread "main" java.lang.NullPointerException
at QueryExample.performQuery(QueryExample.java:70)
at QueryExample.main(QueryExample.java:130)
Now my question is can I run a jdbc program with out using any application server or webserver.
If I can , what are all the packeages I have to down load, and how to set their classpath.
Regards,
Olive.My basic doubght is can we write a class like this.Here I give the sample code that I am using,,,, and using Oracle9i for Windows release 2 (9.2) .
// QueryExample.java
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.SQLException;
* The following class provides an example of using JDBC to perform a simple
* query from an Oracle database.
public class QueryExample {
final static String driverClass = "oracle.jdbc.driver.OracleDriver";
final static String connectionURL = "jdbc:oracle:thin:@localhost:1521:O920NT";
final static String userID = "scott";
final static String userPassword = "tiger";
Connection con = null;
* Construct a QueryExample object. This constructor will create an Oracle
* database connection.
public QueryExample() {
try {
System.out.print(" Loading JDBC Driver -> " + driverClass + "\n");
Class.forName(driverClass).newInstance();
System.out.print(" Connecting to -> " + connectionURL + "\n");
this.con = DriverManager.getConnection(connectionURL, userID, userPassword);
System.out.print(" Connected as -> " + userID + "\n");
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
* Method to perform a simply query from the "emp" table.
public void performQuery() {
Statement stmt = null;
ResultSet rset = null;
String queryString = "SELECT name, date_of_hire, monthly_salary " +
"FROM emp " +
"ORDER BY name";
try {
System.out.print(" Creating Statement...\n");
stmt = con.createStatement ();
System.out.print(" Opening ResultsSet...\n");
rset = stmt.executeQuery(queryString);
int counter = 0;
while (rset.next()) {
System.out.println();
System.out.println(" Row [" + ++counter + "]");
System.out.println(" ---------------------");
System.out.println(" Name -> " + rset.getString(1));
System.out.println(" Date of Hire -> " + rset.getString(2));
System.out.println(" Monthly Salary -> " + rset.getFloat(3));
System.out.println();
System.out.print(" Closing ResultSet...\n");
rset.close();
System.out.print(" Closing Statement...\n");
stmt.close();
} catch (SQLException e) {
e.printStackTrace();
* Close down Oracle connection.
public void closeConnection() {
try {
System.out.print(" Closing Connection...\n");
con.close();
} catch (SQLException e) {
e.printStackTrace();
* Sole entry point to the class and application.
* @param args Array of String arguments.
* @exception java.lang.InterruptedException
* Thrown from the Thread class.
public static void main(String[] args)
throws java.lang.InterruptedException {
QueryExample qe = new QueryExample();
qe.performQuery();
qe.closeConnection();
}
Maybe you are looking for
-
Redo log backup to disk is failed
Hi, My Archive log backup to disk is failed BR0002I BRARCHIVE 7.00 (13) BR0006I Start of offline redo log processing: aeamsbyx.svd 2009-05-04 15.15.07
-
Dynamic fxml "source" in fx:include
Is it possible to have a dynamic source in the <fx:include> ? Setting a controller for this source can be achieved by using controller factories. <VBox prefHeight="412.0" prefWidth="352.0" xmlns:fx="http://javafx.com/fxml" fx:controller="fxminclude.P
-
What are the best settings for Adobe Media Ecoder?
Hello, I have this animation done in AE and woild like to export it as GIF but when using Encoder I get an animated GIF file that is just way to heavy. I've tried a few different settings but actually just made it worst. I also tried opening the vid
-
Video in an "unrecognized format"
I recorded my kids opening gifts this morning and it was about a 2.5 gig video. It plays back on the phone fine, but when I try to import it through iPhoto, it says it can't import because it's in an unrecognized format. I've also tried image capture
-
i have forgotten my users account password.iam not able to change any thing without the password