Oracle 8.1.7 connected to MS sql 7 through transparence Gateway
I did a query that insert data in Oracle from MS sql Server via a db link (TS3g)
The Gateway is configurated correctly but when i tryed to commit my transaction the next error appear.
commit
ERROR at line 1:
ORA-02050: transaction 6.1.56725 rolled back, some remote DBs may be in-doubt
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
[Transparent gateway for MSSQL]rc = -1
ORA-02063: preceding 2 lines from TS3G
Does anybody know what does it mean?
Thanks for your help.
Paul,
Looks like the gateway is not configured properly. Please take a look at the gateway manual for more information on 'Configuring for Two-Phase Commit'.
If this does not help please contact Oracle support and they should be able to help you resolve the issue.
Vira
Similar Messages
-
DB SCHEMA INFO error when connecting to AZURE SQL through OLE DB
Created a virtual machine in Azure and connected to Azure SQL server. I have been able to access the Azure SQL server through 2014 SQL Server Management Studio.
I have connected my program to the Azure SQL through a OLE DB connection. I am able to connect and create a new database through this connection, however when I try to connect to the newly created database, i get the following error:
Error creating connection: Not a Market(our product) database: Invalid object name 'db_schema_info'.
I am not sure what is going on and why this error is showing up. Is it because of the OLE DB connection? The fact that the login mysql.database.windows.net has periods and a login login@mysql? I have had issues with punctuation in the past when connecting
through OLE DB. Please help me to either find the right code or another work around option.
I can connect my program to a local SQL server hosted on the VM the same process as above without any issues. This is not a viable option as I need to connect multiple VMs to the same SQL server.Hi,
Thanks for posting here.
Connecting to Microsoft Azure SQL Database by using OLE DB or ADO is not supported on SQL Azure.
Ref: http://www.connectionstrings.com/sql-azure/
Microsoft does not announce support for OLE DB connections to Azure and there are limitations. Some required OLE DB schema rowsets are not available from an Azure connection, and some properties that identify features in SQL Server are not adjusted to represent
SQL Azure limitations. For most common connect/query/update tasks it seems to work fine.
Provider=SQLNCLI11;Password=myPassword;User ID=[username]@[servername];
Initial Catalog=databasename;Data Source=tcp:[servername].database.windows.net;
Ref: http://msdn.microsoft.com/en-us/library/azure/ee336245.aspx
You can also check
Connectivity Considerations for SQL Server in Azure Virtual Machines
Hope this helps you.
Girish Prajwal -
Error -While create a connection to Microsoft SQL Sever from Oracle SQL Dev
Dear All,
While I am trying to create a connection to Microsoft SQL Sever from Oracle SQL Developer. The following error: "Cannot connect to Microsoft SQL Server on localhost" has been occurred.
Can anyone please guide me to solve this..
Thanks in advance,
RiderHi,
Issue not supported in sharepoint on-premise team.
In addition, as this issue is related to Powerview, I suggest you create a new thread on for Powerview forum, more experts will assist you.
https://social.technet.microsoft.com/Forums/en-US/home?forum=powerview
Best Regards,
Lisa Chen
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected] -
How to connect to a Sql server from Oracle using db link
Hi All,
Does anybody have any idea about how to connect to a sql server from oracle database using db link to syncronize the data? I need to pull the data from Sql server table to Oracle tables and relay messages back to the sql server.
Thank you,
Praveen.we have 2 products - DG4MSQL and DG4ODBC.
DG4ODBC is for free and requires a 3rd party ODBC driver and it can connect to any 3rd party database as long as you use a suitable ODBC driver
DG4MSQL is more powerfull as it is designed for MS SQL Server databases and it supports many functions it can directly map to SQL Server equivalents - it can also call remote procedures or participtae in distributed transactions. Please be aware DG4MSQL requires a license - it is not for free.
Check out Metalink and you'll find notes how to configure both products.
For a generic overview:
Note.233876.1 Options for Connecting to Foreign Data Stores and Non-Oracle Databases
And the setup notes:
DG4ODBC
Note.561033.1 How to Setup DG4ODBC on 64bit Unix OS (Linux, Solaris, AIX, HP-UX) :
Note.466225.1 How to Setup DG4ODBC (Oracle Database Gateway for ODBC) on Windows 32bit RDBMS.HS-3-2 :
Note.109730.1 How to setup generic connectivity (HSODBC) for 32 bit Windows (Windows NT, Windows 2000, Windows XP, Windows 2003) V817:
Note.466228.1 How to Setup DG4ODBC on Linux x86 32bit
DG4MSQL
Note.466267.1 How to Setup DG4MSQL (Database Gateway for MS SQL Server) on Windows 32bit
Note.562509.1 How to Setup DG4MSQL (Oracle Database Gateway for MS SQL Server) 64bit Unix OS (Linux, Solaris, AIX,HP-UX)
Note.437374.1 How to Setup DG4MSQL (Oracle Database Gateway for MS SQL Server) Release 11 on Linux -
Oracle 10.2 on AIX -- need to connect to remote SQL server by dblink
oracle 10.2 on AIX -- need to connect to remote SQL server by dblink
i didn't see a odbc diectory in our oracle home path. how do i know odbc driver is installed in the oracle on our AIX server.
If it is there, do i just need to modify the odbc.ini and then the inithsodbc.ora, linster.ora, tnsnammes.ora files, or am I missing something
Appreciate your response
Edited by: user10876711 on May 12, 2011 9:18 AM
Edited by: user10876711 on May 12, 2011 9:18 AMwhen you want to connect from Oracle to a SQl Server you need the Oracle Gateway (HSODBC or even better Dg4ODBC) and a FOREIGN ODBC DRIVER for your foreign database - a SQL Server ODBC driver. You have to get this driver from a 3rd party vendor - Oracle does not offer any foreign ODBC drivers.
So before being able to use DG4ODBC/HSODBC you need to install from a 3rd paryt vendor a SQL Server ODBC driver. Commercial vendrs are for example Data Direct, Openlink or Easysoft.
On Unix ODBC drivers commonly also require a driver manager. If the ODBC driver vendor does not ship one with the ODBC driver you can get it from www.unixodbc.org -
*** ERROR = CONNECT failed with SQL error '12154' after Oracle Upgrade
Hello Experts,
Recently I upgraded my oracle database from 11.2.0.3 to 11.2.0.4.The upgrade completed successfully but I am unable to start the instance.
R3trans -d failing with the error--
OCIServerAttach(OCI_DEFAULT) failed with -1=OCI_ERROR
OCIServerAttach(OCI_DEFAULT) failed with SQL error 12154:
ORA-12154: TNS:could not resolve the connect identifier specified
OCIServerAttach(con=0, svc=069C1630): Error 12154 attaching new srv=069C17D0
OCIHandleFree(con=0): Server handle srv=069C17D0 freed.
server_detach(con=0, svc=069C1630; srv=NULL, stale=2)
OCIHandleFree(con=0): Service svc=069C1630 freed (i=1).
*** ERROR => CONNECT failed with SQL error '12154'
-->oci_get_errmsg (con=0, rc=12154)
OCIErrorGet() -> SQL error code: 12154; buflen=66
OCIErrorGet(): error text ->
ORA-12154: TNS:could not resolve the connect identifier specified
ocica() -> SQL error code 12154,12154
DbSlConnect(con=0) -> orc=12154, rc=99=DBSL_ERR_DB
***LOG BY2=>sql error 12154 performing CON
***LOG BY0=>ORA-12154: TNS:could not resolve the connect identifier specified
I have checked listener is up and running properly.Entry is maintained in tnsnames.ora.
Also kernel is upgraded with latest path.Curent kernel version--742
Please suggest on the mentioned error.I am attaching the logs here.Thanks in advance.
Best Regards,
DebadityaHi Debadiya
Kindly check this SAP Notes
1204916 - Error: "ORA-12154" when connecting to Oracle from a Windows 64-bit platform
2153975 - Database connectivity fails with ORA-12154
556232 - Environment settings for R/3/Oracle on Windows
443867 - ORA-12154 Collective SAP note
BR
SS -
Connect to MS-SQL Server from a Oracle 10g running under Solaris
Hi,
I have the following problem. I want to access a MS-SQL server from an Oracle database (10g Enterprise licence) that is running on Solaris.
After googling a while, the following questions arise:
- Is it correct that the Oracle Transparant Gateway for the SQL Server is not available on Solaris platforms (but only on Windows)?
- Is it right, that the second possibility to solve this problem is to use an SQL-Server odbc driver for Solaris and access the SQL-Server over ODBC? And: Is this feature included in the Enterprise licence?
- If yes, which driver is good and cheap ;-)?
- Is there any other way to solve this problem?
Thanks
Aron
Message was edited by:
user583720I believe the Transparenet Gateway for SQL Server is available on Solaris. The problem is that you need a Unix based ODBC driver which you will also need to pay for.
We had this same problem and decided to run a windows based Heterogeneous Services gateway and routed through it instead of using the SQL Server transparent gateway. The Heterogenous severives gateway is NOT an add on product (as is Transparent Gateway). The drawback would be performance as I would expect the native MS SQL transparent gateway to perform better, but in our case it worked acceptably. -
Connecting Oracle 9i as a linked server of SQL Server 2000
I have a problem inserting String values into Oracle 9i as a linked server or SQL Server 2000.
When I run the following in SQL Analyzer:
insert into ORACLEOLE..ADMIN.FM_SQL values('asdf','qwer');
The result msg is:
Server: Msg 7356, Level 16, State 1, Line 1
OLE DB provider 'OraOLEDB.Oracle' supplied inconsistent metadata for a column. Metadata information was changed at execution time.
OLE DB error trace [Non-interface error: Column 'FM_ID' (compile-time ordinal 1) of object '"ADMIN"."FM_SQL"' was reported to have a DBTYPE of 129 at compile time and 130 at run time].
Is this a problem that the Charaterset of Oracle 9i being 'ALU32UTF8' ?
I have tried changing the field's type to varchar2, char, nvarchar2 and nchar...and they didn't work.
However, when the field type is a number(10) and I insert to the table integer values, the sql works fine.
so..any data mapping need to be done explicitly?
Thanks in advance.Based on my reading of the ANSI SQL-92 standards, table names are supposed to be in upper case.
"of course, any lower case letters appearing in a <regular identifier> will have been converted to the corresponding upper case letter before the <identifier> is stored in any table of the Information Schema"
http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt
Given that table names are supposed to be in upper case and they are in fact in upper case, why don't you just ask for them in upper case in the first place? -
Error while connecting oracle11g to sql server through transparent gateway
Hello
i'm facing this errors when i try to connect oracle 11g to sql server through transparent gateway:
http://www.freeimagehosting.net/newuploads/d4454.jpg
the directory for my db is : C:\oracle\product\11.1.0\db1
and for the gateway: C:\oracle\product\11.1.0\dg4msql
the configurations i used:
gateway :
tnsnames.ora:
dg4msql =
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=Kinda-PC)(PORT=1522))
(CONNECT_DATA=(SID=dg4msql))
(HS=OK)
listener.ora:
GATELIST =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = Kinda-PC)(PORT = 1522))
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1522))
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(PROGRAM = dg4msql)
(SID_NAME = dg4msql)
(ORACLE_HOME = C:\oracle\product\11.1.0\dg4msql)
and for the oracle database :
listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = Kinda-PC)(PORT = 1521))
tnsnames.ora:
DB1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = Kinda-PC)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = db1)
gateway =
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=Kinda-PC)(PORT=1522))
(CONNECT_DATA=(SID=dg4msql)
(HS=OK)
thanks :)
Edited by: 903043 on Dec 18, 2011 6:18 AMDid you go through the various steps in the doc?
There is a gateway specific forum below;
Heterogeneous Connectivity
Cheers
David -
Java Concurrent Program - connecting to MS SQL Server
Hi,
I hope this is correct forum to post this question.
I am writing a JCP which will connect to a MS SQL Server DB, pull data from a table and populate this data into a custome table in EBS (R12.1.1) database. But I am facing some issues.
When I run run this concurrent program from EBS, I get following exception message:
Wed Aug 08 01:18:04 GMT 2012: In openConection()
Wed Aug 08 01:18:04 GMT 2012: Before Loading Driver com.microsoft.jdbc.sqlserver.SQLServerDriver
Wed Aug 08 01:18:04 GMT 2012: openConection() ClassNotFoundException: java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver
Wed Aug 08 01:18:04 GMT 2012: Before Calling processPrintMachineRecords()
Wed Aug 08 01:18:04 GMT 2012: Exception:: java.lang.NullPointerException
Wed Aug 08 01:18:04 GMT 2012: In closeSQLServerConnection().......closing JDBC Connection
Wed Aug 08 01:18:04 GMT 2012: Connection object was null, hence skipping close
Wed Aug 08 01:18:04 GMT 2012: After Calling processPrintMachineRecords()
The I read somewhere on internet that I should set CLASSPATH in options field of concurrent program definition. So I provided classpath as follows:
-cp /rs01/u02/applmgr/utyeb02/apps/apps_st/appl/au/12.0.0/appsborg.zip:/rs01/u02/applmgr/utyeb02/apps/apps_st/comn/java/classes/apps.zip:/rs01/u02/applmgr/utyeb02/apps/apps_st/comn/java/classes/sqljdbc_4.0/enu/sqljdbc.jar
In this classpath sqljdbc.jar contains the classes for connecting to MS SQL Server DB. However after giving classpath like this I started getting different error:
Exception in thread "main" java.lang.NoClassDefFoundError: oracle/apps/fnd/cp/request/Run
Caused by: java.lang.ClassNotFoundException: oracle.apps.fnd.cp.request.Run
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
It appears from the error message that after giving this CLASSPATH, program was not able to find the "Run" method itself. In otherwords, CLASSPATH screwed it further.
Can anybody please point out what am I doing wrong here?
Regards
Java Code:
package oracle.apps.custom.printmachine;
import java.sql.*;
import oracle.apps.fnd.cp.request.* ;
import java.io.*;
import oracle.apps.fnd.util.*;
public class PrintMachineInterface implements JavaConcurrentProgram {
public static final String M_SUCCESS = "SUCCESS";
public static final String M_ERROR = "ERROR";
public static final String M_WARNING = "WARNING";
int mRequestStatus = -1;
int max_number_of_records = 99999999;
private String mSqlServerHost = "mysqlserver.domain.com";
// Application Short Name
private String applName;
CpContext mCtx;
LogFile logFile;
OutFile outFile;
Connection mConn = null;
ReqCompletion lRC;
public PrintMachineInterface(){
// if no parameter value is specified for APPLNAME then use FND
//as default value
applName = "FND";
private void logMessage(String str) {
java.util.Date now = new java.util.Date();
logFile.writeln(now.toString() + ": " + str, LogFile.STATEMENT);
static String mInsertRecord = " Declare " + " BEGIN "
+ " INSERT INTO XXGFN_GBL_CE_PM_STAGE(ID, KEY, FILENAME, PRINTED_AT, CREATED_AT, DOCTYPE, LANGUAGE, OU, TRX_ID, DOC_ID, REQ_ID, TEMPLATE, PAGES, DOC_TEXT, TIMES_RECEIVED)"
+ " VALUES (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, substr(:14,2000), :15);"
+ " COMMIT;"
+ " END;";
static Connection con = null;
public void openConection() {
logMessage( "In openConection()");
try {
logMessage( "Before Loading Driver com.microsoft.jdbc.sqlserver.SQLServerDriver");
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
logMessage( "After Loading Driver com.microsoft.jdbc.sqlserver.SQLServerDriver");
logMessage( "Attempting to connect to " + mSqlServerHost);
con = DriverManager.getConnection("jdbc:microsoft:sqlserver://" + mSqlServerHost + ":1433;User=sql_user;Password=sql_pwd");
logMessage( "After con assigned from getConnection(jdbc:microsoft:sqlserver://" + mSqlServerHost + ":1433;User=pm_dba_access;Password=*****");
} catch (java.lang.ClassNotFoundException e) {
logMessage("openConection() ClassNotFoundException: " + e);
} catch (SQLException ex) {
logMessage("openConection() SQLException: " + ex);
public void closeSQLServerConnection() {
try {
logMessage( "In closeSQLServerConnection().......closing JDBC Connection");
if (con != null)
logMessage( "Con is not null");
con.close();
logMessage( "Con Closed Successfully");
else
logMessage( "Connection object was null, hence skipping close");
} catch (SQLException ex) {
logMessage("SQLException: " + ex);
} catch (Exception ex) {
logMessage("Exception in closeSQLServerConnection() : " + ex);
private void populate_staging_table(
String p_id,
String p_key,
String p_filename,
String p_printed_at,
String p_created_at,
String p_doctype,
String p_language,
String p_ou,
String p_trx_id,
String p_doc_id,
String p_req_id,
String p_template,
String p_pages,
String p_doc_text,
String p_times_received
PreparedStatement lStmt = null;
logMessage("Populating data from PrintMachine history table");
try {
lStmt = mConn.prepareCall(mInsertRecord);
lStmt.setString(1, p_id);
lStmt.setString(2, p_key);
lStmt.setString(3, p_filename);
lStmt.setString(4, p_printed_at);
lStmt.setString(5, p_created_at);
lStmt.setString(6, p_doctype);
lStmt.setString(7, p_language);
lStmt.setString(8, p_ou);
lStmt.setString(9, p_trx_id);
lStmt.setString(10, p_doc_id);
lStmt.setString(11, p_req_id);
lStmt.setString(12, p_template);
lStmt.setString(13, p_pages);
lStmt.setString(14, p_doc_text);
lStmt.setString(15, p_times_received);
lStmt.execute();
lStmt.close();
} catch (SQLException s) {
logMessage("Exception thrown w/ error message: "
+ s.getMessage());
s.printStackTrace();
finally {
try {
if (lStmt != null)
lStmt.close();
} catch (SQLException e) {
logMessage("SQLException: " + e);
private void processPrintMachineRecords() {
int number_of_recs = 0;
try {
PreparedStatement stmt = con.prepareStatement("SELECT TOP 1000 ID, Key, Filename, PrintedAt, CreatedAt, Doctype, Language,OU, TransactionID, DocumentID, RequestID, Template, Pages, Documenttext, TimesReceived FROM PM_DATA.dbo.History" );
ResultSet rst = stmt.executeQuery();
while (rst.next()) {
number_of_recs++;
if (number_of_recs == max_number_of_records) break;
populate_staging_table(
rst.getString(1), rst.getString(2)
,rst.getString(3), rst.getString(4)
,rst.getString(5), rst.getString(6)
,rst.getString(7), rst.getString(8)
,rst.getString(9), rst.getString(10)
,rst.getString(11), rst.getString(12)
,rst.getString(13), rst.getString(14)
,rst.getString(15)
stmt.close();
rst.close();
mConn.commit();
} catch (SQLException ex) {
logMessage("SQLException: " + ex);
catch (Exception ex) {
logMessage("Exception:: " + ex);
closeSQLServerConnection();
public void runProgram(CpContext pCpContext) {
applName = "XXGFN";
String l_file_path = null;
mCtx = pCpContext;
//get handle on request completion object for reporting status
lRC = pCpContext.getReqCompletion();
// assign logfile
logFile = pCpContext.getLogFile();
// assign outfile
outFile = pCpContext.getOutFile();
// get the JDBC connection object
mConn = pCpContext.getJDBCConnection();
l_file_path = ((new File(outFile.getFileName())).getParent() == null ? ""
: (new File(outFile.getFileName())).getParent());
// get parameter list object from CpContext
ParameterList lPara = pCpContext.getParameterList();
while (lPara.hasMoreElements())
NameValueType aNVT = lPara.nextParameter();
if ( aNVT.getName().equals("APPLNAME") )
applName = aNVT.getValue();
/** openConection() Opens the connection to SQL Server Database*/
openConection() ;
logMessage("Before Calling processPrintMachineRecords()");
processPrintMachineRecords();
logMessage("After Calling processPrintMachineRecords()");
try{
setCompletion(ReqCompletion.NORMAL, "Request Completed Normal");
} catch (Exception e) {
setCompletion(ReqCompletion.ERROR, e.toString());
} finally {
pCpContext.releaseJDBCConnection();
* Sets the request completion status based on proper precedence. ERROR >
* WARNING > NORMAL
* @param pStatus
* Status of the request.
* @param pCompletionText
* Request's completion text.
public void setCompletion(int pStatus, String pCompletionText) {
if ((pStatus == ReqCompletion.ERROR)
|| ((pStatus == ReqCompletion.WARNING) && (mRequestStatus != ReqCompletion.ERROR))
|| ((pStatus == ReqCompletion.NORMAL)
&& (mRequestStatus != ReqCompletion.WARNING) && (mRequestStatus != ReqCompletion.ERROR))) {
mRequestStatus = pStatus;
lRC.setCompletion(pStatus, pCompletionText);
}ok
i used Template.java as input
useful MOS:
How To Create a Java Concurrent Program? [ID 827563.1]
Java Concurrent Program FAQ [ID 827575.1]
i used
//goto ms sql server 2008r2
try{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
con = java.sql.DriverManager.getConnection(
"jdbc:sqlserver://1.2.3.4:1433;databaseName=test;selectMethod=cursor",
"test", "test");
if(con!=null) System.out.println("Connection Successful!");
}catch(Exception e){
e.printStackTrace();
System.out.println("Error Trace in getConnection() : " + e.getMessage());
}1.2.3.4 - ip of instance with sqlserver2008r2 :)
in your code
>
try {
logMessage( "Before Loading Driver com.microsoft.jdbc.sqlserver.SQLServerDriver");
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
logMessage( "After Loading Driver com.microsoft.jdbc.sqlserver.SQLServerDriver");
logMessage( "Attempting to connect to " + mSqlServerHost);
con = DriverManager.getConnection("jdbc:microsoft:sqlserver://" + mSqlServerHost + ":1433;User=sql_user;Password=sql_pwd");
logMessage( "After con assigned from getConnection(jdbc:microsoft:sqlserver://" + mSqlServerHost + ":1433;User=pm_dba_access;Password=*****");
} catch (java.lang.ClassNotFoundException e) {
logMessage("openConection() ClassNotFoundException: " + e);
} catch (SQLException ex) {
logMessage("openConection() SQLException: " + ex);
>
try my case for Driver and Connection
put result .class file to needed directory
put sqljdbc4.jar to /rs01/u02/applmgr/utyeb02/apps/apps_st/comn/java/lib
and for concurrent program option
-classpath /rs01/u02/applmgr/utyeb02/apps/apps_st/comn/java/classes:/rs01/u02/applmgr/utyeb02/apps/apps_st/appl/au/12.0.0/appsborg.zip:/rs01/u02/applmgr/utyeb02/apps/apps_st/comn/java/lib/sqljdbc4.jaralso useful mos:
Classpath Setting of Third Party Jar Files in R12 Java Concurrent Program (JCP) [ID 1292694.1] -
Connect to MS SQL server from OWB on Linux platform
Hi,
I want to connect to MS SQL server through OWB, on Linux platform.
I suppose I would use JDBC driver, and Heterogeneous services. Is that possible?
I did not see anything on JDBC driver for MS SQL server for Linux platform from Oracle.
Also, I was wondering is Oracle Gateway 10g for Linux a way to connect to MSSQL server?
Any leads would be appreciated.
Thanks
AniHi,
This quite an actual topic for myself, so I decided to take some time to collect some information.
Start at:
* Oracle Generic Connectivity and Oracle Transparent Gateway - http://www.oracle.com/technology/products/gateways/gateways_fov.html
You can use the free Heterogenous Services component named Generic Connectivity for connecting to SqlServer over ODBC. You will need to find (or purchase?) a third-party ODBC driver for SqlServer for Linux, e.g. from www.datadirect.com. Setting this up will allow you to define a databaselink to the SqlServer. Open Gateways implements a limited set of the oracle SQL, so you will have to find out what is possible and what not.
See also:
* How To Setup HSODBC on Linux - https://metalink.oracle.com/metalink/plsql/showdoc?db=NOT&id=264567.1
* Generic Connectivity Available on Linux x86 with 10g - https://metalink.oracle.com/metalink/plsql/showdoc?db=NOT&id=261726.1
You can also use the Transparent Gateway for SqlServer (HS), which is about EURO 12000 per computer(!). This gives you a full implementation of Oracle SQL and you can access the SqlServer like it was Oracle.
You can also install Microsofts JDBC drivers into Oracle's JVM, and connect through JDBC to SqlServer. This is however not supported by Oracle, but it will work. See:
* What is required for a Java Stored Procedure to connect to a SQL Server Database? - https://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=276167.1
See also:
* Options for Connecting to Foreign Data Stores and Non-Oracle Databases - https://metalink.oracle.com/metalink/plsql/showdoc?db=NOT&id=233876.1
* JDBC Developer's Guide - http://download-west.oracle.com/docs/cd/B14117_01/java.101/b10979/overvw.htm
Good luck, Erik Ykema -
Connect to Microsoft SQL server 2012
HI,
Currently My OSB connects to MS SQL server to get some data and then construct the request to submit to another web service. But recently the SQL server that I connect to has upgraded(previously was MS SQL 2005) to MS SQL to 2012. There are certain properties that needs to be changed in the connection property(for example : ApplicationIntent=ReadOnly) and I am not sure where to change this connection property. I am using sqljdbc4.jar for connectivity. Please advice. This is a bit urgent and appreciate if someone can help me out ASAP.
After the upgrade I am not able to connect to the SQL server DB as well. This is the error
Invoke JCA outbound service failed with application error, exception: com.bea.wli.sb.transports.jca.JCATransportException: oracle.tip.adapter.sa.api.JCABindingException: oracle.tip.adapter.sa.impl.fw.ext.org.collaxa.thirdparty.apache.wsif.WSIFException: servicebus:/WSDL/SGH/LabResults/SCMLabService [ SCMLabService_ptt::SCMLabService(InputParameters,OutputParameters) ] - WSIF JCA Execute of operation 'SCMLabService' failed due to: Could not create/access the TopLink Session.
This session is used to connect to the datastore.
Caused by Exception [EclipseLink-7060] (Eclipse Persistence Services - 2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Cannot acquire data source [jdbc/myAPPConn].
Internal Exception: javax.naming.NameNotFoundException: Unable to resolve 'jdbc.myAPPConn'. Resolved 'jdbc'; remaining name 'myAPPConn'.
; nested exception is:
BINDING.JCA-11622
Could not create/access the TopLink Session.
This session is used to connect to the datastore.
Caused by Exception [EclipseLink-7060] (Eclipse Persistence Services - 2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Cannot acquire data source [jdbc/myAPPConn].
Internal Exception: javax.naming.NameNotFoundException: Unable to resolve 'jdbc.myAPPConn'. Resolved 'jdbc'; remaining name 'myAPPConn'.
You may need to configure the connection settings in the deployment descriptor (i.e. DbAdapter.rar#META-INF/weblogic-ra.xml) and restart the server. This exception is considered not retriable, likely due to a modelling mistake.
com.bea.wli.sb.transports.jca.JCATransportException: oracle.tip.adapter.sa.api.JCABindingException: oracle.tip.adapter.sa.impl.fw.ext.org.collaxa.thirdparty.apache.wsif.WSIFException: servicebus:/WSDL/SGH/LabResults/SCMLabService [ SCMLabService_ptt::SCMLabService(InputParameters,OutputParameters) ] - WSIF JCA Execute of operation 'SCMLabService' failed due to: Could not create/access the TopLink Session.
This session is used to connect to the datastore.
Caused by Exception [EclipseLink-7060] (Eclipse Persistence Services - 2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Cannot acquire data source [jdbc/myAPPConn].
Internal Exception: javax.naming.NameNotFoundException: Unable to resolve 'jdbc.myAPPConn'. Resolved 'jdbc'; remaining name 'myAPPConn'.
; nested exception is:
BINDING.JCA-11622
Could not create/access the TopLink Session.
This session is used to connect to the datastore.
Caused by Exception [EclipseLink-7060] (Eclipse Persistence Services - 2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Cannot acquire data source [jdbc/myAPPConn].
Internal Exception: javax.naming.NameNotFoundException: Unable to resolve 'jdbc.myAPPConn'. Resolved 'jdbc'; remaining name 'myAPPConn'.
You may need to configure the connection settings in the deployment descriptor (i.e. DbAdapter.rar#META-INF/weblogic-ra.xml) and restart the server. This exception is considered not retriable, likely due to a modelling mistake.
at com.bea.wli.sb.transports.jca.binding.JCATransportOutboundOperationBindingServiceImpl.invoke(JCATransportOutboundOperationBindingServiceImpl.java:155)
at com.bea.wli.sb.transports.jca.JCATransportEndpoint.sendRequestResponse(JCATransportEndpoint.java:209)
at com.bea.wli.sb.transports.jca.JCATransportEndpoint.send(JCATransportEndpoint.java:170)
at com.bea.wli.sb.transports.jca.JCATransportProvider.sendMessageAsync(JCATransportProvider.java:571)
at sun.reflect.GeneratedMethodAccessor1269.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.bea.wli.sb.transports.Util$1.invoke(Util.java:83)
at $Proxy143.sendMessageAsync(Unknown Source)
at com.bea.wli.sb.transports.LoadBalanceFailoverListener.sendMessageAsync(LoadBalanceFailoverListener.java:148)
at com.bea.wli.sb.transports.LoadBalanceFailoverListener.sendMessageToServiceAsync(LoadBalanceFailoverListener.java:603)
at com.bea.wli.sb.transports.LoadBalanceFailoverListener.sendMessageToService(LoadBalanceFailoverListener.java:538)
at com.bea.wli.sb.transports.TransportManagerImpl.sendMessageToService(TransportManagerImpl.java:558)
at com.bea.wli.sb.transports.TransportManagerImpl.sendMessageAsync(TransportManagerImpl.java:426)
at com.bea.wli.sb.test.service.ServiceMessageSender.send0(ServiceMessageSender.java:377)
at com.bea.wli.sb.test.service.ServiceMessageSender.access$000(ServiceMessageSender.java:76)
at com.bea.wli.sb.test.service.ServiceMessageSender$1.run(ServiceMessageSender.java:134)
at com.bea.wli.sb.test.service.ServiceMessageSender$1.run(ServiceMessageSender.java:132)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
at com.bea.wli.sb.security.WLSSecurityContextService.runAs(WLSSecurityContextService.java:55)
at com.bea.wli.sb.test.service.ServiceMessageSender.send(ServiceMessageSender.java:137)
at com.bea.wli.sb.test.service.ServiceProcessor.invoke(ServiceProcessor.java:454)
at com.bea.wli.sb.test.TestServiceImpl.invoke(TestServiceImpl.java:172)
at com.bea.wli.sb.test.client.ejb.TestServiceEJBBean.invoke(TestServiceEJBBean.java:167)
at com.bea.wli.sb.test.client.ejb.TestService_sqr59p_EOImpl.invoke(TestService_sqr59p_EOImpl.java:353)
at com.bea.wli.sb.test.client.ejb.TestService_sqr59p_EOImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:174)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:345)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
at com.bea.wli.sb.test.client.ejb.TestService_sqr59p_EOImpl_1033_WLStub.invoke(Unknown Source)
at com.bea.alsb.console.test.TestServiceClient.invoke(TestServiceClient.java:174)
at com.bea.alsb.console.test.actions.DefaultRequestAction.invoke(DefaultRequestAction.java:117)
at com.bea.alsb.console.test.actions.DefaultRequestAction.execute(DefaultRequestAction.java:70)
at com.bea.alsb.console.test.actions.ServiceRequestAction.execute(ServiceRequestAction.java:143)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.access$201(PageFlowRequestProcessor.java:97)
at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor$ActionRunner.execute(PageFlowRequestProcessor.java:2044)
at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors.wrapAction(ActionInterceptors.java:91)
at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processActionPerform(PageFlowRequestProcessor.java:2116)
at com.bea.alsb.console.common.base.SBConsoleRequestProcessor.processActionPerform(SBConsoleRequestProcessor.java:91)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processInternal(PageFlowRequestProcessor.java:556)
at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.process(PageFlowRequestProcessor.java:853)
at com.bea.alsb.console.common.base.SBConsoleRequestProcessor.process(SBConsoleRequestProcessor.java:191)
at org.apache.beehive.netui.pageflow.AutoRegisterActionServlet.process(AutoRegisterActionServlet.java:631)
at org.apache.beehive.netui.pageflow.PageFlowActionServlet.process(PageFlowActionServlet.java:158)
at com.bea.console.internal.ConsoleActionServlet.process(ConsoleActionServlet.java:256)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at com.bea.console.internal.ConsoleActionServlet.doGet(ConsoleActionServlet.java:133)
at com.bea.alsb.console.common.base.SBConsoleActionServlet.doGet(SBConsoleActionServlet.java:49)
at org.apache.beehive.netui.pageflow.PageFlowUtils.strutsLookup(PageFlowUtils.java:1199)
at org.apache.beehive.netui.pageflow.PageFlowUtils.strutsLookup(PageFlowUtils.java:1129)
at com.bea.portlet.adapter.scopedcontent.ScopedContentCommonSupport.executeAction(ScopedContentCommonSupport.java:687)
at com.bea.portlet.adapter.scopedcontent.ScopedContentCommonSupport.processActionInternal(ScopedContentCommonSupport.java:142)
at com.bea.portlet.adapter.scopedcontent.StrutsStubImpl.processAction(StrutsStubImpl.java:76)
at com.bea.portlet.adapter.NetuiActionHandler.raiseScopedAction(NetuiActionHandler.java:111)
at com.bea.netuix.servlets.controls.content.NetuiContent.raiseScopedAction(NetuiContent.java:181)
at com.bea.netuix.servlets.controls.content.NetuiContent.raiseScopedAction(NetuiContent.java:167)
at com.bea.netuix.servlets.controls.content.NetuiContent.handlePostbackData(NetuiContent.java:225)
at com.bea.netuix.nf.ControlLifecycle$2.visit(ControlLifecycle.java:180)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:324)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walk(ControlTreeWalker.java:130)
at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:395)
at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:361)
at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:352)
at com.bea.netuix.nf.Lifecycle.runInbound(Lifecycle.java:184)
at com.bea.netuix.nf.Lifecycle.run(Lifecycle.java:159)
at com.bea.netuix.servlets.manager.UIServlet.runLifecycle(UIServlet.java:388)
at com.bea.netuix.servlets.manager.UIServlet.doPost(UIServlet.java:258)
at com.bea.netuix.servlets.manager.UIServlet.service(UIServlet.java:199)
at com.bea.netuix.servlets.manager.SingleFileServlet.service(SingleFileServlet.java:251)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.AsyncInitServlet.service(AsyncInitServlet.java:130)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:330)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.doIt(WebAppServletContext.java:3684)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3650)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2268)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2174)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1446)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Caused by: oracle.tip.adapter.sa.api.JCABindingException: oracle.tip.adapter.sa.impl.fw.ext.org.collaxa.thirdparty.apache.wsif.WSIFException: servicebus:/WSDL/SGH/LabResults/SCMLabService [ SCMLabService_ptt::SCMLabService(InputParameters,OutputParameters) ] - WSIF JCA Execute of operation 'SCMLabService' failed due to: Could not create/access the TopLink Session.
This session is used to connect to the datastore.
Caused by Exception [EclipseLink-7060] (Eclipse Persistence Services - 2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Cannot acquire data source [jdbc/myAPPConn].
Internal Exception: javax.naming.NameNotFoundException: Unable to resolve 'jdbc.myAPPConn'. Resolved 'jdbc'; remaining name 'myAPPConn'.
; nested exception is:
BINDING.JCA-11622
Could not create/access the TopLink Session.
This session is used to connect to the datastore.
Caused by Exception [EclipseLink-7060] (Eclipse Persistence Services - 2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Cannot acquire data source [jdbc/myAPPConn].
Internal Exception: javax.naming.NameNotFoundException: Unable to resolve 'jdbc.myAPPConn'. Resolved 'jdbc'; remaining name 'myAPPConn'.
You may need to configure the connection settings in the deployment descriptor (i.e. DbAdapter.rar#META-INF/weblogic-ra.xml) and restart the server. This exception is considered not retriable, likely due to a modelling mistake.
Thanks in advance
SridharHi All,
I really appreciate your valuable inputs. My hair about to fall because of this problem
L
Tom, thanks, I have gone through that article weeks ago, but no luck
J
The Summary:
I have made a work around to resolve my problem. I have created a new virtual server on the second physical DELL server (with SQL Express 2012).
The problem seems to be a network issue on the hyper-V virtual switch!!
More details:
As described previously, VS connects to SQL service within the same Hyper-V only, although all configuration are right. From any PC within my domain, I can connect to the SQL server on the first Hyper-V service using the ODBC or the connection string file
(.UDL), BUT not through the “visual studio express 2012 web” !!!!!!!!!
Now, I can connect from any PC (using visual studio express 2012 web) to any SQL server Express 2012 on the second Hyper-V .
I have made 4 virtual service on the first hyperV and 4 on the second HyperV. All with the same result:
VS on PC’s can connect normally to any SQL server on the second HyperV
VS on PC’s can NOT connect to any SQL server on the first HyperV
VS on virtual servers on first HyperV can connect normally to any SQL server on the same physical machine/Same hyperV .
VS on virtual servers on first HyperV can connect normally to any SQL server on the second physical machine/Second hyperV .
VS on virtual servers on the second HyperV can connect to any SQL server on PC’s or on the second HyperV/Same physical machine.
VS on virtual servers on the second HyperV can NOT connect SQL servers on the first HyperV
Long story that last more than one month
L -
Connect to MS Sql Server from Java Source
Hi,
Is there any way I could connect to ms sql server from Java source? I know I can call java source from function thats easy but what I really want is capability to connect to non-oracle(MS SQL server) from my java source and then call it from function.
I don't know if JDBC driver for SQL server is even installed/available. Is there a way I could find it out form my IDE? I know sqlJ does compile but I have never used sqlj. help!!!
SinhaYou'll probably have better luck in a Java forum or a Microsoft forum.
-
Can't get struct from Oracle via Weblogic DB connection?
There are two ways to connect oracle, within Weblogic or without Weblogic.
Without Weblogic way works. Code here:
import java.sql.Connection;
Class.forName("oracle.jdbc.driver.OracleDriver");
dbConn = DriverManager.getConnection("Connection");
StructDescriptor st = new StructDescriptor("Name of Object in Oracle ",dbConn);
Within Weblogic way doesn’t work. Code here:
import javax.naming.InitialContext;
import javax.sql.DataSource
import java.sql.Connection;
Connection conn = null;
javax.sql.DataSource ds = null;
ds = (javax.sql.DataSource) _cntx.lookup(poolName);
conn = ds.getConnection();
StructDescriptor st = new StructDescriptor("Name of Object in Oracle ",dbConn); // Error java.rmi.MarshalException: error marshalling return; nested exception is: java.io.NotSerializableException: oracle.jdbc.driver.T4CConnection
Reference:
http://e-docs.bea.com/wls/docs81/jdbc/thirdparty.html#1090291
I don’t know what the exact reason is. And my work is hanging by this thread. Could anyone help me pls? Thank you.Man, what problem?
About how to use array,
CREATE TYPE department_type AS OBJECT (
DNO NUMBER (10),
NAME VARCHAR2 (50),
LOCATION VARCHAR2 (50)
CREATE TYPE dept_array AS TABLE OF department_type;
CREATE OR REPLACE PACKAGE objecttype AS
PROCEDURE insert_object (d dept_array);
END objecttype;
CREATE OR REPLACE PACKAGE BODY objecttype
AS
PROCEDURE insert_object (d dept_array)
AS
BEGIN
FOR i IN d.FIRST..d.LAST
LOOP
INSERT INTO department_teststruct
VALUES (d(i).dno,d(i).name,d(i).location);
END LOOP;
END insert_object;
END objecttype;
import java.sql.Connection;
import java.sql.DriverManager;
import oracle.jdbc.OracleCallableStatement;
import oracle.sql.ARRAY;
import oracle.sql.ArrayDescriptor;
import oracle.sql.STRUCT;
import oracle.sql.StructDescriptor;
public class TestStruct ...{
public static void main(String[] args)
sendStruct();
public static void sendStruct()
Connection dbConn = null;
try...{
Object[] so1 = ...{"10","Accounts","LHR"};
Object[] so2 = ...{"20","HR","ISB"};
OracleCallableStatement callStatement = null;
Class.forName("oracle.jdbc.driver.OracleDriver");
dbConn = DriverManager.getConnection("jdbc:oracle:thin:@ServerName:Port:ORa", "UserName", "Password");
StructDescriptor st = new StructDescriptor("DEPARTMENT_TYPE",dbConn);
STRUCT s1 = new STRUCT(st,dbConn,so1);
STRUCT s2 = new STRUCT(st,dbConn,so2);
STRUCT[] deptArray = ...{s1,s2};
ArrayDescriptor arrayDept = ArrayDescriptor.createDescriptor("DEPT_ARRAY", dbConn);
ARRAY deptArrayObject = new ARRAY(arrayDept, dbConn, deptArray);
callStatement = (OracleCallableStatement)dbConn.prepareCall("{call insert_object(?)}");
((OracleCallableStatement)callStatement).setArray(1, deptArrayObject);
callStatement.executeUpdate();
dbConn.commit();
callStatement.close();
catch(Exception e)...{
System.out.println(e.toString());
About how to do explain plan
EXPLAIN PLAN FOR
SELECT * FROM TABLE(DEPT_ARRAY(DEPARTMENT_TYPE(
1, --DNO NUMBER (10),
'NAME', --NAME VARCHAR2 (50),
'LOCATION' --LOCATION VARCHAR2 (50)
))) T
JOIN TABLE2 T2 ON T.DNO = T2.DNO;
SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);
But if u want let Oracle know how many rows in that array, one way follows can help.
Usually way:
EXPLAIN PLAN FOR
SELECT * FROM TABLE(DEPT_ARRAY(DEPARTMENT_TYPE(
1, --DNO NUMBER (10),
'NAME', --NAME VARCHAR2 (50),
'LOCATION' --LOCATION VARCHAR2 (50)
))) T
JOIN TABLE2 T2 ON T.DNO = T2.DNO;
SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);
PLAN_TABLE_OUTPUT
1 Plan hash value: 1748000095
2
3 ----------------------------------------------------------------------------------------------
4 | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
5 ----------------------------------------------------------------------------------------------
6 | 0 | SELECT STATEMENT | | *8168* | 16336 | 24 (0)| 00:00:01 |
7 | 1 | COLLECTION ITERATOR CONSTRUCTOR FETCH| | | | | |
8 ----------------------------------------------------------------------------------------------
When add cardinality parameter there, the result will be correct.
EXPLAIN PLAN FOR
SELECT /*+ cardinality(t 10 ) */ * FROM TABLE(DEPT_ARRAY(DEPARTMENT_TYPE(
1, --DNO NUMBER (10),
'NAME', --NAME VARCHAR2 (50),
'LOCATION' --LOCATION VARCHAR2 (50)
))) T
JOIN TABLE2 T2 ON T.DNO = T2.DNO;
SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);
PLAN_TABLE_OUTPUT
1 Plan hash value: 1748000095
2
3 ----------------------------------------------------------------------------------------------
4 | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
5 ----------------------------------------------------------------------------------------------
6 | 0 | SELECT STATEMENT | | 10 | 20 | 24 (0)| 00:00:01 |
7 | 1 | COLLECTION ITERATOR CONSTRUCTOR FETCH| | | | | |
8 ---------------------------------------------------------------------------------------------- -
I have written a java stored procedure. The method can be executed properly in local PC environment.
but when the java program is load into Oracle DB JVM by loadjava command. such method is called in SQL> prompt as a java stored procedure. I got
java.lang.NullPointerException
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:379)
at java.sql.DriverManager.getConnection(DriverManager.java:573)
at java.sql.DriverManager.getConnection(DriverManager.java:187)
at WCZSynchronizer.testLocalConn(WCZSynchronizer:901)
as shown in the trace file.
The line in my own java program WCZSynchronizer is simply
Connection conn = java.sql.DriverManager.getConnection(db_connection_string,username,password);
I am sure that the db_connection_string, username and password are correct as it works in my local PC.
I even try to get default connection by
Connection conn = java.sql.DriverManager.getConnection("jdbc:default:connection:");
and
Connection conn = new oracle.jdbc.driver.OracleDriver().defaultConnection();
I got the same NullPointerException in both cases too.
In fact, the java stored procedure worked before. but suddenly it's failed! The Oracle DB server is under my control and I did not change any configuration nor setting on it.
I can't find similar case from this forum. Do any one know why?
thanks.First try debugging the test case by making sure that none of the parameters passed to getConnection is null.
When you are sure that none of the parameters are null, if the issue still reproduces. Let us know
- The driver version
- The jar file you are using
cheers
Ashok
Maybe you are looking for
-
Using the apple remote with ipod mini
is it possible to use the apple remote with ipod mini dock advent 1318 Windows XP n/a
-
iPhoto won't finish an import without crashing or even when I'm just browsing the library it crashes unexpectedly. This has happened on rare occasions in the past, but now it won't stay open for more than five minutes. I've got over 11,000 photo's in
-
How do i remove white snowflake like scratches from my photo?
my photo contains a few scratches. how do i remove? tried the removal tool. did not work. first time user.
-
How to move to click position from anywhere
Hey all, At the moment I'm looking at different solutions for making HTML5 ads. I have already made some coded from scratch, some made with the greensock plugin and now I'm trying with Adobe Edge. All looks very nice but I have bumped into something
-
Hi, on 10g R2, I have a tablespace MYTBS. It's datafile on U filesystem. U filesystem should be changed. I have a backup of that datafile that I got like this : ALTER TABLESPACE MYTBS BEGIN BACKUP; host ocopy U:\BASE\DB\MY_TS.DBF \\Server\SAVE-DATA