The moose likes JDBC and the fly likes servlet  queries Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Reply 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: 19232

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
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
 
Similar Threads
Definitions and usage of getContext()
why aliase in servlet or jsp
Please help for Context root
Problem getting servlets working
Passing value from one servlet to another