File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes servlet  queries Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "servlet  queries" Watch "servlet  queries" New topic
Author

servlet queries

jagan billa
Greenhorn

Joined: Dec 05, 2011
Posts: 11
How to use this query in servlet
*****combine two database******

database1:registration
database2:shopping_cart
online is a common table in both database

SELECT registration.online.price, shopping_cart.online.name FROM registration.online, shopping_cart.online WHERE registration.online.id = 1 AND shopping_cart.online.id = registration.online.id;

how to define two database name in this

c=DriverManager.getConnection("jdbc:mysql://localhost:3306/database name","root","root");


Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19692
    
  20

You just need one of the two databases to connect to. The database prefix inside the query will take care of the rest.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Janarthanan Rajendran
Greenhorn

Joined: Nov 07, 2011
Posts: 7

Do not use Business logic inside Servlets, it should always go through Service classes.

Regards,
Jana
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: servlet queries