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,054 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
This exercise is about for the following scenario: Dmgr and One node with 2 application server. Each application server contains it owns application. Application server name as follows server1 contains app1 server2 contains app1 Prereq…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

752 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