rayskelton
asked on
Invalid Oracle URL specified connecting to 8.1.7
I get an Invalid Oracle URL specified error connecting to an Oracle 8.1.7 database. I am Java 1.4.2 and the Oracle Database driver is 'j2sdk1.4.2'. I got on Oracle OTN to attempt to get another driver and the latest I find is for Java 1.2(class12.zip). Does this mean there is no driver available for Oracle 8.1.7 and Java 1.4.2? Bellow is by Oracle error.
-------------------------- ---------- ---------- ---------- --
Connect String:jdbc:oracle:thin@1x x.xx.xxx.x xx:port:si d
Error Connecting to Database:xxxx
Connect String:jdbc:oracle:thin@99 9.99.999.9 99:5555:22 22
SqlException:Invalid Oracle URL specified
SqlState :null
Vendor Error:17067
-------------------------- ---------- ---------- --
java.sql.SQLException: Invalid Oracle URL specified
--------------------------
Connect String:jdbc:oracle:thin@1x
Error Connecting to Database:xxxx
Connect String:jdbc:oracle:thin@99
SqlException:Invalid Oracle URL specified
SqlState :null
Vendor Error:17067
--------------------------
java.sql.SQLException: Invalid Oracle URL specified
You must use a valid IP and port number
ASKER
I have a valid Id and Port. I blanked them out to prevent from public view.
I don't think you need to blank the port ;-) Please post again with it looking at bit more realistic
You should be able to use the machine name too. Let's say the Oracle server machine is called 'ray' and you can do
ping ray
Then you should be able to use
jdbc:oracle:thin@ray:nnnn
where 'nnnn' is the right port number
ping ray
Then you should be able to use
jdbc:oracle:thin@ray:nnnn
where 'nnnn' is the right port number
ASKER
Below is the exception thrown. I have 2 drivers I have tried this with.-- classes12_g.zip and ojdbc14.jar --
My classpath is:/i2k/rxs/java/j2sdk1.4. 2/lib:/i2k /rxs/java/ j2sdk1.4.2 /drivers/c lasses12_g .zip:.
-------------------------- ---------- ---------- ---------- ----
Connect String:jdbc:oracle:thin@17 2.25.248.2 15:1531:i2 d2
Error Connecting to Database:i2d2
Connect String:jdbc:oracle:thin@17 2.25.248.2 15:1531:i2 d2
SqlException:Invalid Oracle URL specified
SqlState :null
Vendor Error:17067
-------------------------- ---------- ---------- --
java.sql.SQLException: Invalid Oracle URL specified
My classpath is:/i2k/rxs/java/j2sdk1.4.
--------------------------
Connect String:jdbc:oracle:thin@17
Error Connecting to Database:i2d2
Connect String:jdbc:oracle:thin@17
SqlException:Invalid Oracle URL specified
SqlState :null
Vendor Error:17067
--------------------------
java.sql.SQLException: Invalid Oracle URL specified
Please post your connect code
ASKER
public int getDbConnect()
{
// set class members with configuration
// information read from the properties file
host = System.getProperty("host") ;
userName = System.getProperty("user") ;
url = System.getProperty("url");
passWord = System.getProperty("passwo rd");
port = System.getProperty("port") ;
sid = System.getProperty("sid");
databaseName = System.getProperty("databa seName");
maxSelectRows = System.getProperty("maxSel ectRows");
// Determine which system we are on
// the MySql driver is for Linux *
// Oracle this is for Oracle Driver
String connectString = null;
if(url.compareTo("jdbc:mys ql//") == 0)
{// MySql Database
connectString = url + host + ":"
+ port + "/" + sid
+ "?user=" + userName
+ "&password=" + passWord;
}
else
if(url.compareTo("jdbc:ora cle:thin@" ) == 0)
{// Oracle Database
connectString = url + host + ":" + port + ":" + sid ;
}
else
System.out.println("Unsupp orted URL for this application:" + url);
try
{
System.out.println("Connec ting to Database:" + databaseName
+ sid + " at port:"+ port);
System.out.println("Connec t String:" + connectString);
connection = DriverManager.getConnectio n(connectS tring);
System.out.println("Connec tion established for:" + databaseName);
connection.setAutoCommit(f alse);
}
catch(SQLException ex)
{
System.out.println("Error Connecting to Database:" + sid);
System.out.println("Connec t String:" + connectString);
System.out.println("SqlExc eption:" + ex.getMessage());
System.out.println("SqlSta te :" + ex.getSQLState());
System.out.println("Vendor Error:" + ex.getErrorCode());
System.out.println("------ ---------- ---------- ---------- ---------- --");
sqlEx.printStackTrace();
}
return(0);
}
{
// set class members with configuration
// information read from the properties file
host = System.getProperty("host")
userName = System.getProperty("user")
url = System.getProperty("url");
passWord = System.getProperty("passwo
port = System.getProperty("port")
sid = System.getProperty("sid");
databaseName = System.getProperty("databa
maxSelectRows = System.getProperty("maxSel
// Determine which system we are on
// the MySql driver is for Linux *
// Oracle this is for Oracle Driver
String connectString = null;
if(url.compareTo("jdbc:mys
{// MySql Database
connectString = url + host + ":"
+ port + "/" + sid
+ "?user=" + userName
+ "&password=" + passWord;
}
else
if(url.compareTo("jdbc:ora
{// Oracle Database
connectString = url + host + ":" + port + ":" + sid ;
}
else
System.out.println("Unsupp
try
{
System.out.println("Connec
+ sid + " at port:"+ port);
System.out.println("Connec
connection = DriverManager.getConnectio
System.out.println("Connec
connection.setAutoCommit(f
}
catch(SQLException ex)
{
System.out.println("Error Connecting to Database:" + sid);
System.out.println("Connec
System.out.println("SqlExc
System.out.println("SqlSta
System.out.println("Vendor
System.out.println("------
sqlEx.printStackTrace();
}
return(0);
}
ASKER
I resolved this issue by adding a ':' between the thin and @.
jdbc:oracle:thin:@")
Thanks for youe help
jdbc:oracle:thin:@")
Thanks for youe help
OK :-)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.