2011-03-02 37 views
1

使用this postgres文檔頁底部的代碼,我該如何導入org.postgresql.jdbc3.Jdbc3PoolingDataSource?哪個司機有這個班?import org.postgresql.jdbc3.Jdbc3PoolingDataSource

+3

問題是什麼? – 2011-03-02 16:35:27

+0

如何解決這個問題,我使用netbeans.I在我的項目庫中下載了postgresql-8.4-702.jdbc4和inlude,但有問題。 – user564456 2011-03-02 16:42:46

+1

如何解決**什麼**。你的問題到底是什麼?發佈顯示它的錯誤消息或示例代碼。 – 2011-03-02 16:48:53

回答

2

一般情況下,提供更多的信息,如堆棧跟蹤:)

總之,這裏是一個原始的方式查看特定JAR是否有你要找的類:

[email protected]:~/postgres$ 
[email protected]:~/postgres$ ll 
total 8 
drwxr-xr-x 2 thufir thufir 4096 2011-03-02 16:10 ./ 
drwxr-xr-x 75 thufir thufir 4096 2011-03-02 16:10 ../ 
[email protected]:~/postgres$ 
[email protected]:~/postgres$ wget http://jdbc.postgresql.org/download/postgresql-9.0-801.jdbc3.jar 
--2011-03-02 16:11:39-- http://jdbc.postgresql.org/download/postgresql-9.0-801.jdbc3.jar 
Resolving jdbc.postgresql.org... 200.46.204.71 
Connecting to jdbc.postgresql.org|200.46.204.71|:80... connected. 
HTTP request sent, awaiting response... 200 OK 
Length: 502694 (491K) [application/octet-stream] 
Saving to: `postgresql-9.0-801.jdbc3.jar' 

100%[===========================================================================>] 502,694  115K/s in 4.4s  

2011-03-02 16:11:44 (110 KB/s) - `postgresql-9.0-801.jdbc3.jar' saved [502694/502694] 

