Need classes for database
hai there......
I have a peculiar problem. I'm in java project using oracle backend. i'm using TOAD for Oracle. I want a java program to compare oracle schema and list the difference. Eventhoufg this facility available in TOAD, for some reason i don't want to use it. Are there any third party packages or classas using which we can compare two DataBase schemas, tables etc. Using JDBC concept?
If not so, tell me how to interact with oracle database in schema level....
awaiting ur response....
By "compare," if you mean "produce a report," I don't know if it will do it. But if you mean "examine" so that you can do the comparison yourself, then check out DbVisualizer at www.minq.se.
I don't know if it will necessarily have all the metadata you're looking for, but I know it provides a fair amount.
There's a free version and a pay version (around 30-50 USD when I bought it a few years ago). I don't recall which features are absent from the free version.
Similar Messages
-
Needed classes for sap connector framework
Hello,
when i installed sap netweaver developer studio 2.0.5 i become all needed classes for sap connector framework?
Or i have to install the pdk? What are in the pdk for developer studio because the needed wizards are there (portal, sap connector ...)
Thanks,
FrankTorben, try to use class finder plugin as described here /people/maksim.rashchynski/blog/2006/08/14/the-story-about-how-2-eclipse-plugins-helped-me-to-make-a-lot-of-points-on-sdn-forum
To save you some time:
C:\usr\sap\J2E\JC00\j2ee\cluster\server0\bin\ext\tcconnconnectorframework\*.jar
C:\usr\sap\J2E\JC00\j2ee\cluster\server0\apps\sap.com\com.sapportals.connectors.sap\connector\connectors\SAPCFConnector.rar\SAPCFConnector.jar -
Need link for database performance monitoring tool
Hi,
Can anybody give link to a download free database performance monitoring tool.
Thanksi am using oracle 10.1.0
and any link which can told what thing need to check
to make sure good performance.
Thanks
Message was edited by:
Umesh Sharma -
Need help for database creation
Hi all
i am new to oracle and in learning stage.
Date: 01-Jan-2006 shift: Morning/noon/night
alert name resolved escalated
cpu 4 0
disk 2 0
memory 1 0
i want to store all these values into database. any help please....
thanksi will be getting a file like this each day.
Date: 01-Jan-2006
shift: Morning/noon/night
alert name resolved escalated
cpu 4 0
disk 2 0
memory 1 0
at present i am storing on excel sheet. but now i want to store it in a database. I created just two tables but i don't know whether they are correct or not
resolved_tab
alert_date_res date,
alert_shift_res varchar2(10),
alert_cpu_res number(10),
alert_disk_res number(10),
alert_memory_res number(10)
same way i created eslalated_tab with _esc as extension to all fields. is it corret approach what i am following? -
Need to create a driver class for a program i have made...
hey guys im new to these forums and someone told me that i could get help on here if i get in a bind...my problem is that i need help creating a driver class for a program that i have created and i dont know what to do. i need to know how to do this is because my professor told us after i was 2/3 done my project that we need at least 2 class files for our project, so i need at least 2 class files for it to run... my program is as follows:
p.s might be kinda messy, might need to put it into a text editor
Cipher.java
This program encodes and decodes text strings using a cipher that
can be specified by the user.
import java.io.*;
public class Cipher
public static void printID()
// output program ID
System.out.println ("*********************");
System.out.println ("* Cipher *");
System.out.println ("* *");
System.out.println ("* *");
System.out.println ("* *");
System.out.println ("* CS 181-03 *");
System.out.println ("*********************");
public static void printMenu()
// output menu
System.out.println("\n\n****************************" +
"\n* 1. Set cipher code. *" +
"\n* 2. Encode text. *" +
"\n* 3. Decode coded text. *" +
"\n* 4. Exit the program *" +
"\n****************************");
public static String getText(BufferedReader input, String prompt)
throws IOException
// prompt the user and get their response
System.out.print(prompt);
return input.readLine();
public static int getInteger(BufferedReader input, String prompt)
throws IOException
// prompt and get response from user
String text = getText(input, prompt);
// convert it to an integer
return (new Integer(text).intValue());
public static String encode(String original, int offset)
// declare constants
final int ALPHABET_SIZE = 26; // used to wrap around A-Z
String encoded = ""; // base for string to return
char letter; // letter being processed
// convert message to upper case
original = original.toUpperCase();
// process each character of the message
for (int index = 0; index < original.length(); index++)
// get the letter and determine whether or not to
// add the cipher value
letter = original.charAt(index);
if (letter >='A' && letter <= 'Z')
// is A-Z, so add offset
// determine whether result will be out of A-Z range
if ((letter + offset) > 'Z') // need to wrap around to 'A'
letter = (char)(letter - ALPHABET_SIZE + offset);
else
if ((letter + offset) < 'A') // need to wrap around to 'Z'
letter = (char)(letter + ALPHABET_SIZE + offset);
else
letter = (char) (letter + offset);
// build encoded message string
encoded = encoded + letter;
return encoded;
public static String decode(String original, int offset)
// declare constants
final int ALPHABET_SIZE = 26; // used to wrap around A-Z
String decoded = ""; // base for string to return
char letter; // letter being processed
// make original message upper case
original = original.toUpperCase();
// process each letter of message
for (int index = 0; index < original.length(); index++)
// get letter and determine whether to subtract cipher value
letter = original.charAt(index);
if (letter >= 'A' && letter <= 'Z')
// is A-Z, so subtract cipher value
// determine whether result will be out of A-Z range
if ((letter - offset) < 'A') // wrap around to 'Z'
letter = (char)(letter + ALPHABET_SIZE - offset);
else
if ((letter - offset) > 'Z') // wrap around to 'A'
letter = (char)(letter - ALPHABET_SIZE - offset);
else
letter = (char) (letter - offset);
// build decoded message
decoded = decoded + letter;
return decoded;
// main controls flow throughout the program, presenting a
// menu of options the user.
public static void main (String[] args) throws IOException
// declare constants
final String PROMPT_CHOICE = "Enter your choice: ";
final String PROMPT_VALID = "\nYou must enter a number between 1" +
" and 4 to indicate your selection.\n";
final String PROMPT_CIPHER = "\nEnter the offset value for a caesar " +
"cipher: ";
final String PROMPT_ENCODE = "\nEnter the text to encode: ";
final String PROMPT_DECODE = "\nEnter the text to decode: ";
final String SET_STR = "1"; // selection of 1 at main menu
final String ENCODE_STR = "2"; // selection of 2 at main menu
final String DECODE_STR = "3"; // selection of 3 at main menu
final String EXIT_STR = "4"; // selection of 4 at main menu
final int SET = 1; // menu choice 1
final int ENCODE = 2; // menu choice 2
final int DECODE =3; // menu choice 4
final int EXIT = 4; // menu choice 3
final int ALPHABET_SIZE = 26; // number of elements in alphabet
// declare variables
boolean finished = false; // whether or not to exit program
String text; // input string read from keyboard
int choice; // menu choice selected
int offset = 0; // caesar cipher offset
// declare and instantiate input objects
InputStreamReader reader = new InputStreamReader(System.in);
BufferedReader input = new BufferedReader(reader);
// Display program identification
printID();
// until the user selects the exit option, display the menu
// and respond to the choice
do
// Display menu of options
printMenu();
// Prompt user for an option and read input
text = getText(input, PROMPT_CHOICE);
// While selection is not valid, prompt for correct info
while (!text.equals(SET_STR) && !text.equals(ENCODE_STR) &&
!text.equals(EXIT_STR) && !text.equals(DECODE_STR))
text = getText(input, PROMPT_VALID + PROMPT_CHOICE);
// convert choice to an integer
choice = new Integer(text).intValue();
// respond to the choice selected
switch(choice)
case SET:
// get the cipher value from the user and constrain to
// -25..0..25
offset = getInteger(input, PROMPT_CIPHER);
offset %= ALPHABET_SIZE;
break;
case ENCODE:
// get message to encode from user, and encode it using
// the current cipher value
text = getText(input, PROMPT_ENCODE);
text = encode(text, offset);
System.out.println("Encoded text is: " + text);
break;
case DECODE:
// get message to decode from user, and decode it using
// the current cipher value
text = getText(input, PROMPT_DECODE);
text = decode(text, offset);
System.out.println("Decoded text is: " + text);
break;
case EXIT:
// set exit flag to true
finished = true ;
break;
} // end of switch on choice
} while (!finished); // end of outer do loop
// Thank user
System.out.println("Thank you for using Cipher for all your" +
" code breaking and code making needs.");
}My source in code format...sorry guys :)
Cipher.java
This program encodes and decodes text strings using a cipher that
can be specified by the user.
import java.io.*;
public class Cipher
public static void printID()
// output program ID
System.out.println ("*********************");
System.out.println ("* Cipher *");
System.out.println ("* *");
System.out.println ("* *");
System.out.println ("* *");
System.out.println ("* CS 181-03 *");
System.out.println ("*********************");
public static void printMenu()
// output menu
System.out.println("\n\n****************************" +
"\n* 1. Set cipher code. *" +
"\n* 2. Encode text. *" +
"\n* 3. Decode coded text. *" +
"\n* 4. Exit the program *" +
"\n****************************");
public static String getText(BufferedReader input, String prompt)
throws IOException
// prompt the user and get their response
System.out.print(prompt);
return input.readLine();
public static int getInteger(BufferedReader input, String prompt)
throws IOException
// prompt and get response from user
String text = getText(input, prompt);
// convert it to an integer
return (new Integer(text).intValue());
public static String encode(String original, int offset)
// declare constants
final int ALPHABET_SIZE = 26; // used to wrap around A-Z
String encoded = ""; // base for string to return
char letter; // letter being processed
// convert message to upper case
original = original.toUpperCase();
// process each character of the message
for (int index = 0; index < original.length(); index++)
// get the letter and determine whether or not to
// add the cipher value
letter = original.charAt(index);
if (letter >='A' && letter <= 'Z')
// is A-Z, so add offset
// determine whether result will be out of A-Z range
if ((letter + offset) > 'Z') // need to wrap around to 'A'
letter = (char)(letter - ALPHABET_SIZE + offset);
else
if ((letter + offset) < 'A') // need to wrap around to 'Z'
letter = (char)(letter + ALPHABET_SIZE + offset);
else
letter = (char) (letter + offset);
// build encoded message string
encoded = encoded + letter;
return encoded;
public static String decode(String original, int offset)
// declare constants
final int ALPHABET_SIZE = 26; // used to wrap around A-Z
String decoded = ""; // base for string to return
char letter; // letter being processed
// make original message upper case
original = original.toUpperCase();
// process each letter of message
for (int index = 0; index < original.length(); index++)
// get letter and determine whether to subtract cipher value
letter = original.charAt(index);
if (letter >= 'A' && letter <= 'Z')
// is A-Z, so subtract cipher value
// determine whether result will be out of A-Z range
if ((letter - offset) < 'A') // wrap around to 'Z'
letter = (char)(letter + ALPHABET_SIZE - offset);
else
if ((letter - offset) > 'Z') // wrap around to 'A'
letter = (char)(letter - ALPHABET_SIZE - offset);
else
letter = (char) (letter - offset);
// build decoded message
decoded = decoded + letter;
return decoded;
// main controls flow throughout the program, presenting a
// menu of options the user.
public static void main (String[] args) throws IOException
// declare constants
final String PROMPT_CHOICE = "Enter your choice: ";
final String PROMPT_VALID = "\nYou must enter a number between 1" +
" and 4 to indicate your selection.\n";
final String PROMPT_CIPHER = "\nEnter the offset value for a caesar " +
"cipher: ";
final String PROMPT_ENCODE = "\nEnter the text to encode: ";
final String PROMPT_DECODE = "\nEnter the text to decode: ";
final String SET_STR = "1"; // selection of 1 at main menu
final String ENCODE_STR = "2"; // selection of 2 at main menu
final String DECODE_STR = "3"; // selection of 3 at main menu
final String EXIT_STR = "4"; // selection of 4 at main menu
final int SET = 1; // menu choice 1
final int ENCODE = 2; // menu choice 2
final int DECODE =3; // menu choice 4
final int EXIT = 4; // menu choice 3
final int ALPHABET_SIZE = 26; // number of elements in alphabet
// declare variables
boolean finished = false; // whether or not to exit program
String text; // input string read from keyboard
int choice; // menu choice selected
int offset = 0; // caesar cipher offset
// declare and instantiate input objects
InputStreamReader reader = new InputStreamReader(System.in);
BufferedReader input = new BufferedReader(reader);
// Display program identification
printID();
// until the user selects the exit option, display the menu
// and respond to the choice
do
// Display menu of options
printMenu();
// Prompt user for an option and read input
text = getText(input, PROMPT_CHOICE);
// While selection is not valid, prompt for correct info
while (!text.equals(SET_STR) && !text.equals(ENCODE_STR) &&
!text.equals(EXIT_STR) && !text.equals(DECODE_STR))
text = getText(input, PROMPT_VALID + PROMPT_CHOICE);
// convert choice to an integer
choice = new Integer(text).intValue();
// respond to the choice selected
switch(choice)
case SET:
// get the cipher value from the user and constrain to
// -25..0..25
offset = getInteger(input, PROMPT_CIPHER);
offset %= ALPHABET_SIZE;
break;
case ENCODE:
// get message to encode from user, and encode it using
// the current cipher value
text = getText(input, PROMPT_ENCODE);
text = encode(text, offset);
System.out.println("Encoded text is: " + text);
break;
case DECODE:
// get message to decode from user, and decode it using
// the current cipher value
text = getText(input, PROMPT_DECODE);
text = decode(text, offset);
System.out.println("Decoded text is: " + text);
break;
case EXIT:
// set exit flag to true
finished = true ;
break;
} // end of switch on choice
} while (!finished); // end of outer do loop
// Thank user
System.out.println("Thank you for using Cipher for all your" +
" code breaking and code making needs.");
} -
Need help for importing oracle 10G dump into 9i database
hi, Someone help me to import oracle 10G dump into 9i database. I'm studying oracle . Im using oracle 10G developer suite(downloaded from oracle) and oracle 9i database. I saw some threads tat we can't import the higher version dumps into lower version database. But i'm badly need help for importing the dump...
or
someone please tell me the site to download oracle 9i Developer suite as i can't find it in oracle site...I didnt testet it to import a dump out of a 10g instance into a 9i instance if this export has been done using a 10g environment.
But it is possible to perform an export with a 9i environment against a 10g instance.
I am just testing this with a 9.2.0.8 environment against a 10.2.0.4.0 instance and is working so far.
The system raises an EXP-00008 / ORA-37002 error after exporting the data segments (exporting post-schema procedural objects and actions).
I am not sure if it is possible to perform an import to a 9i instance with this dump but maybe worth to give it a try.
It should potentially be possible to export at least 9i compatible objects/segments with this approach.
However, I have my doubts if this stunt is supported by oracle ...
Message was edited by:
user434854 -
Need some tips for Database Developer Role.
Dear All,
Next week, I'm going to face an Interview for Database Developer role.
For this, I need some more & useful information on these recommended points.
1. Involve in a designing part of Data warehouse from
scratch
2. Create complex analytic queries on large data sets.
3. Analyse trends in key metrics.
4. Monitoring and optimizing the performance of the database.
Please help get the vital information on these points.
All help will be highly appreciated.
Thanks,1. Involve in a designing part of Data warehouse from
scratch
Design Database...
This needs lot of information about business and its fonctionnalités, and so many.. Tables, relationships etc...
http://technet.microsoft.com/en-us/library/ms187099%28v=sql.105%29.aspx
Code Design...
SP's, Funcitions, Views, Sub queries, Joins, Triggers etc...
DW Design
DB size and number of reports and historical data details, reduce the normalization and etc....
http://technet.microsoft.com/en-us/library/aa902672%28v=sql.80%29.aspx
2. Create complex analytic queries on large data sets.
Its all based on your current database design, size, required output, data, performance etc..
4. Monitoring and optimizing the performance of the database.
Perfmon, Activity monitor, spotlight, custom queries, DMV's sp_whoisactive, execution plans, and many other thirdparty tools.. and may be best experience will give best view and clarity :)
Note : This is very big topic and its not easy to answer in few words or lines... :) goole it for more details...
Raju Rasagounder Sr MSSQL DBA -
Revision: 21285
Revision: 21285
Author: [email protected]
Date: 2011-05-20 07:53:23 -0700 (Fri, 20 May 2011)
Log Message:
Need to change _parent, privateCall and instance properties from private to protected in order to extend this class for another project
Modified Paths:
blazeds/trunk/apps/ds-console/console/ConsoleManager.asRevision: 21285
Revision: 21285
Author: [email protected]
Date: 2011-05-20 07:53:23 -0700 (Fri, 20 May 2011)
Log Message:
Need to change _parent, privateCall and instance properties from private to protected in order to extend this class for another project
Modified Paths:
blazeds/trunk/apps/ds-console/console/ConsoleManager.as -
Grid computing will diminish need for database administrators?
from what i understand, grid computing will eventually turn database services into a "utility" where everyone uses the service on an as needed basis from a central area. how is this going to affect the need for database administrators? won't demand greatly decrease since companies will be getting their database needs from somewhere else and will no longer have a need for a database internal to the company?
Wrong. It just makes the DBA more productive. It allows for a company to pool their resources to run more databases. For eg. an analyst wants to run a report on a special version (a snapshot) of the production db; the DBA would not have to scrounge around for hardware and storage to instantiate the db for the analyst. Instead, the DBA would snap a tablespace, mount the tablespace for the analyst db all within the same grid and using the same resources.
-
Do I need to Create Primary Key Class for Entity beans with Local interface
Do I need to Create Primary Key Class for Entity beans with Local interface?
I have created my entity bean with the wizard in Sun One Studio and it does not create a primary key class for you.
I thought that the primary key class was required. My key is made up of only one field.
Anyone know the answer.
Jimu dont need to create a primary key class for a entity bean.if ur table's primary key feild(int ,float) is a built in or primitive data type,then u dont need one.But if ur table has a primary key field which is non primitive (for example StudentID,ItemID etc)then u have to create a primary key class.
hope this helps :-) -
Simple java class for SQL like table?
Dear Experts,
I'm hoping that the java people here at the Oracle forums will be able to help me.
I've worked with Oracle and SQL since the 90s.
Lately, I'm learning java and doing a little project in my spare time.
It's stand alone on the desktop.
The program does not connect to any database
(and a database is not an option).
Currently, I'm working on a module for AI and decision making.
I like the idea of a table in memory.
Table/data structure with Row and columns.
And the functionality of:
Select, insert, update, delete.
I've been looking at the AbstractTableModel.
Some of the best examples I've found online (they actually compile and work) are:
http://www.java2s.com/Code/Java/Swing-JFC/extendsAbstractTableModeltocreatecustommodel.htm
http://tutiez.com/simple-jtable-example-using-abstracttablemodel.html
Although they are rather confusing.
In all the examples I find, there always seems to be
at least three layers of objects:
Data object (full of get/set methods)
AbstractTableModel
GUI (JFrame, JTable) (GUI aspect I don't need or want)
In all the cases I've seen online, I have yet to see an example
that has the equivalent of Delete or Insert.
Just like in SQL, I want to define a table with columns.
Insert some rows. Update. Select. Delete.
Question:
Is there a better java class to work with?
Better, in terms of simpler.
And, being able to do all the basic SQL like functions.
Thanks a lot!Hi Timo,
Thanks. yes I had gone thru the java doc already and they have mentioned to use java.sql.Struct, but the code which got generated calls constructor of oracle.jpub.runtime.MutableStruct where it expects oracle.sql.STRUCT and not the java.sql.STRUCT and no other constructor available to call the new implementation and that is the reason i sought for some clues.
protected ORAData create(CmnAxnRecT o, Datum d, int sqlType) throws SQLException
if (d == null) return null;
if (o == null) o = new CmnAxnRecT();
o._struct = new MutableStruct((STRUCT) d, _sqlType, _factory);
return o;
here CmnAxnRecT is the class name of the generated java class for sqlType.
Thanks again. Please let me know if you have any more clues.
Regards,
Vinothgan AS -
Connection Factory class for Distributed Transaction?
Definition of Managed Datasources goes like this at URL: http://download.oracle.com/docs/cd/B31017_01/web.1013/b28958/datasrc.htm#CHDDADCE
Managed data sources are managed by OC4J. This means that OC4J provides critical system infrastructure such as global transaction management, connection pooling, and error handling.
In the same document, I could also see a section for configuring Connection Pool, that uses 'factory-class' as 'oracle.jdbc.pool.OracleDataSource' as shown below:
<connection-pool name="myConnectionPool">
<connection-factory
factory-class="oracle.jdbc.pool.OracleDataSource"
user="scott"
password="tiger"
This configuration has worked well for my web application where I was using a single instance of Oracle database. In a new application I've to use two separate instance of Oracle databases and there is a need of distributed transaction.
I know, I've to create two separate datasources for the two separate Oracle instances.
My question is: Since now my transaction will be distributed in nature, do I need to use any other factory-class for configuring XA aware Datasources on OC4J? Or whether the same factory-class (oracle.jdbc.pool.OracleDataSource) will work even for distributed transactions?Here is the link for using Oracle RAC with WLS
http://e-docs.bea.com/wls/docs81/jdbc/oracle_rac.html -
Hi,
Im trying to create a Rest WS with a @GET method that will return me an Emp object. I need the output as a JSON string.
I have created a dynamic web project and added javax RS jars:
When im trying to run this, i'm getting the below mentioned error:
FlushResultHa E org.apache.wink.server.internal.handlers.FlushResultHandler handleResponse The system could not find a javax.ws.rs.ext.MessageBodyWriter or a DataSourceProvider class for the com.rest.assignment.EmpBean type and application/json mediaType. Ensure that a javax.ws.rs.ext.MessageBodyWriter exists in the JAX-RS application for the type and media type specified.
RequestProces I org.apache.wink.server.internal.RequestProcessor logException The following error occurred during the invocation of the handlers chain: WebApplicationException (500 - Internal Server Error)
Please help as im stuck with this from long.
Thanks in advance.
Below is the code for my service class:
package com.rest.assignment;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Properties;
import java.util.Set;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Application;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@Path("/restService")
public class RestService extends Application {
@GET
@Path("/getEmpDetails")
@Produces(MediaType.APPLICATION_JSON)
public Response getStringResponse()
EmpBean empBean = new EmpBean();
String filePath = "C:/Program Files/IBM/workspace/HelloWorld/src/com/rest/resources/EmpData.properties";
Properties properties = new Properties();
try {
properties.load(new FileInputStream(filePath));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
Enumeration e = properties.propertyNames();
String result="";
String[] empDetailsArr;
while (e.hasMoreElements()) {
String key = (String) e.nextElement();
String empDetails = properties.getProperty(key);
empDetailsArr=empDetails.split(",");
empBean.setFirstName(empDetailsArr[0]);
empBean.setLastName(empDetailsArr[1]);
empBean.setEmpId(empDetailsArr[2]);
empBean.setDesignation(empDetailsArr[3]);
empBean.setSkillSet(empDetailsArr[4]);
result = empDetailsArr[1];
//return empBean;
return Response.ok(empBean).type(MediaType.APPLICATION_JSON_TYPE).build();
@Override
public Set<Class<?>> getClasses() {
Set<Class<?>> classes = new HashSet<Class<?>>();
classes.add(RestService.class);
classes.add(EmpBean.class);
return classes;
and my empBean goes like this:
package com.rest.assignment;
public class EmpBean {
private String firstName;
private String lastName;
private String empId;
private String designation;
private String skillSet;
public String getFirstName() {
return firstName;
public void setFirstName(String firstName) {
this.firstName = firstName;
public String getLastName() {
return lastName;
public void setLastName(String lastName) {
this.lastName = lastName;
public String getEmpId() {
return empId;
public void setEmpId(String empId) {
this.empId = empId;
public String getDesignation() {
return designation;
public void setDesignation(String designation) {
this.designation = designation;
public String getSkillSet() {
return skillSet;
public void setSkillSet(String skillSet) {
this.skillSet = skillSet;
Web.xml goes like this:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name>restWS</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>REST</servlet-name>
<servlet-class>com.ibm.websphere.jaxrs.server.IBMRestServlet</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>com.rest.assignment.RestService</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>REST</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>
When i try to return a string from my get method, it gives me a proper response. i get this exception when im trying to return a JSON response.Hi,
Im trying to create a Rest WS with a @GET method that will return me an Emp object. I need the output as a JSON string.
I have created a dynamic web project and added javax RS jars:
When im trying to run this, i'm getting the below mentioned error:
FlushResultHa E org.apache.wink.server.internal.handlers.FlushResultHandler handleResponse The system could not find a javax.ws.rs.ext.MessageBodyWriter or a DataSourceProvider class for the com.rest.assignment.EmpBean type and application/json mediaType. Ensure that a javax.ws.rs.ext.MessageBodyWriter exists in the JAX-RS application for the type and media type specified.
RequestProces I org.apache.wink.server.internal.RequestProcessor logException The following error occurred during the invocation of the handlers chain: WebApplicationException (500 - Internal Server Error)
Please help as im stuck with this from long.
Thanks in advance.
Below is the code for my service class:
package com.rest.assignment;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Properties;
import java.util.Set;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Application;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@Path("/restService")
public class RestService extends Application {
@GET
@Path("/getEmpDetails")
@Produces(MediaType.APPLICATION_JSON)
public Response getStringResponse()
EmpBean empBean = new EmpBean();
String filePath = "C:/Program Files/IBM/workspace/HelloWorld/src/com/rest/resources/EmpData.properties";
Properties properties = new Properties();
try {
properties.load(new FileInputStream(filePath));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
Enumeration e = properties.propertyNames();
String result="";
String[] empDetailsArr;
while (e.hasMoreElements()) {
String key = (String) e.nextElement();
String empDetails = properties.getProperty(key);
empDetailsArr=empDetails.split(",");
empBean.setFirstName(empDetailsArr[0]);
empBean.setLastName(empDetailsArr[1]);
empBean.setEmpId(empDetailsArr[2]);
empBean.setDesignation(empDetailsArr[3]);
empBean.setSkillSet(empDetailsArr[4]);
result = empDetailsArr[1];
//return empBean;
return Response.ok(empBean).type(MediaType.APPLICATION_JSON_TYPE).build();
@Override
public Set<Class<?>> getClasses() {
Set<Class<?>> classes = new HashSet<Class<?>>();
classes.add(RestService.class);
classes.add(EmpBean.class);
return classes;
and my empBean goes like this:
package com.rest.assignment;
public class EmpBean {
private String firstName;
private String lastName;
private String empId;
private String designation;
private String skillSet;
public String getFirstName() {
return firstName;
public void setFirstName(String firstName) {
this.firstName = firstName;
public String getLastName() {
return lastName;
public void setLastName(String lastName) {
this.lastName = lastName;
public String getEmpId() {
return empId;
public void setEmpId(String empId) {
this.empId = empId;
public String getDesignation() {
return designation;
public void setDesignation(String designation) {
this.designation = designation;
public String getSkillSet() {
return skillSet;
public void setSkillSet(String skillSet) {
this.skillSet = skillSet;
Web.xml goes like this:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name>restWS</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>REST</servlet-name>
<servlet-class>com.ibm.websphere.jaxrs.server.IBMRestServlet</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>com.rest.assignment.RestService</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>REST</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>
When i try to return a string from my get method, it gives me a proper response. i get this exception when im trying to return a JSON response. -
How to get maximal value from the data/class for show in Map legend
I make WAD report that using Map Web Item.
I devide to four (4) classes for legend (Generate_Breaks).
I want to change default value for the class by javascript and for this,
I need to get maximal value from the class.
How to get maximal value from the data/class.
please give me solution for my problem.
Many Thx
Eddy Utomouse this to get the following End_date
<?following-sibling::../END_DATE?>
Try this
<?for-each:/ROOT/ROW?>
==================
Current StartDate <?START_DATE?>
Current End Date <?END_DATE?>
Next Start Date <?following-sibling::ROW/END_DATE?>
Previous End Date <?preceding-sibling::ROW[1]/END_DATE?>
================
<?end for-each?>
o/p
==================
Current StartDate 01-01-1980
Current End Date 01-01-1988
Next Start Date 01-01-1990
Previous End Date
================
==================
Current StartDate 01-01-1988
Current End Date 01-01-1990
Next Start Date 01-01-2005
Previous End Date 01-01-1988
================
==================
Current StartDate 01-01-2000
Current End Date 01-01-2005
Next Start Date
Previous End Date 01 -
Unable to compile class for JSP
Please can anyone help me to solve this.
Actually,this is the condition.
In my db,there is a table called UserPassword, which has 4
fields(empNo,UserName,password,level). Now I want to do these things:
When the user submits the data to create a new account via HTML form, it submits the data to the file called CreateAcc.jsp. In this file it perform some logic,here are they.
1)To check the empNo,if it is already exist in the DB,
if empNo =exist then display error.(record already exist)
if empNo =notexist then do task 2).
2)check the UserName,if it is already exist in the db,
if UserName=exist then display error.(because it's a primary key)
if UserName=notexist then do task 3).
3)Create a new user account and save it to the db.
To do these tasks,I never create a new objects for the tasks 1) and 2).
only for task 3)create an object.
Is it the right way?
Here is the file CreateAcc.jsp
<%@ page language="java" %>
<%@ page import="core.UserAccManager" %>
<%@ page import="data.UserPassword" %>
<jsp:useBean id="UserAccManager" class="core.UserAccManager" scope="session"/>
<jsp:setProperty name="UserAccManager" property="*"/>
<jsp:useBean id="UserPassword" class="data.UserPassword" scope="session"/>
<jsp:setProperty name="UserPassword" property="*"/>
<%
String nextPage ="MainForm.jsp";
if(UserPassword.verifyEmpno()){
if(UserPassword.verifyUsername()){
if(UserPassword.createAcc()) nextPage ="MsgAcc.jsp";
}else{
nextPage="UserNameExist.jsp";
else{
nextPage="UserAccError.jsp";
%>
<jsp:forward page="<%=nextPage%>"/>The directory structure:
UserPassword.java- F:/Project/core/data/UserPassword.java
UserAccManager.java - F:/Project/core/UserAccManager.java
Now both are compiling.I put the class files into the TOMCAT,as follows.
UserAccManager.class - webapps/mySystemName/WEB-INF/classes/core/
UserPassword.class - webapps/mySystemName/WEB-INF/classes/core/data/
Here is the full code of the file UserAccManager.java.
package core; //Is this right?
import data.UserPassword; //Is this right?
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public final class UserAccManager{
private static final String DRIVER = "com.mysql.jdbc.Driver";
private static final String URL = "jdbc:mysql://localhost:3306/superfine";
private static Connection connection;
private static PreparedStatement pstmt1;
private static PreparedStatement pstmt2;
private static PreparedStatement pstmt3;
private UserAccManager(){
// Initializes the connection and statements
public static void initConnection() {
if (connection == null) {
try {
String sql;
// Open the database
Class.forName(DRIVER).newInstance();
connection = DriverManager.getConnection(URL);
// Prepare the statements
sql = "SELECT * FROM UserPassword where empNo= ?";
pstmt1 = connection.prepareStatement(sql);
sql = "SELECT UserName FROM UserPassword where UserName= ?";
pstmt2 = connection.prepareStatement(sql);
sql ="INSERT INTO UserPassword VALUES(?,?,?,?)";
pstmt3 = connection.prepareStatement(sql);
catch (Exception ex) {
System.err.println(ex.getMessage());
// Closes the connection and statements
// Method to be called by main class when finished with DB
public void closeConnection() {
//same as previous
public static boolean verifyEmpno(int empno) {
boolean emp_no_select_ok = false;
int emp = -1;
initConnection();
try {
pstmt1.setInt(1, empno);
ResultSet rs1 = pstmt1.executeQuery();
while(rs1.next()){
emp=rs1.getInt("empNo");
if(emp>0)
emp_no_select_ok = false;
} else{
emp_no_select_ok = true;
rs1.close();
pstmt1.close();
catch (Exception ex) {
System.err.println(ex.getMessage());
return emp_no_select_ok;
public static boolean verifyUsername(String username) {
boolean user_name_select_ok = false;
String user = "xxxx";
initConnection();
try {
pstmt2.setString(1, username);
ResultSet rs2 = pstmt2.executeQuery();
while(rs2.next()){
user=rs2.getString("UserName");
if(!user.equals("xxxx"))
user_name_select_ok = false;
} else{
user_name_select_ok = true;
rs2.close();
catch (Exception ex) {
System.err.println(ex.getMessage());
return user_name_select_ok;
public static boolean createAcc(int empno, String username, String password, int
level){
boolean create_acc_ok = false;
initConnection();
try{
//create a new object,from the UserPassword table.
UserPassword useraccount = new UserPassword();
useraccount.setEmpno(empno);
useraccount.setUsername(username);
useraccount.setPassword(password);
useraccount.setLevel(level);
//assign value for ???
pstmt3.setInt(1, useraccount.getEmpno());
pstmt3.setString(2, useraccount.getUsername());
pstmt3.setString(3, useraccount.getPassword());
pstmt3.setInt(4, useraccount.getLevel());
if(pstmt3.executeUpdate()==1) create_acc_ok=true;
pstmt3.close();
//con.close();
catch(SQLException e2){
System.err.println(e2.getMessage());
return create_acc_ok;
}here is the bean (part of it)
package data; //is it right?
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class UserPassword
private int empno;
private String username;
private String password;
private int level;
// Constructor
public UserPassword()
this.empno = empno;
this.username = username;
this.password = password;
this.level = level;
// setters and getters are here.
// public boolean verifyEmpno() {
// return UserAccManager.verifyEmpno(empno);
// public boolean verifyUsername(String username) {
// return UserAccManager.verifyUsername(username);
// These 2 methods not compile with or without para's.So I leave that job for the
//controll class UserAccManager.java.
Now my problem is this: When I submit data, there is an error;org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: -1 in the jsp file: null
Generated servlet error:
[javac] Compiling 1 source file
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:8:
cannot access core.data.UserPassword
bad class file: C:\Program Files\Apache Group\Tomcat
4.1\webapps\HRM\WEB-INF\classes\core\data\UserPassword.class
class file contains wrong class: data.UserPassword
Please remove or make sure it appears in the correct subdirectory of the classpath.
import core.data.UserPassword;
^
1 error
Are there any mistakes? If so tell me where is it and how to change them.Please help.I try it that way, but it don't compile.
Error:core\data\UserPassword.java:package javax.servlet does not exist
import javax.servlet.*;
core\data\UserPassword.java:package javax.servlet.http does not exist
import javax.servlet.http.*;
So,I comment them only in the UserPassword.java file,and compile it again.
Then it compile well.I goto the directory to get the .class files.
But there is only UserPassword.class inside the data folder. There is not
UserAccManager.class in the core folder.
Then I try this way,I put my 2 java files in to a new folder,
F:\SystemName\com
When I try it that way, but it don't compile.
javac -classpath . -d . com\*.javaError:com\UserPassword.java:package javax.servlet does not exist
import javax.servlet.*;
com\UserPassword.java:package javax.servlet.http does not exist
import javax.servlet.http.*;
So,I comment them only in the UserPassword.java file,and compile it again.
Now both are compiling well.There was 2 class files.
I put them in to the WEB-INF/classes/com directory.
Start the server.But it gave errors:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:68: cannot resolve symbol
symbol : variable empno
location: class org.apache.jsp.CreateAcc_jsp
if(UserPassword.verifyEmpno(empno)){
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:69: cannot resolve symbol
symbol : variable username
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.verifyUsername(username)){
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:69: non-static method
verifyUsername(java.lang.String) cannot be referenced from a static context
if(UserAccManager.verifyUsername(username)){
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable empno
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable username
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable password
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable level
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: non-static method
createAcc(int,java.lang.String,java.lang.String,int) cannot be referenced from a static
context
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
8 errorsTo solve the problem non-static method,I goto the UserAccManager.java file and do these
things.
package com;
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.sql.*;
//import javax.servlet.*; //otherwise it tells an error.(package
//javax.servlet does not exist)
//import javax.servlet.http.*;
public class UserAccManager {
private static final String DRIVER = "com.mysql.jdbc.Driver";
private static final String URL = "jdbc:mysql://localhost:3306/superfine";
private static Connection connection;
private static PreparedStatement pstmt1;
private static PreparedStatement pstmt2;
private static PreparedStatement pstmt3;
private UserAccManager() {
// Initializes the connection and statements
private static void initConnection() {
//same
// Closes the connection and statements
// Method to be called by main class when finished with DB
public static void closeConnection() {
//same
public static boolean verifyEmpno(int empno) {
// same.
public static boolean verifyUsername(String username) {
//same.
public static boolean createAcc(int empno, String username, String password, int
level){
//same
package com;
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.sql.*;
//import javax.servlet.*;
//import javax.servlet.http.*;
public class UserPassword {
// same
Again compile those files and put .class filses into the WEB-INF/classes/com directory.
When i submits the data via the form it generates an error:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
[javac] Compiling 1 source file
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:68: cannot resolve symbol
symbol : variable empno
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.verifyEmpno(empno)){
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:69: cannot resolve symbol
symbol : variable username
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.verifyUsername(username)){
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable empno
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable username
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable password
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable level
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
6 errorshere is the CreateAcc.jsp file
<%@ page language="java" %>
<%@ page import="com.UserAccManager" %>
<%@ page import="com.UserPassword" %>
<jsp:useBean id="userPassword" class="com.UserPassword" scope="request"/>
<jsp:setProperty name="userPassword" property="*" />
<%
String nextPage ="MainForm.jsp";
if(UserAccManager.verifyEmpno(empno)){
if(UserAccManager.verifyUsername(username)){
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
}else{
nextPage="UserNameExist.jsp";
else{
nextPage="UserAccError.jsp";
%>
<jsp:forward page="<%=nextPage%>"/>Please, anyone know how to send these parameters to the java file.
Thanks.
Maybe you are looking for
-
Product activation key during win 8.1 update
i am using HP ENVY m6 recently harddisk was crached. so i ordered for an recovery from hp and i receved it and installed win8. when i upgrade to 8.1 it ask for product key. It shows "This product key doesn't work.you might need to get in touch with
-
Inserting pdf file into database
I am trying to insert a adobe pdf file into a multimedia field in my database and while I can get it to cut and past I would like it to auto size into the box that I have defined for it. I have many records to compile, thousands. Some of these pdf fi
-
ISync 2.4 and Sony Ericsson T610
I have always stored contacts in my T610 as "Last Name, First Name" and never had a problem syncing with my Mac address book. Now with iSync 2.4, "Last Name," ends up in the First Name field and "First Name" ends up in the Last Name field. This seems
-
I'm on SP 18.. I'm having only 2 check boxes .. 1) Queue Processing 2) Apply Control Record Values from Payload I'm not having the other 2 options... : " Take Sender From Payload, Take Receiver From Payload. what could be the problem. Thanks sagar
-
KSII activity prices not calculation (actual)
Hi During Actual Price calculation KSII following is error message : All activity prices are manually entered Message no. KP211 Diagnosis All activity prices in controlling area HGC, fiscal year 2011, and version 0 were determined and set as manually