V
V
Viktoria Smirnova2018-04-05 06:44:58
MySQL
Viktoria Smirnova, 2018-04-05 06:44:58

Connecting and not connecting to the database from different pages, but with the same code?

Question to know. I have a standard database connection from two different jsp pages, different IDEA projects:

try
    {       
        Class.forName("com.mysql.jdbc.Driver");
        System.out.println("Driver Loaded");
        conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/testDB","root","");
        //Database Name - testDB, Username - "root", Password - ""
        System.out.println("Connected...");         
    }
    catch(Exception e)
    {
        e.printStackTrace();
    }

however, there is a connection on one, not on the other, firewood, Apache, everything is the same, why is that?

PS when adding a database in the database settings
Test Connection Successful
and in the view (panel on the right) the base is visible.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xmoonlight, 2018-04-05
@xmoonlight

Different settings for Data Sources for projects.
Check out the settings here .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question