Linux+Java+Odbc+Progres

Status
Not open for further replies.
G

Guillermo

Guest
Hi I need to connect a Java Application on a Linux server to Progress database. I use to connect an odbc configured on Linux server, it work correctly, from command line can I make querys. The problem is when I try to get the connection connect from Java Application I'm getting a null pointer.

Java version 1.6.0_45 OS: CentOS release 6.5 ODBC Progress: working OK

This is the body of a method to test de Insert into Progress

try {
String bd = "dbToWrite";
String url = "jdbc:eek:dbc:" + bd;
String user = "root";
String psw = "root";
Connection con;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection(url, user, psw);
PreparedStatement ps1 = con.prepareStatement("INSERT INTO PUB.\"mo-chsu\" "
+ "(\"c-expt\", \"c-tisu\", \"i-cheq\","
+ " \"c-a#o\", nombre, apellido, "
+ "\"n-tarj\", \"c-cat\", varios, "
+ "\"s-sac\", embar, otros, "
+ "jubi, \"ti-doc\", \"num-doc\", "
+ "\"co-min\", \"n-liq\", fonavi,"
+ " club,\"n-mes\", anioe)"
+ "VALUES (9999,999,9999.99,"
+ "2014,'XXXX','XXXX',"
+ "999,5,888.88,"
+ "1.0,2.0,3.0,"
+ "4.44,9,99999999,"
+ "1,9,3000,"
+ "30.0,9,2014)");
ps1.execute();

con.close();
} catch (Exception e) {
e.printStackTrace();
}


The Exception is, doesn't say too much:

java.lang.NullPointerException
at sun.jdbc.odbc.JdbcOdbcDriver.initialize(JdbcOdbcDriver.java:436)
at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:153)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at Main.conexionProgress(Main.java:23)
at Main.main(Main.java:10)


I think the problem is a library on Java... but I can find witch one.

Please give me a hand! Thanks Sorry my english :)

Continue reading...
 
Status
Not open for further replies.
Top