• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How do I retrieve an SQLWarning?

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to connect to my database but am getting an error message that says:
java.sql.SQLException: JZ00L: Login failed. Examine the SQLWarnings chained to this exception for the reason(s).
How do I retrieve the SQLWarning from the SQLException. I know SQLWarning is a subclass of SQLException, but I can't find anywhere in Sun's documentation on how to retrieve the warnings.
Not that it matters, but I am using jdbc to connect to Sybase 12.
Thanks
------------------
 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi James,
Here is how you can retrieve SQLWarnings -
private static boolean checkForWarning (SQLWarning warn) throws SQLException {
boolean rc = false;
// If a SQLWarning object was given, display the
// warning messages. Note that there could be
// multiple warnings chained together
if (warn != null) {
System.out.println ("\n *** Warning ***\n");
rc = true;
while (warn != null) {System.out.println ("SQLState: " +
warn.getSQLState ());System.out.println ("Message: " +
warn.getMessage ());System.out.println ("Vendor: " +
warn.getErrorCode ());System.out.println ("");
warn = warn.getNextWarning ();}}return rc;

Regards,
Milind

[This message has been edited by Milind Kulkarni (edited July 26, 2000).]
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Milind Kulkarni wrote:Hi James,
Here is how you can retrieve SQLWarnings -
private static boolean checkForWarning (SQLWarning warn) throws SQLException {
boolean rc = false;
// If a SQLWarning object was given, display the
// warning messages. Note that there could be
// multiple warnings chained together
if (warn != null) {
System.out.println ("\n *** Warning ***\n");
rc = true;
while (warn != null) {System.out.println ("SQLState: " +
warn.getSQLState ());System.out.println ("Message: " +
warn.getMessage ());System.out.println ("Vendor: " +
warn.getErrorCode ());System.out.println ("");
warn = warn.getNextWarning ();}}return rc;

Regards,
Milind

[This message has been edited by Milind Kulkarni (edited July 26, 2000).]



Hi, i am having the same problem right now. I dont open a new thread for this, because this is already open.

My problem:

I am trying to connect to a SyBase Database named 'pacientesdb' running in an Adaptive Server Anywhere 8, from a java application. I am using jconnect 6.0, and my connection method (wich can connect to an ASE 9 configured locally for development) is:



But I get the error :

getConnection failed: java.sql.SQLException: JZ00L: Login failed. Examine the SQLWarnings chained to this exception for the reason(s).

I try to change the url to:

- "jdbc:sybase:Tds:192.168.0.101:2368/pacientesdb"
- "jdbc:sybase:Tds:192.168.0.101:2368/pacientesdb?charset=iso_1"
- "jdbc:sybase:Tds:192.168.0.101:2368/?charset=iso_1"

I try with diferent charsets but nothing works.

I need help to solve this.

Hugs,

Juan Manuel
 
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi, i am having the same problem right now. I dont open a new thread for this, because this is already open.

No you don't. Please reread the (very old - 9 years) original post. The person does not have your issue. He wants to retrieve warnings. You want to resolve a connection error.
 
Juan Manuel Diaz
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jan Cumps wrote:

Hi, i am having the same problem right now. I dont open a new thread for this, because this is already open.

No you don't. Please reread the (very old - 9 years) original post. The person does not have your issue. He wants to retrieve warnings. You want to resolve a connection error.



Was that necessary?,

JM
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Juan Manuel Diaz wrote:

Jan Cumps wrote:

Hi, i am having the same problem right now. I dont open a new thread for this, because this is already open.

No you don't. Please reread the (very old - 9 years) original post. The person does not have your issue. He wants to retrieve warnings. You want to resolve a connection error.



Was that necessary?,

JM


Jan's point was that we like it when people open new threads for new questions.

Now back to your question - does your username/password work at the command line?
 
Juan Manuel Diaz
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:

Juan Manuel Diaz wrote:

Jan Cumps wrote:

Hi, i am having the same problem right now. I dont open a new thread for this, because this is already open.

No you don't. Please reread the (very old - 9 years) original post. The person does not have your issue. He wants to retrieve warnings. You want to resolve a connection error.



Was that necessary?,

JM


Jan's point was that we like it when people open new threads for new questions.

Now back to your question - does your username/password work at the command line?




I recently discover that the username or the permisions asigned to that username are the problem. I tried to connect with dba/sql user and password, and the connection works!!.... I tall that to the database administator, i suppouse that she will do something with that. Now i am having a new problem, i can not force to connect to an especific database, i will open a new thread for that...!!

Best Regards,

JM
 
Everybody! Do the Funky Monkey! Like this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic