rorymurray
Programmer
Hi,
I have been trying to setup a JDBC conneciton to a database so I can run an applet to add, remove and search a database from the web.
The message:"SQLException: Io exception: SO Exception was generated" is output when I choose the particular option that tries to connect to the database, and no data is returned.
My code is below:
import java.sql.*;
import java.sql.ResultSet;
import java.util.*;
public class DBConnect
{
String results = "";
public DBConnect()
{
Connection connection = null;
Statement stmt = null;
ResultSet resultSet = null;
try
{
Class.forName("oracle.jdbc.driver.OracleDriver"
}
catch(java.lang.ClassNotFoundException e)
{
System.err.print("ClassNotFoundException: "
System.err.println(e.getMessage());
}
try
{
connection = DriverManager.getConnection("jdbcracle:thincutds.cuin.edu.au", "username", "password"
stmt = connection.createStatement();
resultSet = stmt.executeQuery("SELECT salary FROM answer"
results=resultSet.getString("salary"
}
catch(java.sql.SQLException ex)
{
System.err.print("SQLException: "
System.err.println(ex.getMessage());
}
try
{
if (stmt!=null)
{stmt.close();}
if (connection!=null)
{connection.close();}
}
catch(Exception e)
{
e.printStackTrace();
}
}//end
public String getResults()
{
return results;
}
//-----------------
Anyone know what an SO Exception is?
I have been trying to setup a JDBC conneciton to a database so I can run an applet to add, remove and search a database from the web.
The message:"SQLException: Io exception: SO Exception was generated" is output when I choose the particular option that tries to connect to the database, and no data is returned.
My code is below:
import java.sql.*;
import java.sql.ResultSet;
import java.util.*;
public class DBConnect
{
String results = "";
public DBConnect()
{
Connection connection = null;
Statement stmt = null;
ResultSet resultSet = null;
try
{
Class.forName("oracle.jdbc.driver.OracleDriver"
}
catch(java.lang.ClassNotFoundException e)
{
System.err.print("ClassNotFoundException: "
System.err.println(e.getMessage());
}
try
{
connection = DriverManager.getConnection("jdbcracle:thincutds.cuin.edu.au", "username", "password"
stmt = connection.createStatement();
resultSet = stmt.executeQuery("SELECT salary FROM answer"
results=resultSet.getString("salary"
}
catch(java.sql.SQLException ex)
{
System.err.print("SQLException: "
System.err.println(ex.getMessage());
}
try
{
if (stmt!=null)
{stmt.close();}
if (connection!=null)
{connection.close();}
}
catch(Exception e)
{
e.printStackTrace();
}
}//end
public String getResults()
{
return results;
}
//-----------------
Anyone know what an SO Exception is?