This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Getting MEAN with Mongo, Express, Angular, and Node and have Simon Holmes on-line!
See this thread for details.
The moose likes JDBC and Relational Databases 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 and Relational Databases
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: 19977
    
  25

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 - OCEJPAD 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
 
 
subject: servlet queries