Hello :),
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 to a standalone application the program still runs fine but it can’t find the database driver, though 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/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.
How can I set the driver that way that the information to load it when needed is exported with the product?
Just copying/exporting the driver jar file into the products' folder doesn't help :(
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
--
View in EZ forum: http://www.eclipsezone.com/eclipse/forums/m91955560.html