Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Database/JDBC/SQL/JDO/Hibernate » Other DB  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 Need help with the database driver in a RCP-App
nico





发贴: 1
积分: 0
于 2005-11-22 17:09 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
Hello Wink,

First of all, sorry that this is in english but my chinese is far from good ^^
If you are able to help me, post in chinese or english, I will get it translated if necessary ^^

I am ceating my very first RCP Application which is supposed to have a database connection implemented. When I run and test the app in eclipse, it runs correctly and the database connectivity is working as supposed. After exporting the product into a standalone application the program still runs fine but it can’t find the database driver and therefore it is not able to establish a connection to my database.

I already tried setting an absolute driver path, which lead to an error because the driver wasn’t loaded by a class loader before. The same should happen with a relative path (e.g. System.getProperty(“user.dir”) + path) ).

Neither the trial of declaring a class-path for the driver in the plugin manifest file nor putting and importing the file through the java-homepath/lib/ext folder works.

As said, running in eclipse is not a problem since eclipse knows that it has to load it first (project > properties > build path > libraries > add external jars).
Since I’m not that experienced yet, I am very thankful for every kind of help/hints about how to declare / set the driver that way that it can be found by the program after it has been exported into a standalone application.

I’m using the database “firebird“ and the current “jaybird-full-2.0.0.jar” driver.

Please, has anyone an idea what to do and how to fix my little problem ?

Example code…:

private void openDB()
{
  int i = 0;
  Connection conn = null;
  Statement stmt = null;
  ResultSet rs = null;

try
  {     
    Properties props = new Properties();
    props.setProperty("user", "bern");
    props.setProperty("password", "12345");
    props.setProperty("sqlDialect", "3");
    props.setProperty("charSet", "Cp1252"); // the WIN1252 char set
    props.setProperty("roleName", "ROLE_MA");    
           
    Class.forName("org.firebirdsql.jdbc.FBDriver");
    conn  = DriverManager.getConnection("jdbc:firebirdsql:bln9y22c/3050:c://firebird/db/prozerf.gdb", props);
    stmt = conn.createStatement();
    stmt.setQueryTimeout(0);             
    rs = stmt.executeQuery(querytext);
  
    ResultSetMetaData rsmd = rs.getMetaData();
    int j, n = rsmd.getColumnCount();
    ….
… and then the resultstrings’ values are put into a table…

Thanks in advance Smile ,
Nico




话题树型展开
人气 标题 作者 字数 发贴时间
9454 Need help with the database driver in a RCP-App nico 2448 2005-11-22 17:09

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923