| |

VerySource

 Forgot password?
 Register
Search
View: 2544|Reply: 6

Using java to develop software, but it can't connect to the oracle database installed in the machine, and always throws

[Copy link]

2

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-9-29 15:30:01
| Show all posts |Read mode
Related code in Java:

Class.forName( "oracle.jdbc.driver.OracleDriver" );
conn = DriverManager.getConnection( "jdbc:oracle:thin:@LvQiang:1521:Oracle","SYSTEM", "zrc775fp")


The exception thrown:

java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:274)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:319)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:344)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:148)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:545)
at java.sql.DriverManager.getConnection(DriverManager.java:525)
at java.sql.DriverManager.getConnection(DriverManager.java:171)


I can be sure that the host name, port number, and database name are correct, but why can’t I connect to this one? I use a router. I set the IP address of the router in the router as: 192.168.1.2, but I changed LvQiang to this IP address and it didn’t work! ! I don’t know why, the Oracle database I installed is version 9i, installed in the directory G:\Oracle9i on the computer, please give me some pointers, I’m going crazy! ! ! ! ! ! ! !
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-29 22:30:01
| Show all posts
con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.2:1521:Oracle","SYSTEM", "zrc775fp")

Try like this
Reply

Use magic Report

0

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-9-30 16:45:01
| Show all posts
use
("jdbc:oracle:thin:@127.0.0.1:1521:Oracle","SYSTEM", "zrc775fp")
Try
Also, see if SID is wrong,
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-10-1 11:00:01
| Show all posts
thin->oci
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-10-1 11:30:01
| Show all posts
I need to use OCI method, big brother. thin is too simple
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-10-1 11:45:01
| Show all posts
One very important point is that the TNSLSNR service is not turned on
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2021-7-23 14:51:10
| Show all posts
Is the firewall intercepted?
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list