Solved

Proper URL Connection String when using Oracle oci9 as the protocol to get a JDBC Connection to an Oracle Database from a Weblogic server.

Posted on 2004-09-09
1
1,040 Views
Last Modified: 2013-12-10
Gentlemen,

I am getting a SQL Exception when trying to obtain a jdbc connection using the JDBC libraries of the OCI9 Oracle client.

Since I am using the C:\j2sdk1.4.2_03 SDK in Weblogic(JAVA_HOME value), I included this in my Weblogic classpath:

set CLASSPATH=%CLASSPATH%;%ORACLE_HOME%\ojdbc14.jar;%ORACLE_HOME%\ojdbc14_g.jar;%ORACLE_HOME%\ocrs12.jar;
set CLASSPATH=%CLASSPATH%;%ORACLE_HOME%\nls_charset12.jar;

where ORACLE_HOME is an environment variable set as c:\oracle\ora92\bin

and in my path (this path contains the ocijdbc9.dll):
set PATH=.;%WL_HOME%\server\bin;%JAVA_HOME%\bin;%PATH%;C:\oracle\ora92\bin;

The JDBC code I am using is

Connection con = null;
      Statement workStmt = null;
 try{
              
       Properties props = new Properties();
      props.put("user","BizAgiVision");
      props.put("password", "BizAgi");
      props.put("dll", "ocijdbc9");
      props.put("protocol", "oci9");
      
      Driver myDriver = (Driver)Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
      
      DriverManager.registerDriver(myDriver);
      String connectionURL = "jdbc:oracle:oci9:@(description=(address=(host=devt_oracle)(protocol=tcp)(port=1521))(connect_data=(SID=BizAgiOr)))";
      
      con =    DriverManager.getConnection(connectionURL, props);

                Code continues..

UNFORTUNATELY, I AM GETTING THE EXCEPTION:

java.sql.SQLException: URL de Oracle especificada invßlida (TRANSLATED BY MYSELF AS: "specified URL for Oracle is not valid")
        at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
        at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210)
        at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:273)
        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:182)
        at java.sql.DriverManager.getConnection(DriverManager.java:512)
        at java.sql.DriverManager.getConnection(DriverManager.java:140)
        at com.testing.session.stateless.FundsManagerStatelessBean.addFunds(Fund
sManagerStatelessBean.java:98)

DO YOU KNOW WHAT THE PROPER CONNECTION STRING WOULD BE FOR OCI9? this string worked in another machine but for
the OCI8 protocol.

Thanks.
0
Comment
Question by:eduardotorres17
1 Comment
 
LVL 11

Accepted Solution

by:
sompol_kiatkamolchai earned 500 total points
ID: 12022902
Umm.. I am using this one.

jdbc:oracle:thin:@(description=(address=(host=devt_oracle)(protocol=tcp)(port=1521))(connect_data=(sid=BizAgiOr)))
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Configure Web Service (server application) I. Configure security for Web Services methods First, we need to protect Session bean which implements the service: 1. Open EJB deployment descriptor (ejb-jar.xml) in the EJB project that contains you…
There are numerous questions about how to setup an IBM HTTP Server to be administered from WebSphere Application Server administrative console. I do hope this article will wrap things up and become a reference for this task. You need three things…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now