Win a copy of Secure Financial Transactions with Ansible, Terraform, and OpenSCAP this week in the Cloud/Virtualization forum!

bilal haider

Ranch Hand
+ Follow
since Feb 08, 2011
bilal likes ...
Windows XP Java
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
3
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by bilal haider

I have this configuration on my dev machine. Web sphere 7.0.11 eclipse 3.6.2 and IE8. Everything works fine. On my staging machine i have Web sphere 7.0.21 and ie8 Everything works fine. On one of my production machine i have Web sphere 7.0.13 and ie8 and Everything works fine. and on my other production server i have Web sphere 7.0.25 and ie8 and page freezes. I replaced the popupPanel with the FacesUtils.addInfoMessage("Message"); and everything works fine, Why my popupPanle is not working on that faulty production envoirnment.I read a lot about the memory leaks due to popupPanel with ie8.
8 years ago
JSF
I have a jsf page using the facelets. The page contains a data table and a commandButton , when the command button is pressed a confimation panel is displayed, if we confirm the popup panel, values are populated in the datatable and inserted in the db but after that we are unable to interact with the page. On one production server(WebSphere 7) with ie8 I have this issue, but on on dev server(WebSphere 7) with ie8 i dont have the problem. and i can interact with the page several time. The application is very simple one page for login, home page and then search page. The search page hangs in production but i am unable to produce this on my dev / staging machine. I am using icefaces. What should i look into.
8 years ago
JSF
I have a database table that logs the changes in other table. table structure is as following.
Log_Table(id, table_name, operation, flag)
values(1,Customer,1,1);
values(2,Customer,2,1);
values(3,Customer,1,1);
values(4,Customer,2,1);
values(5,Customer,1,1);

I update this table against a button on a web page. by doing following operations.

public List<Long> select_Changes()
{
1) select id from Log_Table where flag =1;
}
public void update_table(List<Long> ids)
{

2)update Log_Table set flag =0 where id in( ids)
}

Problem is that between first and second operation its up to the user to perform the operation. Meanwhile another user at same time does the same operations. now i want that for this user already selected rows for first user should not be selected by the second user. e.g second user when do the first operation should get

values(6,Customer,2,1);
values(7,Customer,1,1);

Please suggest what should i do? I need to lock the rows for any kind of operation after rows are get selected. I tried select for update clause but it did not solve the problem. Its in a web application.
yes i have to post it in transaction forum.
You understand my problem statement very well.
I am trying to achieve

1. User1 gets the list and is currently looking at. He/She still thinking what to do next
2. User2 also tries to get the list. But since the data needs action from user1, user2 is not even shown the list and has to wait.

And i am having trouble in knowing

1. How do you know if user1 is DEFINITELY does the second action i.e. update log table ?
2. Even if user1 does the second action, is it allowed to block user2 till that time ?
Answer for second point is yes i want to block user2. And if dont want to block then what is the solution?
very cool. so simple.
8 years ago
I am having tough time in my application.I have very short time implement the functionality. This is scenario. I need to insert/update a record in a remote site. That

site is having different look up values than the local site. Look up values are dependent on other look up values. Central db have different values of look up than local

db. Now when i insert/ update a record of local db in central db vice verse, i get integrity constraint error because i have different values of look up. e.g

Local Database 1:

Designation Table
ID Name
-----------------------
1 Researcher
2 Programmer
3 Office Boy

Employee Table

ID Name Designation_ID(FK)
-----------------------
1 John 1
2 Alex 2

Remote Databse

Designation Table
ID Name
-----------------------
10 Manager
11 Dy Manager
12 Programmer
13 Researcher
14 Office Boy


Employee Table

ID Name Designation_ID(FK)
-----------------------
100 Tim Lyn 10
101 Bruce 12

Now i want to insert the records of local db in central db. and central db in local db. I can do the following.

Solution 1:
Create the lookup of all the local dbs inside central db, (overhead/redunduncy)
Solution 2:
Send the Designation names list with the records and match the strings at both the sites and insert/update repective ids. i.e John will get the designation id 13 when

inserted in central database and Bruce will get designation id 2 when inserted in local database.
In this case every time i am sending a record for insert / update i am sending a complete list of the Designation Lookup table.

Local databases communicate over the webservice with the central database. Please suggest. I am not in a position to pick the solution? Any Other Solution?



8 years ago
I have a database table that logs the changes in other table. table structure is as following.
Log_Table(id, table_name, operation, flag)
values(1,Customer,1,1);
values(2,Customer,2,1);
values(3,Customer,1,1);
values(4,Customer,2,1);
values(5,Customer,1,1);

I update this table against a button on a web page. by doing following operations.

public List<Long> select_Changes()
{
1) select id from Log_Table where flag =1;
}
public void update_table(List<Long> ids)
{

2)update Log_Table set flag =0 where id in( ids)
}

Problem is that between first and second operation its up to the user to perform the operation. Meanwhile another user at same time does the same operations. now i want that for this user already selected rows for first user should not be selected by the second user. e.g second user when do the first operation should get

values(6,Customer,2,1);
values(7,Customer,1,1);

