Main   Products   Offshore Outsourcing   Customers   Partners   ContactUs  
JDBC Databases
  HXTT Access v5.2
  HXTT Cobol v2.1
  HXTT DBF v5.2
 
  Buy Now
  Support
  Download
  Document
  FAQ
  HXTT Excel v4.2
  HXTT Paradox v5.2
  HXTT Text(CSV) v5.2
  HXTT XML v1.2
Offshore Outsourcing
Oracle Data Import/Export
DB2 Data Import/Export
Sybase Data Import/Export
Free Resources
  Firewall Tunneling
  Search Indexing Robot
  Conditional Compilation
  Password Recovery for MS Access
  Password Recovery for Corel Paradox
  Checksum Tool for MD5
  Character Set Converter
  Pyramid - Poker of ZYH
   
   
   
Hongxin Technology & Trade Ltd. of Xiangtan City (abbr, HXTT)

HXTT DBF
PreparedStatement and connection pooling
Dewil Maxence
2005-05-02 00:00:00.0
Hi,

I updated my application to use the DBCP connection pool as documented in your online documentation.

It seems the PreparedStatement does not work with the connection pool when it is filled with parameters.

The following exception is thrown: java.sql.SQLException: Please set value for parameter 1.

When I execute the same sql query on an unpooled connection with the same parameters in the PreparedStatement, it works.

Any idea of what is the cause?

Thx
Re:PreparedStatement and connection pooling
HXTT Support
2005-05-10 00:00:00.0
Hi,I have tested and not found any problem.
The follows is the datasource configuration part in the server.xml .


factory
com.hxtt.sql.HxttObjectFactory


subprotocol
DBF



database
f:/DBFfiles



And here is my code in my jsp file.
Context initContext = new InitialContext();
Context envContext = (Context) initContext.lookup("java:/comp/env");
DataSource ds1 = (DataSource) envContext.lookup("jdbc/testDBFPool3");
Connection conn1 = ds1.getConnection();
out.println("testDBFPool1 OK:)
");
PreparedStatement stmt1 = conn1.prepareStatement("select * from test where testfield=?");
stmt1.setString(1,"644");
ResultSet rs1 = stmt1.executeQuery();
while (rs1.next())
out.println(rs1.getString(1) + ":)
");

You can download the latest HXTT Package to solve this issue.
Re:Re:PreparedStatement and connection pooling
HXTT Support
2005-05-10 00:00:00.0
Sorry,this configuration is error.

<Resource name="jdbc/testDBFPool3" auth="Container" type="com.hxtt.sql.HxttConnectionPoolDataSource"/> 

<ResourceParams name="jdbc/testDBFPool3">

<parameter>

<name>factory</name>

<value>com.hxtt.sql.HxttObjectFactory</value>

</parameter> 

<parameter>

<name>subprotocol</name>

<value>DBF</value>

</parameter> 



<parameter>

<name>database</name> 

<value>f:/DBFfiles</value>

</parameter>

</ResourceParams>

Re:Re:Re:PreparedStatement and connection pooling
Dewil Maxence
2005-06-08 00:00:00.0
Hi,

the problem was caused by a copy-paste mistake:
what I have made:
PreparedStatement pStmt = connection.prepareStatement(myQuery);
//.. populate the parameters
pStmt.executeQuery(myQuery);
//.. PreparedStatement extends Statement

So I suppose the query is parsed twice..

Sorry for my previous post.

Thx.

Search Key   Search by Last 50 Questions




Google
 

Address: 9 Station Rd., Xiangtan City, Hunan Province, P.R. China
Postcode: 411100
Phone: (86)731-58225727
Fax: (86)731-58225727
Email: webmaster@hxtt.com
Copyright © 1999-2011 Hongxin Technology & Trade Ltd. | All Rights Reserved. | Privacy | Legal | Sitemap