[email protected]:~/postgres$ 
[email protected]:~/postgres$ jar -tf postgresql-9.0-801.jdbc3.jar 
META-INF/ 
META-INF/MANIFEST.MF 
org/ 
org/postgresql/ 
org/postgresql/Driver$1.class 
org/postgresql/Driver$ConnectThread.class 
org/postgresql/Driver.class 
org/postgresql/PGConnection.class 
org/postgresql/PGNotification.class 
org/postgresql/PGRefCursorResultSet.class 
org/postgresql/PGResultSetMetaData.class 
org/postgresql/PGStatement.class 
org/postgresql/copy/ 
org/postgresql/copy/CopyIn.class 
org/postgresql/copy/CopyManager.class 
org/postgresql/copy/CopyOperation.class 
org/postgresql/copy/CopyOut.class 
org/postgresql/copy/PGCopyInputStream.class 
org/postgresql/copy/PGCopyOutputStream.class 
org/postgresql/core/ 
org/postgresql/core/BaseConnection.class 
org/postgresql/core/BaseResultSet.class 
org/postgresql/core/BaseStatement.class 
org/postgresql/core/ConnectionFactory.class 
org/postgresql/core/Encoding.class 
org/postgresql/core/Field.class 
org/postgresql/core/Logger.class 
org/postgresql/core/Notification.class 
org/postgresql/core/Oid.class 
org/postgresql/core/PGBindException.class 
org/postgresql/core/PGStream$1.class 
org/postgresql/core/PGStream.class 
org/postgresql/core/ParameterList.class 
org/postgresql/core/Parser.class 
org/postgresql/core/ProtocolConnection.class 
org/postgresql/core/Query.class 
org/postgresql/core/QueryExecutor.class 
org/postgresql/core/ResultCursor.class 
org/postgresql/core/ResultHandler.class 
org/postgresql/core/TypeInfo.class 
org/postgresql/core/UTF8Encoding.class 
org/postgresql/core/Utils.class 
org/postgresql/core/VisibleBufferedInputStream.class 
org/postgresql/core/types/ 
org/postgresql/core/types/PGBigDecimal.class 
org/postgresql/core/types/PGBoolean.class 
org/postgresql/core/types/PGByte.class 
org/postgresql/core/types/PGDouble.class 
org/postgresql/core/types/PGFloat.class 
org/postgresql/core/types/PGInteger.class 
org/postgresql/core/types/PGLong.class 
org/postgresql/core/types/PGNumber.class 
org/postgresql/core/types/PGShort.class 
org/postgresql/core/types/PGString.class 
org/postgresql/core/types/PGType.class 
org/postgresql/core/types/PGUnknown.class 
org/postgresql/core/v2/ 
org/postgresql/core/v2/ConnectionFactoryImpl$SimpleResultHandler.class 
org/postgresql/core/v2/ConnectionFactoryImpl.class 
org/postgresql/core/v2/FastpathParameterList.class 
org/postgresql/core/v2/ProtocolConnectionImpl.class 
org/postgresql/core/v2/QueryExecutorImpl$1.class 
org/postgresql/core/v2/QueryExecutorImpl$2.class 
org/postgresql/core/v2/QueryExecutorImpl$3.class 
org/postgresql/core/v2/QueryExecutorImpl.class 
org/postgresql/core/v2/SimpleParameterList.class 
org/postgresql/core/v2/V2Query.class 
org/postgresql/core/v3/ 
org/postgresql/core/v3/CompositeParameterList.class 
org/postgresql/core/v3/CompositeQuery.class 
org/postgresql/core/v3/ConnectionFactoryImpl$1.class 
org/postgresql/core/v3/ConnectionFactoryImpl$UnsupportedProtocolException.class 
org/postgresql/core/v3/ConnectionFactoryImpl.class 
org/postgresql/core/v3/CopyInImpl.class 
org/postgresql/core/v3/CopyOperationImpl.class 
org/postgresql/core/v3/CopyOutImpl.class 
org/postgresql/core/v3/Portal.class 
org/postgresql/core/v3/ProtocolConnectionImpl.class 
org/postgresql/core/v3/QueryExecutorImpl$1.class 
org/postgresql/core/v3/QueryExecutorImpl$2.class 
org/postgresql/core/v3/QueryExecutorImpl$3.class 
org/postgresql/core/v3/QueryExecutorImpl$ErrorTrackingResultHandler.class 
org/postgresql/core/v3/QueryExecutorImpl.class 
org/postgresql/core/v3/SimpleParameterList.class 
org/postgresql/core/v3/SimpleQuery.class 
org/postgresql/core/v3/V3ParameterList.class 
org/postgresql/core/v3/V3Query.class 
org/postgresql/ds/ 
org/postgresql/ds/PGConnectionPoolDataSource.class 
org/postgresql/ds/PGPooledConnection.class 
org/postgresql/ds/PGPoolingDataSource.class 
org/postgresql/ds/PGSimpleDataSource.class 
org/postgresql/ds/common/ 
org/postgresql/ds/common/BaseDataSource.class 
org/postgresql/ds/common/PGObjectFactory.class 
org/postgresql/ds/jdbc23/ 
org/postgresql/ds/jdbc23/AbstractJdbc23PooledConnection$ConnectionHandler.class 
org/postgresql/ds/jdbc23/AbstractJdbc23PooledConnection$StatementHandler.class 
org/postgresql/ds/jdbc23/AbstractJdbc23PooledConnection.class 
org/postgresql/ds/jdbc23/AbstractJdbc23PoolingDataSource$1.class 
org/postgresql/ds/jdbc23/AbstractJdbc23PoolingDataSource.class 
org/postgresql/ds/jdbc23/AbstractJdbc23SimpleDataSource.class 
org/postgresql/fastpath/ 
org/postgresql/fastpath/Fastpath.class 
org/postgresql/fastpath/FastpathArg.class 
org/postgresql/geometric/ 
org/postgresql/geometric/PGbox.class 
org/postgresql/geometric/PGcircle.class 
org/postgresql/geometric/PGline.class 
org/postgresql/geometric/PGlseg.class 
org/postgresql/geometric/PGpath.class 
org/postgresql/geometric/PGpoint.class 
org/postgresql/geometric/PGpolygon.class 
org/postgresql/gss/ 
org/postgresql/gss/GSSCallbackHandler.class 
org/postgresql/gss/GssAction.class 
org/postgresql/gss/MakeGSS.class 
org/postgresql/jdbc2/ 
org/postgresql/jdbc2/AbstractJdbc2Array$1.class 
org/postgresql/jdbc2/AbstractJdbc2Array$PgArrayList.class 
org/postgresql/jdbc2/AbstractJdbc2Array.class 
org/postgresql/jdbc2/AbstractJdbc2Blob.class 
org/postgresql/jdbc2/AbstractJdbc2BlobClob$LOIterator.class 
org/postgresql/jdbc2/AbstractJdbc2BlobClob.class 
org/postgresql/jdbc2/AbstractJdbc2Clob.class 
org/postgresql/jdbc2/AbstractJdbc2Connection$1.class 
org/postgresql/jdbc2/AbstractJdbc2Connection$TransactionCommandHandler.class 
org/postgresql/jdbc2/AbstractJdbc2Connection.class 
org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.class 
org/postgresql/jdbc2/AbstractJdbc2ResultSet$CursorResultHandler.class 
org/postgresql/jdbc2/AbstractJdbc2ResultSet$NullObject.class 
org/postgresql/jdbc2/AbstractJdbc2ResultSet$PrimaryKey.class 
org/postgresql/jdbc2/AbstractJdbc2ResultSet.class 
org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.class 
org/postgresql/jdbc2/AbstractJdbc2Statement$BatchResultHandler.class 
org/postgresql/jdbc2/AbstractJdbc2Statement$CallableBatchResultHandler.class 
org/postgresql/jdbc2/AbstractJdbc2Statement$StatementResultHandler.class 
org/postgresql/jdbc2/AbstractJdbc2Statement.class 
org/postgresql/jdbc2/EscapedFunctions.class 
org/postgresql/jdbc2/ResultWrapper.class 
org/postgresql/jdbc2/TimestampUtils$1.class 
org/postgresql/jdbc2/TimestampUtils$ParsedTimestamp.class 
org/postgresql/jdbc2/TimestampUtils.class 
org/postgresql/jdbc2/TypeInfoCache.class 
org/postgresql/jdbc2/optional/ 
org/postgresql/jdbc2/optional/ConnectionPool.class 
org/postgresql/jdbc2/optional/PoolingDataSource.class 
org/postgresql/jdbc2/optional/SimpleDataSource.class 
org/postgresql/jdbc3/ 
org/postgresql/jdbc3/AbstractJdbc3Blob.class 
org/postgresql/jdbc3/AbstractJdbc3Clob.class 
org/postgresql/jdbc3/AbstractJdbc3Connection.class 
org/postgresql/jdbc3/AbstractJdbc3DatabaseMetaData.class 
org/postgresql/jdbc3/AbstractJdbc3ParameterMetaData.class 
org/postgresql/jdbc3/AbstractJdbc3ResultSet.class 
org/postgresql/jdbc3/AbstractJdbc3Statement.class 
org/postgresql/jdbc3/Jdbc3Array.class 
org/postgresql/jdbc3/Jdbc3Blob.class 
org/postgresql/jdbc3/Jdbc3CallableStatement.class 
org/postgresql/jdbc3/Jdbc3Clob.class 
org/postgresql/jdbc3/Jdbc3Connection.class 
org/postgresql/jdbc3/Jdbc3ConnectionPool.class 
org/postgresql/jdbc3/Jdbc3DatabaseMetaData.class 
org/postgresql/jdbc3/Jdbc3ParameterMetaData.class 
org/postgresql/jdbc3/Jdbc3PoolingDataSource.class 
org/postgresql/jdbc3/Jdbc3PreparedStatement.class 
org/postgresql/jdbc3/Jdbc3ResultSet.class 
org/postgresql/jdbc3/Jdbc3ResultSetMetaData.class 
org/postgresql/jdbc3/Jdbc3SimpleDataSource.class 
org/postgresql/jdbc3/Jdbc3Statement.class 
org/postgresql/jdbc3/PSQLSavepoint.class 
org/postgresql/largeobject/ 
org/postgresql/largeobject/BlobInputStream.class 
org/postgresql/largeobject/BlobOutputStream.class 
org/postgresql/largeobject/LargeObject.class 
org/postgresql/largeobject/LargeObjectManager.class 
org/postgresql/ssl/ 
org/postgresql/ssl/MakeSSL.class 
org/postgresql/ssl/NonValidatingFactory$NonValidatingTM.class 
org/postgresql/ssl/NonValidatingFactory.class 
org/postgresql/ssl/WrappedFactory.class 
org/postgresql/util/ 
org/postgresql/util/Base64.class 
org/postgresql/util/GT.class 
org/postgresql/util/MD5Digest.class 
org/postgresql/util/PGInterval.class 
org/postgresql/util/PGbytea.class 
org/postgresql/util/PGmoney.class 
org/postgresql/util/PGobject.class 
org/postgresql/util/PGtokenizer.class 
org/postgresql/util/PSQLDriverVersion.class 
org/postgresql/util/PSQLException.class 
org/postgresql/util/PSQLState.class 
org/postgresql/util/PSQLWarning.class 
org/postgresql/util/ServerErrorMessage.class 
org/postgresql/util/StreamWrapper.class 
org/postgresql/util/UnixCrypt.class 
org/postgresql/xa/ 
org/postgresql/xa/PGXAConnection$ConnectionHandler.class 
org/postgresql/xa/PGXAConnection.class 
org/postgresql/xa/PGXADataSource.class 
org/postgresql/xa/PGXADataSourceFactory.class 
org/postgresql/xa/PGXAException.class 
org/postgresql/xa/RecoveredXid.class 
org/postgresql/translation/ 
org/postgresql/translation/messages_bg.class 
org/postgresql/translation/messages_cs.class 
org/postgresql/translation/messages_de.class 
org/postgresql/translation/messages_es.class 
org/postgresql/translation/messages_fr.class 
org/postgresql/translation/messages_it.class 
org/postgresql/translation/messages_ja.class 
org/postgresql/translation/messages_nl.class 
org/postgresql/translation/messages_pl.class 
org/postgresql/translation/messages_pt_BR.class 
org/postgresql/translation/messages_ru.class 
org/postgresql/translation/messages_sr.class 
org/postgresql/translation/messages_tr.class 
org/postgresql/translation/messages_zh_CN.class 
org/postgresql/translation/messages_zh_TW.class 
META-INF/services/ 
META-INF/services/java.sql.Driver 
[email protected]:~/postgres$ 
[email protected]:~/postgres$ 

,並有你class:org.postgresql.jdbc3.Jdbc3PoolingDataSource

因此,假如這個JAR在你的類路徑上,你現在應該能夠將這個類導入到你的代碼中。

當您在stackoverflow上提出問題時,請包含實際的代碼示例和堆棧跟蹤。

希望幫助:)

順便說一下,問題只是你使用的JDBC4司機需要JDBC3驅動程序時。沒什麼大不了。

相關問題