Uderc programming article aggregator sites

Strange scenario,Oracle can not display the data in mysql correctly

Answers: Have 2 answers
I use Heterogeneous Service+ODBC to achieve "oracle access mysql"(any other method?),and now i find Oracle can not display the data in mysql correctly:
mysql> create table tst(id int,name varchar(10));
Query OK, 0 rows affected (0.00 sec)
mysql> insert into tst values(1,'a');
Query OK, 1 row affected (0.00 sec)
mysql> select * from tst;
| id | name |
| 1 | a |
1 row in set (0.00 sec)
mysql> show create table tst\G
*************************** 1. row ***************************
Table: tst
Create Table: CREATE TABLE `tst` (
`id` int(11) DEFAULT NULL,
`name` varchar(10) DEFAULT NULL
1 row in set (0.00 sec)
-------------oracle ------------------
SQL> select count(*) from "tst"@mysql;
SQL> select * from "tst"@mysql;
SQL> desc "tst"@mysql;
Name Null? Type
id NUMBER(10)
The best answer: You can make the following query on the result page:
"select * from the_table where movietitle = ? and cinema = ?"
then you set movietitle and cinema to those which the user selected. If the resultset contains more than 0 rows, that means the movie is available.
Below is the sample code, it assumes you have a connection to the database:
PreparedStatement stat = myConnection.prepareStatement("select * from the_table where movietitle = ? and cinema = ?");
stat.setString(1, usersMovieTitleSelection);
stat.setString(2, usersCinemaSelection);
ResultSet res = stat.executeQuery();
if (res.next()) {
out.print("The movie is available");
} else {
out.print("The movie is not available");
}Now just add that to your JSP page. Enjoy ! =)