nico
发贴: 1
积分: 0
|
于 2005-11-22 17:09
Hello ,
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 , Nico
|