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,042 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

911 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

25 Experts available now in Live!

Get 1:1 Help Now