Please suggest what should i do? I need to lock the rows for any kind of operation after rows are get selected. I tried select for update clause but it did not solve the problem. Its in a web application.
1) Syntax Error
runs fine in eclipse but not in netbeans

runs fine in netbeans but not in eclipse


2) Runtime Exception
Runtime exception occurs when following code is called in netbeans. works fine in eclipse.



java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.Short
at org.apache.derby.client.net.NetStatementRequest.buildFDODTA(Unknown Source)
at org.apache.derby.client.net.NetStatementRequest.buildSQLDTAcommandData(Unknown Source)
at org.apache.derby.client.net.NetStatementRequest.writeOpenQuery(Unknown Source)
at org.apache.derby.client.net.NetPreparedStatement.writeOpenQuery_(Unknown Source)
at org.apache.derby.client.am.PreparedStatement.writeOpenQuery(Unknown Source)
at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
at org.apache.derby.client.am.PreparedStatement.executeQuery(Unknown Source)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
at org.hibernate.loader.Loader.doQuery(Loader.java:674)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2213)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
at com.model.dao.TicketDAO.findOpenTickets(TicketDAO.java:154)
at com.util.TicketActiveDateSetterTask.run(TicketActiveDateSetterTask.java:29)
at com.main.Application.initDatabase(Application.java:160)
at com.main.Application.start(Application.java:91)
at com.main.Main.main(Main.java:12)
Restrictions apply to the RETURNING clause:
You cannot use this clause with parallel DML or with remote objects(dblink).
You cannot retrieve LONG types with this clause.

Now i have achieved the task by first getting sequence.nextval@Dblink and then passing it in insert,
I am inserting a record in remote table using foolowing code.


Exception:
java.sql.SQLException: ORA-22816: unsupported feature with RETURNING clause

at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:206)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1034)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:194)
at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:953)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1222)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3387)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3468)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeUpdate(OraclePreparedStatementWrapper.java:1350)
at org.hms.pocdatasync.ui.bean.Test.testPush(Test.java:219)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:91)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

What can be the problem? I am using Oracle 11.2.0 on my local machine. Can this be an issue that My Remote DB is not of same version i.e Oracle version issue on the two machines.
Yes prior to your current post i was not clear in the solution and i was mixing the two techniques, Now i am more clear with the deffer constraint technique because it lasts for the current session only. This is the only way i can do what i want to do, secondly i am not allowed to alter this bad db design :-(

Please suggest me how can i do this in java ? any example because i am stuck in the issue for five days and already late.

And thank you for your time and fruitfull response,
@ Martin : I disabled the constraint and altered it as deffereable . then executed the

update Department
set id =10
where id =100;

update employee
set d_id=10
where d_id =100;

and got success. after that i enabled the constraint. But my question is that the time interval for which i deffered the constraint, someone else can access the db and do invalid operations might be performed voilating constraint.

I want this in java

Deffered statment for this session only
Execute the statments
Enable constraint


How can I do that, Is there any workaround in java. I googled but unable to solve this.
@ Chris : I want to do this in java and for the current session only, so that if some one is accessing the db at the time onstraints are disabled by my procedure , constraints must be checked for that user.
Hi All,
Hope all are doing fine. Through java when i was doing

update Department
set id =10
where id =100;

update employee
set d_id=10
where d_id =100;

I get following errors:

ORA-02292: integrity constraint (MIS.DEPT_FK) violated - child record found
ORA-02291: integrity constraint (MIS_EMP_FK) violated - parent key not found


I issued following comand

set constraints SERVICE_DETAIL_2_FK deferred

but the constraint is not deferrable.

Any workable solution to achieve the desired result?
Thank you very much for the time and suggestion.

Actulay I am trying to accomplish the below activity:

I am querying a table, selecting some values, like Customer(ID Number, DOB Timestamp(6), Email varchar, active boolean)

and i want to return the resultset via webservice which is not possible , because resultset is not serializable. so i decided to save this result set in the xml. but in xml value of dob is oracle timestamp. when it is saved in xml it is like

<DOB>
oracle.sql.TIMESTAMP@164b9b6
</DOB>

after converting the whole resultset into xml i converted this to string.
Webservice client receive this string and converts back to resultset.

Problem is that how to store null values in the xml?
how to store long and date values in the xml?

so that at client end i should not be converting the strings to respective data types again.

I hope i am clear now.
Result:
ID : 1234
DOB: 12- MAR-1992
Email: Null
Active:Null
XML i want to return from web service method
<Result>
<Customer>
<ID>1234</ID>
<DOB>12- MAR-1992</DOB>
<Email></Email>
<Active></Active>
<Result>
<Customer>
At client end:
i want to convert this xml to resultset again:
Result:
ID : 1234
DOB: 12- MAR-1992
Email: Null
Active:Null

Suppose there are more columns whose data type and names are not known to developer.
Is this the right approach? If not what is the right approach?
9 years ago
@Jeff:" The code you provided does not produce the output you posted."
Sorry, I didn't copy the output from console. I typed that in the post.



and i can't use getDate() or getTime() or getTimestamp() as i want to get object value and then i want to cast it?
How can I do that.

9 years ago