Cant connect to 11g database [message #458312] |
Fri, 28 May 2010 10:21 |
hristo
Messages: 258 Registered: May 2007
|
Senior Member |
|
|
Hi!
Im using JDev10135 and trying to develop (well, small changes of an existing app) a application that shall connect to my 11g database (on my laptop).
When running in offline mode (no DB connection everythings runs ok) but when trying, my connection fails with:
java.lang.NullPointerException
at pall.data.DbConnection.<init>(DbConnection.java:51)
at pall.data.DataCommon.<init>(DataCommon.java:148)
at pall.PaLLmeny.<init>(PaLLmeny.java:80)
at pallehandel.PaLLehandel.<init>(PaLLehandel.java:45)
at pallehandel.PaLLehandel.main(PaLLehandel.java:139)
Very strange errors as they dont seems do have anything to do with an db connection.
The connection:
try {
dbcon = new DbConnection(bundle.getString("DRIVER"),bundle.getString("testURL"),"test","test");
} catch (java.sql.SQLException ex) {
DataCommon.handleError("DataCommon() new DbConnection()", ex, "Cant connect to DB", true, true, parent);
System.exit(0);
} catch (Exception e) {
DataCommon.handleError("DataCommon() new DbConnection()", e, "Cant connect to DB", true, true, parent);
e.printStackTrace();
System.exit(0);
The printstack gives the error you saw earlier.
The resource.properties file:
DRIVER=oracle.jdbc.OracleDriver
testURL=jdbc:oracle:thin:@ATT-M4400.pyroit.local:1521:TEST
USER=test
PASS=test
So, how do I proceed? I can connect with the user/passw with SQLPLUS.
This app works fine when connecting to the database located on the server. But I took an export of the schema and put it in my 11201 database (the server one is 10203) and now it don't work. The customers VPN is so slow, I cant use it. Thats why I want to have the database on my computer.
Any ideas?
Regards
H
[Updated on: Fri, 28 May 2010 11:28] by Moderator Report message to a moderator
|
|
|
Re: Cant connect to 11g database [message #458331 is a reply to message #458312] |
Fri, 28 May 2010 11:29 |
|
Michel Cadot
Messages: 68731 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Try to put the strings that are inside the file into the connection string as constants to see if the error really comes from Oracle (nothing prove it in your post) or from another error:
DbConnection("oracle.jdbc.OracleDriver", "jdbc:oracle:thin:@ATT-M4400.pyroit.local:1521:TEST", "test", "test");
Regards
Michel
[Updated on: Fri, 28 May 2010 11:30] Report message to a moderator
|
|
|
|
|
|
Re: Cant connect to 11g database [message #458608 is a reply to message #458543] |
Mon, 31 May 2010 11:33 |
|
Alessandro Rossi
Messages: 166 Registered: September 2008 Location: Rome
|
Senior Member |
|
|
What driver or framework are you using that defines class pall.data.DbConnection?
I use JDev quite often but I always opted for the standard oracle one with the classe oracle.jdbc.OracleConnection or the Sun one with java.sql.Connection.
Are you sure that SQLExceptions aren't catched (and eventually bad handled) inside the DbConnection constructor for an unexpected situation (like case sensitive authentication)?
Bye Alessandro
[Updated on: Mon, 31 May 2010 11:34] Report message to a moderator
|
|
|
Re: Cant connect to 11g database [message #458620 is a reply to message #458543] |
Mon, 31 May 2010 13:11 |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
hristo wrote on Mon, 31 May 2010 10:15What do you mean, which line is that?
It is the line throwing the Exception, as you can see from the stacktrace. I suspect (and so does Alessandro) that you use some custom DbConnection class. Therefor I asked you what is on line 5 in that clase, as that line throws the NPE.
If you don't have the source code for it, use a decompiler to see what it is failing on.
|
|
|