In Java, I remember that there was no dbms connection on another PC. What's the problem?

Asked 2 years ago, Updated 2 years ago, 47 views

I remember that the connection of 127.0.0.1 to the db from java was successful.

By the way, I remember that when I connected to the IP address from the database of another computer connected to the network, I couldn't connect.

Is it because the pc is using the scott account in dbms?

What's the reason?

public Connection getConnection(){

        try {  

                String url = "jdbc:oracle:thin:@127.0.0.1:1521:xe"; 
                //url used 127.0.0.1 as a different ip address, so I remember that the connection was not possible.

                String user = "SCOTT"; 
                String password = "TIGER"; 
                conn = DriverManager.getConnection(url, user, password); 
            } } catch (Exception e) { // TODO: handle exception }


        return conn; 
}

database java dbms-connection

2022-09-21 16:48

1 Answers

Would you like to check the two below?


2022-09-21 16:48

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.