Database Administration (MOSC)

MOSC Banner

not able to connect through java code - java.sql.SQLException: IO Error: Unknown host specified

edited Feb 21, 2013 1:59PM in Database Administration (MOSC) 6 commentsAnswered ✓
Hello

I am getting this error when connecting from java code to a remove database.

Here is the script i am using

import java.sql.*;
import java.io.*;
import oracle.jdbc.OracleDriver;

class JDBCVersion
{
public static void main (String args []) throws SQLException
{
// Load the Oracle JDBC driver

DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());

// Change the following code line to reflect a valid connection to your
// server

Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@d_aivs","USER","PWD");

// Create Oracle DatabaseMetaData object
DatabaseMetaData meta = conn.getMetaData ();

// gets driver info:

System.out.println("\n=============\nDatabase Product Name is ... " +
meta.getDatabaseProductName());
System.out.println("\nDatabase Product Version is " +

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center