jbuider + servlet +jdbc的问题?真情给分!!!

david_chen 2002-08-15 03:46:18


首先:我的oracle的jdbc已经配置好:用database pilot 可以连接而且,用dataExpress 组件也能测试OK.
为什么在以servlet+tomcat在jB的IDE中 RUN 时总是报错:
The driver: oracle.jdbc.driver.OracleDriver could not be loaded. This could be a problem with the driver itself, or that the driver is not found on the classpath.

See com.borland.dx.dataset.DataSetException error code: BASE+83

com.borland.dx.dataset.DataSetException: The driver: oracle.jdbc.driver.OracleDriver could not be loaded. This could be a problem with the driver itself, or that the driver is not found on the classpath.

是否是tomcat没有配置对????

请教各位,同时给分!!!!

...全文
29 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
david_chen 2002-08-15
  • 打赏
  • 举报
回复
代码如下:

public class DbServlet extends HttpServlet
{
private Database database1 = new Database();
private QueryDataSet queryDataSet1 = new QueryDataSet();

// Database connection information. Modify to match your database setup.
private String url = "jdbc.oracle:thin:@192.168.3.36:1521:DAVIDS";
private String userName = "SYSTEM";
private String password = "manager";
private String driver = "oracle.jdbc.driver.OracleDriver";
private String query = "select CONDITIONNO, HSTAMP from CNTMI.STAMPCONDITION";


//Process the HTTP Get request
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
ObjectOutputStream dbStream = null;
DataSetData data = null;

try
{
database1.setConnection(new com.borland.dx.sql.dataset.ConnectionDescriptor(url, userName, password, false, driver));
queryDataSet1.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(database1, query, null, true, Load.ALL));
queryDataSet1.open();

data = DataSetData.extractDataSet( queryDataSet1 );

// Get the response stream so we can write the object to it.
dbStream = new ObjectOutputStream( response.getOutputStream() );
// Write the object...
dbStream.writeObject( data );
}
catch( DataSetException e )
{
System.err.println( "DataSetException caught in DbServlet.doGet()" );
System.err.println( e.getMessage() );
e.printStackTrace( System.err );
}
finally
{
if( dbStream != null )
{
dbStream.flush();
dbStream.close();
}

try
{
queryDataSet1.close();
database1.closeConnection();
}
catch( DataSetException ee )
{
System.err.println( "DataSetException caught in DbServlet.doGet()" );
System.err.println( ee.getMessage() );
ee.printStackTrace( System.err );
}
}
}

qilong2000 2002-08-15
  • 打赏
  • 举报
回复
你应该把数据库连接的代码
写出来
才可以看到问题。
你应该把oracle的驱动类
放到你的classpath
你也可以用classforName()
来装载驱动

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