Can't we pass java.sql.Connection as parameter toDatum() method
I am in mid of java 1.3 to 1.4 migration, now I am getting the below error.can't we pass java.sql.Connection as a param to toDatum(), but I did the same before for another module and it worked fine, now I am getting the error.
any changes need to be done?
[b]toDatum(oracle.jdbc.driver.OracleConnection,java.lang.String) in oracle.jpub.runtime.MutableArray cannot be applied to (java.sql.Connection,java.lang.String)
return array.toDatum(c, SQL_NAME);
^
1 error
I changed to use
import oracle.sql.ORAData;
import oracle.sql.ORADataFactory;
instead of
import oracle.sql.CustomDatum;
import oracle.sql.CustomDatumFactory;
In general, it's bad practice to be that "open" with regards to parameters to methods, especially when using remote invocations. However, if you really, really, really, really need to - and I doubt you do - you can use Serializable for the type of parameter. But that's still inelegant and, well, raises all sorts of issues, starting with your design...
Similar Messages
-
BC4J - How can I get java.sql.Connection ?
Hi,
I am using BC4J for my Application and want to get the java.sql.Connection from ApplicationModule or from anywhere such that I can use the same connection as in ApplicaitonModule, to do some work in the database.
I tried to get it from the SessionInfo :
sessioninfo.getConnectionInfo();
but this returns me oracle.dacf.dataset.connections.Connection
How can I convert this to java.sql.Connection?
Or Is there any other means to get hold of sql.Connection?
Any help would be appreciated.
TIAThanks for this reply.. but
I need java.sql.Connection to call a stored procedure in Oracle database and I have to pass oracle.sql.ARRAY to it.
My Stored Procedure looks like:
create or replace PROCEDURE updateRevenueNetworkInfo(revid varchar2, netids Varchar32Array)
where 'Varchar32Array' is my own datatype in the database which is mapped to oracle.sql.ARRAY object in java.
And in order to create oracle.sql.ARRAY I need java.sql.Connection as shown below
oracle.sql.ARRAY pTable = new oracle.sql.ARRAY(desc, connection, netidarray);
I am executing my stored procedure like this:
ArrayDescriptor desc = null; CallableStatement cs = null;
String[] netidarray = {"00-AOL-T1-N003"};
desc = ArrayDescriptor.createDescriptor("VARCHAR32ARRAY", conn);
oracle.sql.ARRAY pTable = new ARRAY(desc, connection, netidarray);
cs = conn.prepareCall( "BEGIN updaterevenuenetworkinfo(?,?); END;" );
((OracleCallableStatement)cs).setString(1,"00-AOL-T1-R3");
((OracleCallableStatement)cs).setArray(2, pTable);
cs.execute();
Is there any way of getting java.sql.Connection such that I can use the same connection as in the ApplicationModule?
OR Is there any other way of passing Array of Strings to a stored procedure in the database?
Thanks for the help.
null -
What is the recommended way to get a java.sql.Connection to the DB for ADF
How do I create a standalone database connection based on the datasource setup in ADF?
I have seen code like this in a method of AppModuleImpl.java but that seems a bit of a hack.
Connection conn = this.getDBTransaction().createStatement(0).getConnection();
What I need is a java.sql.Connection to the database used in the application module so I can call PL/SQL code and or work with AQ queues.
I would prefer a separate connection from the one used by the ADF model so it can have its own transaction control etc.
But I would like to get the connection created authenticated based on regular datasource setup.http://www.oracle.com/webfolder/technetwork/jdeveloper/howto/11114/managedserver/wlsadfms.html#8c
https://blogs.oracle.com/jdevotnharvest/entry/accessing_weblogic_jdbc_datasource_from -
How to check whether java.sql.Connection has been dropped or not
Hi,
How can i check whether the connection is dropped from the database or not by using java.sql.Connection API.
ThanksThere's a few ways to check Connections, each with a different use:
(1) conn.isOpen()
(2) conn == null
(3) the last one is a little more involved and adds some overhead. You can run SELECT 1 FROM dual; (Oracle) or SELECT 1 (MSSQL) and check for exceptions.
The only way to check a connection, as far as I know, is to use it. That said, there must be a better way??? -
Java.sql.Connection x J9 VM
Is possible to use class java.util.Connection with J9 VM using CDC/PP ?
Logging:
java.lang.NoClassDefFoundError: java.sql.Connection
at java.lang.Class.verifyImpl(NativeMethod)
Help me please;
Thanks
[]'sIs possible to use class java.util.Connection with J9 VM using CDC/PP ?Yes. Check your classpath JARs for java.sql.Connection. You may be missing the jar "database_enabler.jar". See:
http://blog.vikdavid.com/2005/08/troubleshooting.html
Vik -
Need help with a Java-SQL connection
My classmates and I created a DesktopFrame. Within it are reports that require a connection to an MS Access Database. When a report in an InternalFrame is opened: the SQL command works, there is a connection, and everything goes well on the first run.
However, when another InternalFrame is opened or when the same InternalFrame is opened the 2nd time, an error occurs. It produces a java.sql.SQLException: General Error.
Can anyone help me? Thanks in advance.Provide more info, maybe even some code segments. (Not all). May be easier to help
-
Access to java.sql.Connection objects
Hi,
The Kodo JDO developers guide states 2 methods to obtain a Connection
object for the database.
The first method makes use of a function getStoreManager(), which
doesn't seem to exist anywhere and which is certainly not mentioned
anywhere in the documentation.
The second method makes use of a class DataSource, which also does not
exist anywhere. I am aware that this class is present in JDK1.4 but we
are using 1.3 and it states Kodo works on this version.
Can anybody please clarify how I obtain a connection using these two
methods?
LarsOn 7/1/02 9:15 AM, "Lars" <[email protected]> wrote:
Hi,
The Kodo JDO developers guide states 2 methods to obtain a Connection
object for the database.
The first method makes use of a function getStoreManager(), which
doesn't seem to exist anywhere and which is certainly not mentioned
anywhere in the documentation.getStoreManager() is a Kodo-specific method in
com.solarmetric.kodo.runtime.PersistenceManagerImpl. The JavaDoc for this
class is not available in Kodo JDO 2.2.x; it is available in Kodo JDO 2.3.0.
The second method makes use of a class DataSource, which also does not
exist anywhere. I am aware that this class is present in JDK1.4 but we
are using 1.3 and it states Kodo works on this version.DataSource is part of the Java SQL standard extensions, in javax.sql. See
http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/sql/DataSource.html for
more documentation on it.
Note that we do not require that you use a JDBC 2.0 driver (one that
supports javax.sql). We provide our own implementation of DataSource that is
used whenever a connection URL is specified. If you want to use your own
connection pooling etc. with a JDBC 1.0 driver, then you will have to
implement the DataSource interface on your own; we assume that the
ConnectionFactory object implements the DataSource interface.
-Patrick
Patrick Linskey [email protected]
SolarMetric Inc. http://www.solarmetric.com -
Passing Java statements in the parameter list
I am relatively new to Java and have a need to create a method which has a Java statement passed to it in the parameter list. The purpose is to optionally run this statement within the method. For example:
I have a method called rotateAndTranslate that sets up an Affine Transform by saving the existing transform context, creating a new transform, and then invoking that transform. After the new transform is invoked, I would like to have the ability to run different Java graphics commands (or not) before continuing with the remaining portion of the existing method (in this case, restoring the previous transform.
I am not able to find any clear information on how to pass in Java statements and then invoke them.
Can someone help with this? Please keep it simple as I am still trying to get my head around Java and OOP.
Carlyou're talking about closures, more or less, which java doesn't currently have
you can get close to it by using anonymous inner classes. define an interface, say Transformer, and pass instances of that as arguments:
public interface Transformer {
void transform();
Transformer transformer = new Transformer() {
public void transform() {
// do the work here
MyTransformerClass.doTransform(transformer);
...obviously, the MyTransformerClass.doTransform() must take a Transformer as a parameter -
Java.sql.connection problems
Hi, I hav got this problem:
PRB 1
I have got the JDBC connection established with the OracleDataSource instance on my java application
I wonder if there is a way to check the connection if it is still alive. any hint? i tried connection.isClosed() but that doesn't help.
PRB 2
I am in this scenario:
The connection is established during application start and something goes wrong say like the DB server goes offline in the middle of no where and I do a commit / rollback. I will get a SQLExeption called. But right after the db comes back online.. i tried to do a commit / rollback, the SQLExeption is still persist.
Q1. Does this mean that when the exception is caught, my connection would no longer be valid and I need to restart the application?
Q2. could i reinitialize the connection after the exception to avoid the restart?
Thank you.Hi, I hav got this problem:
PRB 1
I have got the JDBC connection established with the
OracleDataSource instance on my java application
I wonder if there is a way to check the connection if
it is still alive. any hint? i tried
connection.isClosed() but that doesn't help.From Java APIs reg. isClosed():This method is guaranteed to return true only when it is called after the method Connection.close has been called.
This method generally cannot be called to determine whether a connection to a database is valid or invalid. A typical client can determine that a connection is invalid by catching any exceptions that might be thrown when an operation is attempted.
PRB 2
I am in this scenario:
The connection is established during application start
and something goes wrong say like the DB server goes
offline in the middle of no where and I do a commit /
rollback. I will get a SQLExeption called. But right
after the db comes back online.. i tried to do a
commit / rollback, the SQLExeption is still persist.
Q1. Does this mean that when the exception is caught,
my connection would no longer be valid and I need to
restart the application?
Q2. could i reinitialize the connection after the
exception to avoid the restart?Once your DB goes down, your connection is broken. You cannot do anything with that connection...like Rollback, commit etc. You need to re-establish the connection. You don't need to restart the application, but you might want to check if the connection is null. If it is, you might have to try a new connection. Probably, your application can quit trying for a connection after 'x' number of attempts.
Kumar -
Exception in method createStatement() of java.sql.Connection
Hi,
When creating a statement :
Statement stat = conn.createStatement();
I got this error:
java.lang.NegativeArraySizeExceptionoracle.net.ano.CryptoDataPacket.decryptAndChecksum(CryptoDataPacket)
oracle.net.ano.CryptoDataPacket.<init>(CryptoDataPacket)
oracle.net.ano.AnoNetInputStream.processPacket(AnoNetInputStream)
oracle.net.ns.NetInputStream.getNextPacket(Unknown Source)
oracle.net.ns.NetInputStream.read(Unknown Source)
oracle.net.ns.NetInputStream.read(Unknown Source)
oracle.net.ns.NetInputStream.read(Unknown Source)
oracle.jdbc.ttc7.MAREngine.unmarshalUB1(MAREngine.java:728)
oracle.jdbc.ttc7.MAREngine.unmarshalSB1(MAREngine.java:700)
oracle.jdbc.ttc7.Oopen.receive(Oopen.java:103)
oracle.jdbc.ttc7.TTC7Protocol.open(TTC7Protocol.java:497)
oracle.jdbc.driver.OracleStatement.<init>(OracleStatement.java:505)
oracle.jdbc.driver.OracleConnection.privateCreateStatement(OracleConnection.java:693)
oracle.jdbc.driver.OracleConnection.createStatement(OracleConnection.java:570)
Any idea of what is the problem?
Thanks in advance,
KarimHi,
I am trying to open service browser in Test tools to test entity service.But Service browser is not opening and i am getting 'access forbidden'.Can you please help to resolve this issue.And what role i have to add for CAF user/developer.
Thanks,
Murthy. -
Serialization of java.sql.Connection
Hi ,
I just came across a input from my colleague that Connection object once created are not serializable across jvm's
Is it true??
fast yes or no will help my curosity ....giving reason also will be genrousity ...anyway I will test this nowIt can't be done.
The reason is that a connection uses a network resource (such as a TCP/IP socket) which uses the network stack on the machine, and eventually the machine's hardware. It is not possible to serialize things like a connected socket, because it's significance is machine-specific, not only in terms of a virtual address (such as an IP address), but also in terms of the way the operating system is using the hardware.
Serialization is only good if what you're serializing is only data.
Rhys -
Java.sql.Connection charset property
Hello!
AFAIK, usual way to establish JDBC connection to DB using 1-byte encoding
was:
props.put("user",user);
props.put("password",password);
props.put("charSet",encoding);
Connection con = DriverManager.getConnection(url,props);
How to do the same with JDO PersistenceManagerFactory?
Does Kodo have appropriate optional property?Note that in the mean time, it is possible to work around this issue by
supplying a DataSource object to our PersistenceManagerFactory.
-Fred
Viktor S. Grishchenko <[email protected]> wrote:
Hello!
AFAIK, usual way to establish JDBC connection to DB using 1-byte encoding
was:
props.put("user",user);
props.put("password",password);
props.put("charSet",encoding);
Connection con = DriverManager.getConnection(url,props);
How to do the same with JDO PersistenceManagerFactory?
Does Kodo have appropriate optional property?--
Fred Lucas
SolarMetric Inc.
202-595-2064 x1122
http://www.solarmetric.com -
Passing Database Pool Connection to Java Object
SO I have a set of Java libs that i would like to use within
CFMX. In fact, I would like to do all my business logic with those
libraries. Question is, the classes require I pass a database
connection to them. How would I do this?In Coldfusion you can just code the usual Java DB connection
directly. That is, something like
<cfscript>
classObj = CreateObject("java", "java.lang.Class");
classObj.forName("etc.etc..Driver");
driverManager = CreateObject("java",
"java.sql.DriverManager");
connectionURL="jdbc: etc etc. ";
conn=driverManager.getConnection(connectionURL,username,password);
myQuery="SELECT blah1, blah2 FROM blah3";
preparedStatement = conn.prepareStatement(myQuery);
rs=preparedStatement.executeQuery();
while (rs.next()) {
etc etc
rs.close();
conn.close();
</cfscript>
That is for single calls. To set up a permanent connection,
you could include in the libraries a class whose job is simply to
establish the connection to the DB. I should expect the code to
contain some of the themes above, namely,
getConnection (String url, String user, String password)
connectionURL = "jdbc:etc"
java.sql.Connection conn =
java.sql.DriverManager.getConnection (connectionURL, username,
password);
etc. etc.
You could also find it convenient to store connection and
user data data in a properties object of the java.util.Properties
class.
java.util.Properties properties = new java.util.Properties
properties.setProperty ("user", "bkbk");
properties.setProperty ("password", "knoflook");
java.sql.Connection conn =
java.sql.DriverManager.getConnection (connectionURL, properties); -
Connection error using import java.sql.*;
I have a very strange error. See the code below:
import java.sql.*;
import java.lang.*;
class a7 {
public static void main(String args[]) {
String kolom,ko = new String();
String db = "devarbn1";
String url = "jdbc:odbc:"+db;
String login = "arbor";
String password = "arbor123";
String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
String BasisQuery = "select COLUMN_NAME " +
" from all_tab_columns " +
" where table_name = ? ";
System.out.println("Database: " + db);
Connection con;
try {
Class.forName(driver);
} catch (java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
try {
con = DriverManager.getConnection(url,login,password); //this line gives an error!!!
and so on.....
This is a fragment of the whole program. All of a sudden I cannot compile it anymore using jdk1.3 or jdk 1.4 (I never had compiling problems before with this program)
It gives the following error message: incompatible types, found Connection.
I haven't got a clue what went wrong. I have a lot of other java files in which a connection is involved. I cannot compile any of them anymore. Even reinstalling jdk1.4 or 1.3 doesn't help. Can anyone please help me?
Thanx, debeumersYes, the whole message is:
incompatible types found : java.sql.Connection required : Connection.
The whole code is (it is from a different java file then the code I used before)
import javax.sql.*;
import java.sql.*;
import java.lang.*;
public class Connection {
static final String arb_nl = "arbornl";
static final String arb_fr = "arborfr";
static final String clar_nl = "clarnl";
static final String clar_fr = "clarfr";
static final String po = "pcnlpp";
static final String user_clar_nl = "report";
static final String pass_clar_nl = " r3p0rt";
static final String user_clar_fr = "report";
static final String pass_clar_fr = " r3p0rt";
static final String user_arb_fr = "report";
static final String pass_arb_fr = " r3p0rt";
static final String user_arb_nl = "report";
static final String pass_arb_nl = " r3p0rt";
static final String user_po_nl = "report";
static final String pass_po_nl = "r3p0rt";
static boolean a = true;
static boolean b = true;
static boolean c = true;
static Connection conarb,conclar,conpo;
static String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
String loginarb = user_arb_nl;
String passwordarb = pass_arb_nl;
String loginclar = user_clar_nl;
String loginpo = user_po_nl;
String passwordpo = pass_po_nl;
String passwordclar = pass_clar_nl;
public Connection() {
public void makeConnection(String database,String user,String password,String type) {
String url = "jdbc:odbc:" + database;
try {
Class.forName(driver);
} catch (java.lang.ClassNotFoundException ex) {
System.err.print("ClassNotFoundException: ");
System.err.println(ex.getMessage());
a = false;
try { if (type=="ARB") { conarb = DriverManager.getConnection(url,user,password);} //giving the problem!!
if (type=="CLAR") { conclar = DriverManager.getConnection(url,user,password);} //giving the problem!!
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
b = false;
/* try { if (type=="PO") {conpo = DriverManager.getConnection(url,user,password);}
} catch(SQLException ex) {System.err.println("SQLException: " + ex.getMessage()); c = false;}*/
I hope you can help..
Thanks...debeumers -
I keep getting the following error when I try to use 2 different java.sql.Connections
from 2 different database connection pools in my message ejb. The message ejb
uses container managed transaction. The 2 connection pools point to different
Sybase Servers.
Any help will be much appreciated !!!
java.sql.SQLException: Connection has already been created in this tx context
for pool named adrxSYBDEV07. Illegal attempt to create connection from another
pool: Sybbev07Pool JDBCUtil > getConnection()Hi Eddie,
"Eddie Baue" <[email protected]> wrote in message
news:3ddbf74f$[email protected]..
I keep getting the following error when I try to use 2 differentjava.sql.Connections
from 2 different database connection pools in my message ejb. The messageejb
uses container managed transaction. The 2 connection pools point todifferent
Sybase Servers.In order to access more then one database base within
a TX you need to have TXDataSources backed by XA
connection pools...
Regards,
Slava Imeshev
Maybe you are looking for
-
Select One Choice-select multiple attributes into mutiple columns
Select One Choice-select multiple attributes into mutiple columns does not work. read-only view object view1 - columns a, b, c updatable view object view2 - also columns a, b, c Select One choice has the capability to bind multiple columns to multipl
-
Creation of new partner function through /AFS/BAPI_SALESORD_CHANGE
Hi all, Can anybody help me to create partner functions through the bapi /AFS/BAPI_SALESORD_CHANGE ?? In the selection-screen we will pass the vbeln, PARVW and kunnr values ?? Any kind of little help is very much appreciated.
-
I want Links to open in a New Window, NOT a New Tab (FireFox 31.0)
Internet Explorer has an "Options" setting to open new tabs in a new window instead. Where can I find it in FireFox - looks like there is none ??? Older versions had it, I believe.
-
Elements 11 - How do I Change default setting on jPEG OPTIONS
Hi Guys, Can anyone tell me how to change the default setting under Jpeg options when saving changes, at present its ticked for Qulaity 12 Max but we want it on Quality 8 high and its a real pain having to change this setting every time we edit an im
-
IBase linking with Account Identification
Hello, Can I know the configuration involved if I'd like the Account be linked to the IBase in WebClient? Meaning to say, when an IBase is confirmed, it auto populates the Account information or when an Account is confirmed, the IBase related to the