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?
Lars

On 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

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.
    TIA

    Thanks 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

  • 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
    []'s

    Is 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

  • 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...

  • 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.
    Thanks

    There'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???

  • SQL Connection object

    Hi,
    Is there any issue(or problem) if we use SQLConnection object and communicate to SQL server instead of using business object or business query.
    thanks and regds
    harish

    Hi Kai/Pratik Patel
    Thanks for replying. One more question in this regard. Where to store the connection string if you are going to use SQL Connection object, so that we have to create the connection string only once.
    As in other .NET application (Windows and Web) we store it in the configuration file but in the MSA we do not have configuration file.
    Thanks and Regds
    Harish

  • 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

  • Creating or updating a java.sql.array object

    I've created an oracle object table which contains a nested table. I've published these types using JPublisher and can extract an object from the table and read the data both the object and the nested table. (The nested table is typed within the java class as java.sql.array).
    Now I'd like to create an object in java and add it to the database. Populating the object attributes and writing them to the database table is not a problem, but how do I populate java.sql.array and write it to the nested table?
    Werner Reiche

    Array sqlArray = rs.getArray("LINES");
    ResultSet data = sqlArray.getResultSet();
    while (data.next()) {
    System.out.println(data.getString(1));
    .getString(1)); // the line's index #
    System.out.println(data.getString(2));
    .getString(2)); // the line's string value
    } I wonder what this would do
    String[] values = (String[]) sqlArray.getArray();

  • Can I use ' ', ' ', '= ' and ' =' with java.sql.Timestamp objects in EJB-QL

    ie. Is this valid?
    <query>
    <description>Find data between dates</description>
    <query-method>
    <method-name>findMetricsByDate</method-name>
    <method-params>
    <method-param>java.sql.Timestamp</method-param>
    </method-params>
    <method-params>
    <method-param>java.sql.Timestamp</method-param>
    </method-params>
    </query-method>
    <result-type-mapping>Local</result-type-mapping>
    <ejb-ql>
    SELECT OBJECT (o) FROM MetricResults AS o WHERE MetricResults.date > ?1 AND MetricResults.date < ?2
    </ejb-ql>
    </query>

    No. Not with current EJB 2.0 CMP specs at least. Later revisions are supposed to fix this, but for now, this seriously limits the usefulness of EJB-QL.
    .P.

  • 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 now

    It 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

  • 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,
    Karim

    Hi,
    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.

  • Ejb-ql and java.sql.Timestamp object

    Hi, I have a mySql database table that has a column containing a Timestamp object. I need a finder method for my ejb's that will allow me to query the table for rows between certain dates.
    In other words, I need to query for entries that have a Timestamp object between 2 specified dates.
    One solution is to change the column type from Timestamp to long (date in milliseconds). That way I can use the BETWEEN clause to search between 2 longs. I would rather not do that. Does anyone know of a way that I can search between 2 Timestamp objects?

    You can use the SQL BETWEEN clause with dates, just use it like this:
    WHERE OrderDate BETWEEN '1998/5/1' AND '1998/5/31'

Maybe you are looking for