Connecting to Oracle DB with JDBC ...
I receive this err when i run my codes
java.sql.SQLException: Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=150999297)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))
Interactive Session Ended
Below is my codes.
// header - edit "Data/yourJavaHeader" to customize
// contents - edit "EventHandlers/Java file/onCreate" to customize
import java.sql.*;
class MakingTheConnection
public static void main(String[] args)
Connection connection = null;
Statement stmt = null;
try
System.out.println("Hello 1");
Class.forName("oracle.jdbc.driver.OracleDriver");
System.out.println("Hello 2");
catch(java.lang.ClassNotFoundException e)
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
try
System.out.println("Hello 2");
//connection = DriverManager.getConnection("jdbc:oracle:thin:@172.20.134.95:1521:SNP", "system", "manager");
connection = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:SNP", "system", "manager");
stmt = connection.createStatement();
catch(java.sql.SQLException ex)
System.err.print("SQLException: ");
System.err.println(ex.getMessage());
try
System.out.println("Hello 3");
if (stmt!=null)
{stmt.close();}
if (connection!=null)
{connection.close();}
catch(Exception e)
e.printStackTrace();
//load the driver
try
Class.forName("oracle.jdbc.driver.OracleDriver");
//Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String sourceURL = "jdbc:oracle:thin:@172.20.134.95:1521:SNP";
//String sourceURL = "jdbc:oracle:thin:@172.20.134.95:389:SNP";
String user = "system";
String password = "manager";
Connection databaseConnection = DriverManager.getConnection(sourceURL, user, password);
System.out.println("connected");
databaseConnection.close();
catch (ClassNotFoundException cnfe)
System.out.println(cnfe);
catch(SQLException sqle)
System.err.println(sqle);
Do not uncomment the codes i put as comments coz they are not used :)
I really need help here..thankz.
Hi:
That error code is Service Name related error.
Oracle error docs has the following
TNS-12505 TNS:listener could not resolve SID given in connect descriptor
Cause: The SID in CONNECT_DATA was not found in the listener's tables.
Action: Check to make sure that the SID specified is correct. The SIDs that are currently registered with the listener can be obtained by typing "LSNRCTL SERVICES listener_name". These SIDs correspond to SID_NAMEs in TNSNAMES.ORA, or DB_NAMES in the INIT.ORA file.
Similar Messages
-
Trouble to connect to Oracle Lite with JDBC
Hi.
I have installed Oracle Lite 9i on my PC (Win 2000 Pro). Then I connected an HP Jornada 525 (WinCE 3.0) and with
ActiveSync I installed the Oracle Mobile Client. Using MSql, I created some tables and did some data inserts - Oracle
is working fine on the Pocket PC. The next step was to create an Java application that will run on the Jornada to
connect to this database and edit its data. Here is the initial source code:
import java.sql.*;
public class JDBCEX {
public void JDBCEX () {
public static void main(String args[]) {
Connection conn = null;
Statement stmt = null;
ResultSet retset = null;
try {
Class.forName("oracle.lite.poljdbc.POLJDBCDriver");
conn = DriverManager.getConnection("jdbc:Polite:Polite","system", "manager");
catch (Exception e) {
System.out.println(e);
System.exit(0);
This works fine on my PC, but in the Pocket PC it gave me: java.sql.SQLException: Internal Error. This after I expanded
the jar files, 'cause before it tells me that ther is no oljdbc40 on the shared library path. I adjusted the classpath on the
registry, but i does not have any impact ... There is no file with name oljdbc40, only JARs olite40 and olitejdbc40. I installed
olitejdbcpj40.jar, and setting this library leads to the same error above.
What could be wrong? Do you have any tutorial or can you list all steps necessary to bring this working?
ThanksIf you're attempting to use the ODBC API directly, have you downloaded the ODBC SDK from Microsoft? That will include some sample code, which is a great starting point. So far as I'm aware, you shouldn't need to configure anything in Borland C++ that you don't have to configure in any other C++ compiler to use ODBC.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
Can't connect to external Oracle DB with JDBC connector
Hello guys,
I had failed to connect to connect external Oracle via JDBC connector .
Could you please help me to resolve the problem ?
Backgroud:
We need to connect the external Oracle DB with JDBC connector, because BI need to connect to the target Oracle. If the JDBC connector suceed, BI will create a UD which use the datasource
we create in Visual admin to connect to the external Oracle DB.
Environment:
Our EP version is NW04S SP17 , OS is AIX .
The target Oracle DB version is 10g(10.1.0.2.0, 64bi).
Configuration procedure :
1. Import Oracle driver "ojdbc14.jar" and create new driver which named "Oracle " under
JDBC Connector ->Run time ->Driver in Visual Admin.
2. Create datasource "Mydatasource" under JDBC Connector ->Run time ->Data Source,
Name : Mydatasource
Driver Name : Oracle
JDBC version: 2.0(with XA support)
JDBC compliant:
Object Factory :oracle.jdbc.pool.OracleDataSourceFactory
DataSource Type: ConnectionPoolDataSource
*CPDS class name :oracle.jdbc.pool.OracleConnectionPoolDataSource
Additional:
Additional Properties:
DatabaseName:LPAR8TEST
DriverName:oracle.jdbc.OracleDriver
Password: *****
PortNumber:1521
ServerName: 10.1.16.208
URL :jdbc:oracel:[email protected]:1521:LPAR8TEST
User:IMPL
Connectoin Pool:
Initial Connectons: 1 Expiration: (check)
Maximum Connections: 25 Connection Lifetime :600
Maximum time wait of connection : 60 Cleanup Thread : 200
Default Connectoin Isolaton :Default
SQL Engine:
Open SQL
3.Create Connector :
Copy the standard connector :SDK_JDBC to SDK_JDBC_Oracle,
Resource Adopter:
Loader References:
Add "libray:Oracle" .
Managed Connection Factory:
Configuration Property:
DriverName:oracle.jdbc.OracleDriver
Password: ****
User:IMPL
URL: jdbc:oracle:[email protected]:1521:LPAR8TEST
All fo my configuration had been listed.
And I had created JCO RFC : JT-BIDEV_PORTAL_BD1 , and created RFC connection with SM59 in BI.
Please give me some suggesiton.
Thanks.
LouisWhen I try to start datasoure "Mydatasource" , it display error, error detail:
java.rmi.RemoteException: com.sap.engine.services.dbpool.exceptions.BaseRemoteException: Error during start of application "sap.com/Mydatasource". [id = StartupError]
at com.sap.engine.services.dbpool.deploy.DataSourceManagerImpl.startApplication(DataSourceManagerImpl.java:608)
Caused by: java.rmi.RemoteException: Error occurred while starting application in whole cluster and wait.; nested exception is:
com.sap.engine.services.deploy.exceptions.ServerDeploymentException: Clusterwide exception: server ID 3128050:com.sap.engine.services.dbpool.exceptions.BaseDeploymentException: Cannot start DataSource "CGNPC".
at com.sap.engine.services.dbpool.deploy.ContainerImpl.startDataSource(ContainerImpl.java:1549)
Caused by: com.sap.engine.services.dbpool.exceptions.BaseResourceException: SQLException thrown by the physical connection: java.sql.SQLException: Invalid Oracle URL specified: OracleDataSource.makeURL
at com.sap.engine.services.dbpool.spi.CPManagedConnectionFactoryImpl.createManagedConnection(CPManagedConnectionFactoryImpl.java:198)
Caused by: java.sql.SQLException: Invalid Oracle URL specified: OracleDataSource.makeURL
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
Caused by: com.sap.engine.services.deploy.exceptions.ServerDeploymentException: Clusterwide exception: server ID 3128050:com.sap.engine.services.dbpool.exceptions.BaseDeploymentException: Cannot start DataSource "Mydatasource".
at com.sap.engine.services.dbpool.deploy.ContainerImpl.startDataSource(ContainerImpl.java:1549)
Caused by: com.sap.engine.services.dbpool.exceptions.BaseResourceException: SQLException thrown by the physical connection: java.sql.SQLException: Invalid Oracle URL specified: OracleDataSource.makeURL
at com.sap.engine.services.dbpool.spi.CPManagedConnectionFactoryImpl.createManagedConnection(CPManagedConnectionFactoryImpl.java:198)
Caused by: java.sql.SQLException: Invalid Oracle URL specified: OracleDataSource.makeURL
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
u2026.
When I try to test JDBC with URL : http://jt-pldev:50000/TestJDBC_Web/TestJDBCPage.jsp,
First I choose connection name "SDK_JDBC_Oracle" .
If I click "Check Connectons", it display :
500 Internal Server Error
SAP J2EE Engine/7.00
Application error occurred during request processing.
Details:
java.lang.NoClassDefFoundError: com.sap.ip.bi.sdk.dac.connector.odbo.impl.Connection (initialization failure)
Exception id: [001A64A86F2C006B000004C40010302A000469C74E86A096]
If I click "Slecton Connection", it display:
500 Internal Server Error
SAP J2EE Engine/7.00
Application error occurred during request processing.
Details:
com.sap.engine.frame.core.load.SAPNoClassDefFoundError: javax.resource.Referenceable
Exception id: [001A64A86F2C0063000004C00010302A000469C74FA2BB59] -
Connecting Oracle 8i with JDBC
Hi Friends,
I am facing a problem while doing a connection to my DB which is ORACLE 8i with JDBC communication channels thorugh xi.
I am getting an error "Error during database connection to the database URL 'jdbc:oracle:thin:@hostname:ORCL' using the JDBC driver 'oracle.jdbc.driver.OracleDriver': 'com.sap.aii.adapter.jdbc.sql.DriverManagerException: Cannot establish connection to URL 'jdbc:oracle:thin:@hostname:ORCL': SAPClassNotFoundException: oracle.jdbc.driver.OracleDriver"
In one of the SAP notes:867176 its mentioned .....
3. Which JDBC driver version is certified to connect to which database version?
From the Oracle side:
The Oracle 10g JDBC drivers are certified to work with currently-supported versions of the database.
JDBC 8i/9i Thin drivers are certified to work with supported (previous) versions of the database.
Existing and supported JDBC drivers are certified to work with Oracle Database 10g.
From the SAP side:
SAP only supports homogeneus setups. The oracle driver major version must match the database major version, and the driver version must not be smaller than the database version.
SAP does not support Oracle 8i drivers.
Is it not possible to connect to my DB? Is SAP supports the connection to 8i oracle database? any idea,,,
Regards,
Sunil.Hi,
Following is the connection string that we are currently using for connecting to Oracle 8i.
This setting has been working for us. give it a try.
connection string : jdbc:oracle:oci8:userid/password@server
Note that this connection string is only if you use the Oracle OCI driver. The OCI driver requires a shared library or DLL on the server.
The thin driver for Oracle is more commonly used as it doesn't require any additional libraries. The connection string is as already listed above:
jdbc.oracle.thin:@server:port:SID
There is no need to put the user and password into the connection string in the adapter config, putting it into the user and password fields works just fine.
Regards,
Suryanarayana -
Error when connecting an oracle DB with Integration gateway
I followed the steps from the blog How to connect an Oracle DB with Integration Gateway in SMP3 and the ojdbc was deployed successfully to SMP. Still, i'm getting "Driver class oracle.jdbc.driver.OracleDriver not found" error message when i try to test my connection. The first difference i saw when completing these steps was that I'm using SMP3 SP05, could this be the issue?
Joao D Franco Net
Could you share below information:
Can you cross check if deployed driver are OSGi enabled? Refer this.
Can you share screenshot of the destination settings and error ?
note: The blog you followed is referring to SP03 (1st GA of SMP3)..You should not have any problem in connecting to Oracle DB being on any SP.
Regards,
JK -
Cannot connect to Oracle 8i with IIOP from JDev3.1
Hi,
I have the problem of connect to Oracle 8i with IIOP from JDeveloper 3.1 when I build application with BC4J. I can connect to my Oracle 8i database with ODBC easily but failed with IIOP. Does anyone here has the same experience?
Any help will be appreciated. Thank you.
nullHi Daniel:
I've solved the problem mentioned above. It requires two settings:
I) Enabling Multithreaded Server Support for IIOP Clients;
II) Listener's listening to port 2481
Of course you should have installed JServer into your Oracle 8i database.
In your init.ora file, you should have the following two lines:
mts_dispatchers = "(PROTOCOL=TCP)(PRE=oracle.aurora.server.SGiopServer)"
mts_dispatchers = "(protocol=TCP)"
To confirm this you may use SQLPLUS to list the parameters of the database setting:
mts_dispatchers string (PROTOCOL=TCP)(PRE=oracle.aurora.server.SGiopServer), (protocol=TCP)
mts_servers integer 1
And in TNSnames.ora file the setting should like this:
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = wangsvr)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = wangsvr)(PORT = 2481))
All these two settings ( init.ora and tnsnames.ora ) can be done with "Database Configuration Assistant" and "Net8 Assistant"
I solved my problem this way, your problem may not the same but anyway you may try it.
null -
Local oracle access with jdbc thin
hello there
it need help despratly,
im developing an applet to talk to remote oracle dbs using jdbc
thin
but i also want an applet to be able to talk to a local oracle db
on the same hardisk.
for a remote connection the follwing stringis used at my
university
static final String connect_string =
"jdbc:oracle:thin:scott/[email protected]:1521:DSC1";
but what do i subsitute for thr host as i want to access the db
on my hard disk?
i need as much help ASP, as im well behind my schedule for this
project.?
also i take it that to allow this and access to remote servers
other than the web server, the applet needs to be signed, is this
possible with jdk1.1.x compatble browsers?
yours
richard sergio marchesi
email - [email protected]
or
email - [email protected]
nullThe thin driver reqiures a TCP listener to be running. If you are
using Personal Oracle for the 'local' RDBMS then it doesn't have
a listener (with the default installation). Start the listener
and you should be able to connect. You will also want a local
webserver of some sort to serve the applet to you as well, but
anything (even TinyWeb) will do for that.
null -
I am connecting to an Oracle lite database on NT Server 4.0 with
JDBC and trying to run an simple insert statement. If I try to
run the same statement again (which should throw an exception
since the pk already exists) I get an application error - not an
exception as expected - I get the same thing when executing a
"delete from.." stmt on an empty table. These same stmts work
fine in Oracle8i.
Also, if I use access with ODBC to view the tables access will
often freeze up on me.
Any Help would be appreciated.
Dylan
nullYou probably mean if you can call a Java Stored Procedure from ADOCE application. PL/SQL packages are not supported in Oracle Lite database. The answer is no. For more information see Developers' Guide for WindowsCE, Chapter 4
-
Problem to establish connection between Oracle SQL and JDBC
Hi friends i have been trying this code from two days i donno whats wrong please try to sort the problem thank u in advance this is my program:
//This is my Connection class
package com.java.jdbc.util;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class EmployeeUtil {
public EmployeeUtil()
public static Connection getconnection()
Connection con=null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
//DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:ORANT","system","manager");
// Class.forName("sun.jdbc.odbc.OracleDriver").newInstance();
// con = DriverManager.getConnection("jdbc:odbc:Javatut","System","manager");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return con;
//This is my DB class:
package com.java.jdbc.DB;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import com.java.jdbc.info.EmployeeInfo;
import com.java.jdbc.util.EmployeeUtil;
public class EmployeeDB {
Connection connection=null;
public EmployeeDB()
//this.connection=EmployeeUtil.getconnection();
public void select(EmployeeInfo empinfo)
this.connection=EmployeeUtil.getconnection();
String stb = "select * from employee";
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(stb);
System.out.println(rs);
//EmployeeInfo empinfo = new EmployeeInfo();
while(rs.next())
empinfo.setEmpId(rs.getString(1));
empinfo.setEmpfName(rs.getString(2));
empinfo.setEmplName(rs.getString(3));
empinfo.setEmpAge(rs.getString(4));
empinfo.setEmpSalary(rs.getString(5));
System.out.println("The EmployeeID is : "+empinfo.getEmpfName());
System.out.println("The Employee First Name is : "+empinfo.getEmpfName());
System.out.println("The Employee Last Name is : "+empinfo.getEmplName());
System.out.println("The Employee Age is : "+empinfo.getEmpAge());
System.out.println("The Employee Salary is : "+empinfo.getEmpSalary());
connection.commit();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
//This is my info object
package com.java.jdbc.info;
public class EmployeeInfo {
private String empId;
private String empfName;
private String emplName;
private String empAge;
private String empSalary;
public String getEmpAge() {
return empAge;
public void setEmpAge(String empAge) {
this.empAge = empAge;
public String getEmpfName() {
return empfName;
public void setEmpfName(String empfName) {
this.empfName = empfName;
public String getEmpId() {
return empId;
public void setEmpId(String empId) {
this.empId = empId;
public String getEmplName() {
return emplName;
public void setEmplName(String emplName) {
this.emplName = emplName;
public String getEmpSalary() {
return empSalary;
public void setEmpSalary(String empSalary) {
this.empSalary = empSalary;
//This is my Controller class:
package com.java.jdbc.controller;
import com.java.jdbc.DB.EmployeeDB;
import com.java.jdbc.info.EmployeeInfo;
public class EmployeeController {
public static void main(String args[])
EmployeeDB empdb = new EmployeeDB();
EmployeeInfo emp = new EmployeeInfo();
empdb.select(emp);
// I got these errors:
java.sql.SQLException: Io exception: Got minus one from a read call
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:114)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:156)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:210)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:251)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:224)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.java.jdbc.util.EmployeeUtil.getconnection(EmployeeUtil.java:18)
at com.java.jdbc.DB.EmployeeDB.select(EmployeeDB.java:20)
at com.java.jdbc.controller.EmployeeController.main(EmployeeController.java:11)
Exception in thread "main" java.lang.NullPointerException
at com.java.jdbc.DB.EmployeeDB.select(EmployeeDB.java:23)
at com.java.jdbc.controller.EmployeeController.main(EmployeeController.java:11)Are you using Oracle 10.2 in shared server configuration under Windows?
If so it's a driver bug (BUG - Connection pooling with 10g 10.1.3 Preview 4 App Server Oracle suggest to use OCI driver. -
Problem etablishing connection between oracle SQL and JDBC
Hi friends i have been trying this code from two days i donno whats wrong please try to sort the problem thank u in advance this is my program:
//This is my Connection class
package com.java.jdbc.util;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class EmployeeUtil {
public EmployeeUtil()
public static Connection getconnection()
Connection con=null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
//DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:ORANT","system","manager");
// Class.forName("sun.jdbc.odbc.OracleDriver").newInstance();
// con = DriverManager.getConnection("jdbc:odbc:Javatut","System","manager");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return con;
//This is my DB class:
package com.java.jdbc.DB;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import com.java.jdbc.info.EmployeeInfo;
import com.java.jdbc.util.EmployeeUtil;
public class EmployeeDB {
Connection connection=null;
public EmployeeDB()
//this.connection=EmployeeUtil.getconnection();
public void select(EmployeeInfo empinfo)
this.connection=EmployeeUtil.getconnection();
String stb = "select * from employee";
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(stb);
System.out.println(rs);
//EmployeeInfo empinfo = new EmployeeInfo();
while(rs.next())
empinfo.setEmpId(rs.getString(1));
empinfo.setEmpfName(rs.getString(2));
empinfo.setEmplName(rs.getString(3));
empinfo.setEmpAge(rs.getString(4));
empinfo.setEmpSalary(rs.getString(5));
System.out.println("The EmployeeID is : "+empinfo.getEmpfName());
System.out.println("The Employee First Name is : "+empinfo.getEmpfName());
System.out.println("The Employee Last Name is : "+empinfo.getEmplName());
System.out.println("The Employee Age is : "+empinfo.getEmpAge());
System.out.println("The Employee Salary is : "+empinfo.getEmpSalary());
connection.commit();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
//This is my info object
package com.java.jdbc.info;
public class EmployeeInfo {
private String empId;
private String empfName;
private String emplName;
private String empAge;
private String empSalary;
public String getEmpAge() {
return empAge;
public void setEmpAge(String empAge) {
this.empAge = empAge;
public String getEmpfName() {
return empfName;
public void setEmpfName(String empfName) {
this.empfName = empfName;
public String getEmpId() {
return empId;
public void setEmpId(String empId) {
this.empId = empId;
public String getEmplName() {
return emplName;
public void setEmplName(String emplName) {
this.emplName = emplName;
public String getEmpSalary() {
return empSalary;
public void setEmpSalary(String empSalary) {
this.empSalary = empSalary;
//This is my Controller class:
package com.java.jdbc.controller;
import com.java.jdbc.DB.EmployeeDB;
import com.java.jdbc.info.EmployeeInfo;
public class EmployeeController {
public static void main(String args[])
EmployeeDB empdb = new EmployeeDB();
EmployeeInfo emp = new EmployeeInfo();
empdb.select(emp);
// I got these errors:
java.sql.SQLException: Io exception: Got minus one from a read call
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:114)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:156)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:210)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:251)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:224)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.java.jdbc.util.EmployeeUtil.getconnection(EmployeeUtil.java:18)
at com.java.jdbc.DB.EmployeeDB.select(EmployeeDB.java:20)
at com.java.jdbc.controller.EmployeeController.main(EmployeeController.java:11)
Exception in thread "main" java.lang.NullPointerException
at com.java.jdbc.DB.EmployeeDB.select(EmployeeDB.java:23)
at com.java.jdbc.controller.EmployeeController.main(EmployeeController.java:11)Are you using Oracle 10.2 in shared server configuration under Windows?
If so it's a driver bug (BUG - Connection pooling with 10g 10.1.3 Preview 4 App Server Oracle suggest to use OCI driver. -
I met an error when connect to oracle db with tag sql:DataSource
When I use the jstl tag <sql:DataSource> connect to oracle db ,I met an error as :
javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver"
My Source code as follow:
<sql:setDataSource var="dataSource" driver="oracle.jdbc.driver.OracleDriver" url="jdbc:oracle:thin:@192.168.1.220:1521:gzserver" scope="request" user="lnmisscall" password="lnmcadmin"/>
<sql:query dataSource="{$dataSource}" var="data">
I am sure the connection information are right (I can connecte to the db with them in jsp & java bean) , and I have put the oracle's jdbc driver under the tomcat/common/lib folder,
Please help me to fit it ,thanks.Sabrina,
Its all dependent on the application and whether its 32-bit or 64-bit. For example, SSRS reporting services 2008 R2 is a 64-bit application, so load the 64-bit oracle client there for report execution. Report builder is a 32-bit client application,
assuming its running on a different machine, so load the 32-bit oracle client on any user computers using RB 3.0 and working with Oracle. If the computers are one in the same, then do as the post above says, load both... -
[b]Connection to Oracle DB per JDBC URGENT HELP NEEDED PLEASE![/b]
Hallo,
I'm a newbie. I want to make a connection to the oracle db on the server and I have been having serious problems. See CODE and ERROR MESSAGEs below:
import java.sql.*;
public class SqlConnection01 {
public static void main(String[] args) {
Connection con = null;
Statement stmt = null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver"); //Loading the Oracle Driver.
con = DriverManager.getConnection
("jdbc:oracle:thin:@38.218.2.227:1521:testdb","data","test"); //making the connection.
stmt = con.createStatement ();// Sending a query to the database
ResultSet rs = stmt.executeQuery("SELECT mand,kost,ktest,kok FROM test");
while (rs.next()) {
String mandt = rs.getString("1");
String kostl = rs.getString("2");
String ktest = rs.getString("3");
String kokrs = rs.getString("4");
System.out.println( mandt + kostl ktest kokrs );
} catch(Exception e) {
e.printStackTrace();
} finally {
try
if(stmt != null) stmt.close();
if(con != null) con.close();
} catch (Exception exception) {
exception.printStackTrace();
ERROR MESSAGE:
java.sql.SQLException: Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=153092352)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:334)
at oracle.jdbc.ttc7.TTC7Protocol.handleIOException(TTC7Protocol.java:3695)
at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:352)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:362)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:536)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:328)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at SqlConnection01.main(SqlConnection01.java:24)
What am I doing wrong here. I am using Oracle9i client installed on my pc (Release 2 (9.2.0.1.0) for Windows ) so I downloaded the ojdbc14 drivers for this version and I copied them in my bin directory C:\j2sdk1.4.2_06\bin\ojdbc14 .
Secondly I can connect to the db per command line( sqlplus /nolog; conn data/test@testdb) and querry the testdb.
I can also test the connection using oracle Net Manager and the test is successful.
But I can't start up the lsnrctl on my pc.I get this message any time i issue the command(C:\>lsnrctl
'lsnrctl' is not recognized as an internal or external command, operable program or batch file.)
What am I doing wrong here? What should I do to have this connection possible. Thanks very much in advance.oh sure! Below is the TNSNAMES I copied from my PCfound in(C:\oracle\ora92\network\admin\SAMPLE) The next thing could be how could I get access to the TNSNAMES on the server?
STARTS HERE:
<alias>= [ (DESCRIPTION_LIST = # Optional depending on whether u have
# one or more descriptions
# If there is just one description, unnecessary ]
(DESCRIPTION=
[ (SDU=2048) ] # Optional, defaults to 2048
# Can take values between 512 and 32K
[ (ADDRESS_LIST= # Optional depending on whether u have
# one or more addresses
# If there is just one address, unnecessary ]
(ADDRESS=
[ (COMMUNITY=<community_name>) ]
(PROTOCOL=tcp)
(HOST=<hostname>)
(PORT=<portnumber (1521 is a standard port used)>)
[ (ADDRESS=
(PROTOCOL=ipc)
(KEY=<ipckey (PNPKEY is a standard key used)>)
[ (ADDRESS=
[ (COMMUNITY=<community_name>) ]
(PROTOCOL=decnet)
(NODE=<nodename>)
(OBJECT=<objectname>)
... # More addresses
[ ) ] # Optional depending on whether ADDRESS_LIST is used or not
[ (CONNECT_DATA=
(SID=<oracle_sid>)
[ (GLOBAL_NAME=<global_database_name>) ]
[ (SOURCE_ROUTE=yes) ]
(DESCRIPTION=
[ (SDU=2048) ] # Optional, defaults to 2048
# Can take values between 512 and 32K
[ (ADDRESS_LIST= ] # Optional depending on whether u have more
# than one address or not
# If there is just one address, unnecessary
(ADDRESS
[ (COMMUNITY=<community_name>) ]
(PROTOCOL=tcp)
(HOST=<hostname>)
(PORT=<portnumber (1521 is a standard port used)>)
[ (ADDRESS=
(PROTOCOL=ipc)
(KEY=<ipckey (PNPKEY is a standard key used)>)
... # More addresses
[ ) ] # Optional depending on whether ADDRESS_LIST
# is being used
[ (CONNECT_DATA=
(SID=<oracle_sid>)
[ (GLOBAL_NAME=<global_database_name>) ]
[ (SOURCE_ROUTE=yes) ]
[ (CONNECT_DATA=
(SID=<oracle_sid>)
[ (GLOBAL_NAME=<global_database_name>) ]
... # More descriptions
[ ) ] # Optional depending on whether DESCRIPTION_LIST is used or not
I think this is the example of what is in the TNSNAMES. It hasn't got the infos I need here.It just explain. -
Use of Complex Oracle Object with JDBC
How can I use Oracle Object(or PL/Sql type) with JDBC
I have a structure of record with some attributes and table of another attribute.
My types are defined as follows !
<code>
CREATE TYPE EMPLOYEE_GRADES AS TABLE OF VARCHAR2(50)
CREATE TYPE EMPLOYEES AS OBJECT(EmpName VARCHAR2(50), EmpGrades Employee_Grades)
</code>
My custom object might have the following structure (or should it be different)
<code>
public class EmpColl implements CustomDatum, CustomDatumFactory
-- other stuff ----
/* fields */
public String empName;
public Collection empNos;
</code>
I want to pass an variable of type EMPLOYEES to an procedure.
Thanx in Advance
Chetan
[email protected]<code>
CREATE TYPE EMPLOYEE_GRADES AS TABLE OF VARCHAR2(50)
CREATE TYPE EMPLOYEES AS OBJECT(EmpName VARCHAR2(50), EmpGrades Employee_Grades)
</code>The easiest is to use JPublisher (which comes with the SQLJ distribution).
Say:
jpub -user=username/password -sql=EMPLOYEES:Employees,EMPLOYEE_GRADES:EmployeeGrades
You will get (among others) the Java files Employees.java and EmployeeGrade.java. Go ahead, compile and use them.
Look in [Oracle Home]/sqlj/demo/jpub for a number of additional examples, and in the JPublisher User's Guide for background info.
The next (9.2) release of JPublisher will also provide some support for accessing legacy PL/SQL types from Java. -
Connect to oracle database with php script
Hello!
How can I connect to an Oracle database with a PHP script? I read about it at www.php.net:
"Oracle 8 functions; These functions allow you to access Oracle8 and Oracle7 databases. It uses the Oracle8 Call-Interface (OCI8). You will need the Oracle8 client libraries to use this extension."
Where can I get these libraries from?
Who knows more about the issue?
Thanks a lot for your help!
Martin
nullHello
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by mheibel([email protected]):
Hello!
How can I connect to an Oracle database with a PHP script? I read about it at www.php.net:
"Oracle 8 functions; These functions allow you to access Oracle8 and Oracle7 databases. It uses the Oracle8 Call-Interface (OCI8). You will need the Oracle8 client libraries to use this extension."
Where can I get these libraries from?
Who knows more about the issue?
Thanks a lot for your help!
Martin<HR></BLOCKQUOTE>
Install and put working a sqlnet working client (install the Oracle Client option of the Oracle Database CD ROM). Than compile php with the --oci option. Than try the samples in php.net (oci function in the help).
These are the steps... Put everything working is a little more complicated...
FS
null -
Error while connecting to Oracle db using jdbc
When I try to execute a java class which has to access data in
the Oracle db using Jdbc connection, get an error --
Appln- pathname/filename is attempting to call the OCI function
(opinit) this function does not exist in ORA72.DLL.
Exit this appln ? Yes or No
Both oracle db & java are on the same PC.Would like to know what
can be done to rectify this.
Thanks.
nullThe OCI driver 7.3 requires the 7.3 OCI to be installed (this is
part of the client required support files or RSF). The particular
call in question wasn't added to the OCI untill 7.3 so it
wouldn't exist in the 7.2 OCI library.
null
Maybe you are looking for
-
Out of the blue, about 2 weeks ago all of my contacts, calendars and notes disappeared. Messages are only displayed by the phone # they came from, not with contact's name. When sending email I can type part of the email address in and the email fro
-
How to fix missing entries in the printing preferences of Adobe PDF
Hi all, we are on Acrobat Pro 8 (8.16) as part of the CS3 Design Standard package. A colleague of mine is missing some of the entries in the printing preferences of the Adobe PDF printer: The Adobe PDF Security dropdown is empty and he can't set the
-
Windows 2008R2 OEM compatibility
Hi there, After finally getting MSA Storage and VMware installed, now looking to setup my VM's. I have 2008R2 OEM licences as purchased with my HP DL380G6 Host Server. Do these work with VMware and what are my options if they don't?! Cheers, Matt
-
Maintenance Optimizer - Can't create new transaction
Hi, My SolMan system is at SP15 on the ABAP stack and due to project politics the Java stack is at 12 I use the maint Opt transaction quite often due to a upgrade project we are undergoing and it seems that when i create a new Maint Opt transaction a
-
What do I do when I get the message "the iPod could not be restored because it is busy?
Hi...I'm trying to restore my iPod to the orignal factory settings, but keep receiving the message that the iPod could not be restored because it is busy.