HY!
I am new to oracel i had run the JdbcCheckup programme provided with oracle but when ever i run i get neither output nor any error.
I had created a table BOOKING and I am quering the same table form the programme-:
the code import java.io.*;
import java.sql.*;
class JdbcCheckup
{
public static void main(
String args[])
throws SQLException,IOException
{
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
System.out.println("pls enter inf. to enter
test connection");
String user;
String password;
String database;
user = readEntry("user: ");
int slash_index = user.indexOf('/');
if(slash_index != -1)
{
password = user.substring(slash_index +1);
user = user.substring(0, slash_index);
}
else
password = readEntry("pasword");
database = readEntry("database (a TNSNAME entry): ");
System.out.print("Connecting to database");
System.out.flush();
System.out.println("Connecting...");
Connection conn = DriverManager.getConnection("jdbc
racle
ci8:@" + database,user,password);
System.out.println("connected");
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery("select consignor from BOOKING;");
System.out.println(rset.getString(1));
//System.out.println("your
JDBC connection is OK!");
rset.close();
stmt.close();
conn.close();
}
static String readEntry(String prompt)
{
try
{
StringBuffer buffer = new StringBuffer();
System.out.print(prompt);
System.out.flush();
int c = System.in.read();
while(c != '\n' && c!= -1)
{
buffer.append((char)c);
c=System.in.read();
}
return buffer.toString().trim();
}
catch (IOException e)
{
return "";
}
}
}