Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: JDBC Oracle Driver ERROR?

Re: JDBC Oracle Driver ERROR?

From: Matt <mattdee89_at_hotmail.com>
Date: Sun, 30 Sep 2001 07:10:52 GMT
Message-ID: <0Azt7.1407$M03.121258@typhoon1.gnilink.net>


Tomasz,
Two lines of thought here...
1) Is your database using MTS? This would cause a problem because MTS DOES NOT create exclusive PGA for the user session in the SGA, therefore the 'client' has nothing to 'bind' to.... Every time the client issues a DML statement he is creating new session with new PGA id...

2) I would try implementing a bean for the connection handling route that can by interfaced by the bean... Two reasons for this...1)Bean is responsible for managing the connection and not the client code... and 2)New the future when you migrate to Oracle8x or Oracle9i just changing the JDBC connection in the bean migrates ALL your clients....

--
Cheers,
Matt

"In a world without walls or fences, who needs Windows or Gates?"

"Tomasz Olchawa" <thm_at_parasoft.com.pl> wrote in message
news:9p1a6p$gt7$1_at_news.formus.pl...

> I have problem.
>
> This simple program create connection to database ( Oracle ).
> If you press button 'connect' and program create connection and then you
> break connection (e.g. physically - pull out network cable ) and then you
> press button 'connect' you receive SQLException:
> "java.sql.SQLException: Wyj?tek we-wy: The Network Adapter could not
> establish the connection"
> It's OK, because when you recreate connection ( e.g. put in network
cable )
> and then press button 'connect' everything is OK - you have again
connection
> to database.
>
> Problem is:
> When you haven't connection to database ( e.g. - network cable is pull
out )
> and then you press button 'connect' you received SQLException and
> you never can create connection during work this program - you MUST
RESTART
> THIS PROGRAM..
>
> Help me:
> Do you known how fix this problem?
>
> //------------------------------------------------------------------------
> // simple program
> //------------------------------------------------------------------------
>
> import java.sql.*;
> import java.awt.*;
> import java.awt.event.*;
> import javax.swing.*;
>
> public class Test extends Frame implements ActionListener
> {
> static String url = "jdbc:oracle:thin:@host.com.pl:1521:sid1";
> static String driver = "oracle.jdbc.driver.OracleDriver";
> static String user ="scott";
> static String pass = "tiger";
>
> Label label = null;
> Button button = null;
>
> public static void main(String args[])
> {
> new Test();
> }
>
> private void connect()
> {
> try {
> Class.forName(driver);
> } catch (ClassNotFoundException e) {
> label.setText("Can't load driver");
> return;
> }
> try {
> Connection con = DriverManager.getConnection(url, user, pass);
> } catch (SQLException e) {
> label.setText("Can't connect");
> return;
> }
> label.setText("Success!!!");
> }
>
> Test()
> {
> super("JDBC test");
> label = new Label("Status: not connected");
> button = new Button("connect");
> button.addActionListener(this);
> this.setLayout(new BorderLayout());
> this.add(label, "Center");
> this.add(button, "South");
>
> pack();
> show();
> }
> public void actionPerformed(ActionEvent e)
> {
> label.setText("connecting ....");
> connect();
> }
> }
>
> ------------------------------------------------------------------------
>
> I have:
> - Java(TM) 2 SDK, Standard Edition Version 1.3.1
> - Oracle 8i
> - classes12.zip ( 1 931 357 Kb )
>
> Best Regards,
> Tomek
>
>
Received on Sun Sep 30 2001 - 02:10:52 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US