cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: Executing raw SQL
Date Wed, 05 Sep 2012 12:10:19 GMT
+1 (for 3.2)... we already have an implicit "default node" concept when deciding what to use
for DataMaps with no nodes. We might just expand on that in this case as well as add SQLTemplate
default routing for SQLTemplates.

Andrus


On Sep 5, 2012, at 2:33 PM, Michael Gentry wrote:

> I was wondering if we might should go one step further.  If there is
> only one DataNode, perhaps have the option of leaving the entity or
> DataNode name out of those calls?  (Can throw an exception if there
> are multiple DataNodes registered.)  That might be more intuitive for
> most (and the typical use-case).
> 
> mrg
> 
> 
> On Wed, Sep 5, 2012 at 1:43 AM, Andrus Adamchik <andrus@objectstyle.org> wrote:
>> A bit OT, since Bob has found a solution already... Cayenne 3.1 makes it a bit easier
to obtain a DataSource, compared to the earlier versions:
>> 
>> Connection connection = serverRuntime.getDataSource("DataNode").getConnection();
>> 
>> Andrus
>> 
>> On Sep 4, 2012, at 2:05 PM, Bryan Lewis wrote:
>> 
>>> In you really need to get a connection, this has worked for me:
>>> 
>>>   Connection connection =
>>> dataContext.getParentDataDomain().getNode("DataNode").getDataSource().getConnection()
>>> 
>>> 
>>> On Mon, Sep 3, 2012 at 8:55 PM, Bob Harner <bobharner@gmail.com> wrote:
>>> 
>>> 
>>>> Alternatively, how can I get access to the database connection so I can run
>>>> straight JDBC?
>>>> 
>>>> private void backUpDatabase(Connection conn) throws SQLException
>>>> {
>>>> String sqlstmt = "CALL SYSCS_UTIL.SYSCS_BACKUP_DATABASE(?)";
>>>> CallableStatement cs = conn.prepareCall(sqlstmt);
>>>> cs.setString(1,"D:/dbbackups/");
>>>> cs.execute();
>>>> cs.close();
>>>> }
>>>> 
>> 
> 


Mime
View raw message