MaXiMkA
MaXiMkA

Reputation: 449

How to connect to an Oracle database from IntelliJ IDEA 14?

Could someone tell me exactly how could I manage this connection? I am doing this for like 3 days now and every example, every video on the net is about MySQL or SQLite connection with NetBeans. My goal is to put the results of a SELECT query in a JTable. Nothing more. I know I need some driver and connection URL, ResultSet, PreparedStatement, TableModel, but I didn't manage to find the perfect combination to get some results.

Thanks.

Upvotes: 6

Views: 26177

Answers (2)

egallardo
egallardo

Reputation: 1284

You may be struggling with all the options on the IntelliJ dialog. Most IDEs provide a way to specify the JDBC URL. If you are familiar with Oracle TNS names the below URLs will work for you when you have a complex Oracle address list (as in RAC, for instance) or when there is a firewall and you must specify SERVER=DEDICATED:

jdbc:oracle:thin:@(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = yourdbhost.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE)))

or

jdbc:oracle:thin:@(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = yourdbhost.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = XE)))

In most simple cases this will suffice:

jdbc:oracle:thin:@yourdbhost.com:1521:XE

Finally, make sure your username and password work by testing them with SQL/PLUS

Upvotes: 1

Stephen C
Stephen C

Reputation: 718758

If you can't find a tutorial or video that covers all of this, then you need to combine sources that cover the individual parts of the problem.

For example:

Upvotes: 2

Related Questions