Hi
I have just started learning Swing.
What I am trying to do: Creating an application which will retrieve some data from a Oracle Database.
What I have done so far: I am trying to connect to the Database first and I wish to proceed further once the connection is established.
PROBLEM: I am getting the following error when I run the application: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
Code:- (this is just the code for the Button Click. Filename:DesktopApplicationView.java )
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String s=null;
String ret_msg;
String messg=null;
Object env_name=jComboBox1_EnvNames.getSelectedItem();
s=env_name.toString();
jTextField2.setText(s);
Connection conn;//This is the point from where I feel the real problem begins
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
conn=DriverManager.getConnection("jdbc:oracle:thin:@10.*.*.*:1523:oron","user","pass");
ret_msg="Connection to the DB Established";
}
catch (ClassNotFoundException c)
{
ret_msg=c.toString();
System.out.println(ret_msg);
}
catch (SQLException sq_ex)
{
ret_msg=sq_ex.toString();
System.out.println(ret_msg);
}
jTextField3.setText(ret_msg); //I am expecting it to return: 'Connection to the DB Established' but instead it returns the error message.
}
Some Facts:-
*The database I am trying to connect to is huge. Is that a problem? I tried connecting to the database through a standalone program and it worked.
*I tried to make a separate class to do all the database related work and call it through this class but it throws the same error.
*I am new to Swing...just started yesterday...so anything which makes you say
<removed inappropriate content>
[jc: removed four letter words from the post. Please mind your language]
I have just started learning Swing.
What I am trying to do: Creating an application which will retrieve some data from a Oracle Database.
What I have done so far: I am trying to connect to the Database first and I wish to proceed further once the connection is established.
PROBLEM: I am getting the following error when I run the application: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
Code:- (this is just the code for the Button Click. Filename:DesktopApplicationView.java )
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String s=null;
String ret_msg;
String messg=null;
Object env_name=jComboBox1_EnvNames.getSelectedItem();
s=env_name.toString();
jTextField2.setText(s);
Connection conn;//This is the point from where I feel the real problem begins
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
conn=DriverManager.getConnection("jdbc:oracle:thin:@10.*.*.*:1523:oron","user","pass");
ret_msg="Connection to the DB Established";
}
catch (ClassNotFoundException c)
{
ret_msg=c.toString();
System.out.println(ret_msg);
}
catch (SQLException sq_ex)
{
ret_msg=sq_ex.toString();
System.out.println(ret_msg);
}
jTextField3.setText(ret_msg); //I am expecting it to return: 'Connection to the DB Established' but instead it returns the error message.
}
Some Facts:-
*The database I am trying to connect to is huge. Is that a problem? I tried connecting to the database through a standalone program and it worked.
*I tried to make a separate class to do all the database related work and call it through this class but it throws the same error.
*I am new to Swing...just started yesterday...so anything which makes you say
<removed inappropriate content>
[jc: removed four letter words from the post. Please mind your language]