You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Meeraj Kunnumpurath <Me...@mutant-tech.com> on 2001/07/12 15:14:49 UTC
RE: Problems with Database because of Datasource-Config of Struts
!
Check your autocommit mode
Regards
<Meeraj/>
-----Original Message-----
From: Maik Mrazovic [mailto:maik.mrazovic@t-systems.de]
Sent: Thursday, July 12, 2001 1:30 PM
To: struts-user@jakarta.apache.org
Subject: Problems with Database because of Datasource-Config of Struts!
Hello,
all parameters for a database of a webapplication are configured well in
struts-config.xml. There are no problems when I make a SELECT, but INSERT,
DELETE or UPDATE don´t work, I don´t know why exactly.
The problem is the Connection-Object! If you use Struts-config.xml you get
the Connection Object with
java.sql.Connection myConnection = null;
try {
javax.sql.DataSource dataSource =
this.getServlet().findDataSource(null);
if (dataSource != null)
{
myConnection = dataSource.getConnection();
... and so on.
When I aks the Object of Classname (myConnection.getClassName()) the name is
apache.struts.util.GenericConnection.
With this Connectionobject are INSERT etc impossible, but why?!
If my connection-Object is developed like this:
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection c = DriverManager.getConnection("jdbc:ODBC:V68CIMPA",
"j68cimpa",
"cimpa");
INSERTS etc works fine!!! But that´s stupid, because I must have in
every classes the database-parameter, with struts-config.xml not, it comes
from .findDataSource(), in other words its better to configure the
webapplication!
I hope you can help me,
best regards,
Maik Mrazovic
T - S y s t e m s
debis Systemhaus MEB GmbH
Business Center Sales & eBusiness, R&D/VN
Erich-Herion Str. 13
70736 Fellbach
(Phone) +49 711 17-40549
(Mobile) +49 170 832-5616
(email) maik.mrazovic@t-systems.de <ma...@t-systems.de>
Internet: http://www.t-systems.de <http://www.t-systems.de>
Re: Problems with Database because of Datasource-Config of Struts!
Posted by Howie <ca...@TooDarkPark.org>.
On Thu, 12 Jul 2001, Maik Mrazovic wrote:
> thanks,
>
> but it�s indifferent if Autocommit is "false" or "true" it does not
> work with both options!
>
> Database is IBM DB2 7, but the reason for my problem ist the
> connection-object from the datasource-config.
GenericConnection (
src/share/org/apache/struts/util/GenericConnection.java ) simply returns a
wrapped Connection object. GenericConnection will pass off all the API
calls to its real connection after ensuring that the connection hasnt been
closed ( hence all the if(closed) checks ). for instance:
public PreparedStatement prepareStatement(String sql) throws SQLException
{
if (closed) throw new SQLException(SQLEXCEPTION_CLOSED);
return (conn.prepareStatement(sql));
}
( 'conn' being the real connection to the underlying database )
you may want to try using IBM's DataSource implementation ( assuming they
have one ) to see if the problems persist. im betting that its not a
problem with Apache's DataSource implementation and Connection wrapper,
though.
---
Howie <ca...@toodarkpark.org> URL: http://www.toodarkpark.org
"This sort of thing has cropped up before and has always been
due to human error." -- HAL
Re: Problems with Database because of Datasource-Config of Struts!
Posted by Maik Mrazovic <ma...@t-systems.de>.
thanks,
but it´s indifferent if Autocommit is "false" or "true" it does not work with both options!
Database is IBM DB2 7, but the reason for my problem ist the connection-object from the datasource-config.
regards,
Maik
----- Original Message -----
From: Meeraj Kunnumpurath
To: 'struts-user@jakarta.apache.org'
Sent: Thursday, July 12, 2001 3:14 PM
Subject: RE: Problems with Database because of Datasource-Config of Struts!
Check your autocommit mode
Regards
<Meeraj/>
-----Original Message-----
From: Maik Mrazovic [mailto:maik.mrazovic@t-systems.de]
Sent: Thursday, July 12, 2001 1:30 PM
To: struts-user@jakarta.apache.org
Subject: Problems with Database because of Datasource-Config of Struts!
Hello,
all parameters for a database of a webapplication are configured well in struts-config.xml. There are no problems when I make a SELECT, but INSERT, DELETE or UPDATE don´t work, I don´t know why exactly.
The problem is the Connection-Object! If you use Struts-config.xml you get the Connection Object with
java.sql.Connection myConnection = null;
try {
javax.sql.DataSource dataSource = this.getServlet().findDataSource(null);
if (dataSource != null)
{
myConnection = dataSource.getConnection();
... and so on.
When I aks the Object of Classname (myConnection.getClassName()) the name is apache.struts.util.GenericConnection.
With this Connectionobject are INSERT etc impossible, but why?!
If my connection-Object is developed like this:
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection c = DriverManager.getConnection("jdbc:ODBC:V68CIMPA", "j68cimpa",
"cimpa");
INSERTS etc works fine!!! But that´s stupid, because I must have in every classes the database-parameter, with struts-config.xml not, it comes from .findDataSource(), in other words its better to configure the webapplication!
I hope you can help me,
best regards,
Maik Mrazovic
T - S y s t e m s
debis Systemhaus MEB GmbH
Business Center Sales & eBusiness, R&D/VN
Erich-Herion Str. 13
70736 Fellbach
(Phone) +49 711 17-40549
(Mobile) +49 170 832-5616
(email) maik.mrazovic@t-systems.de
Internet: http://www.t-systems.de