Good Evening
i hope i will be clear and fully details.
i have created a web service project on netbeans using soap technology.
i am using xampp mysql to create 5 different simple hotel databases.
from my project i am connecting with jdbc connector succesfully only to 1 database.
that i am trying to do is a broker that manages these 5 databses with jquerrys and booking rooms
i tried to connect directly to 5 dbases but i cannot. what i did is just copy pasting the connect code and rename the database name as it seems here on the constructor.
public hotels() {
try {
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/hotel", "root", "");
} catch (Exception e) {
System.out.println(e.getMessage());
}
try {
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/polaris", "root", "");
} catch (Exception e) {
System.out.println(e.getMessage());
}
try {
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/palace", "root", "");
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
when i run this the system connects only to the last database(palace).
what can i do in order to connect directly to all databases?