JDBC Connection
Date: Sun, 11 Nov 2001 23:36:12 -0500
Message-ID: <3BEF51BC.E6B819CD_at_hotmail.com>
Hello,
I'm trying to test JDBC connections with 'JdbcCheckup.java' file that
comes with Oracle 8i in the
This is what I did:
$ java JdbcCheckup
'$ORACLE_HOME/jdbc/demo/samples/oci8/basic-samples' directory.
Please enter information to test connection to the database
user: system/manager
database (a TNSNAME entry): sun0:1521:db0
sun0 - machine name 1521 - listener port db0 - database instance
This is the code segment that handles the above:
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 ("password: "); database = readEntry ("database (a TNSNAME entry): ");
System.out.print ("Connecting to the database..."); System.out.flush ();
System.out.println ("Connecting..."); Connection conn = DriverManager.getConnection ("jdbc:oracle:oci8:_at_" + database, user, password);
This is the line from '/etc/services':
listener 1521/tcp # Net8 listener
Connection failed with the following exception:
Connecting to the database...Connecting... Exception in thread "main" java.sql.SQLException: ORA-06401: NETCMN: invalid driver designator
at java.lang.Throwable.fillInStackTrace(Native Method) at java.lang.Throwable.fillInStackTrace(Compiled Code) at java.lang.Throwable.<init>(Compiled Code) at java.lang.Exception.<init>(Exception.java:42) at java.sql.SQLException.<init>(SQLException.java:43) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:114) at oracle.jdbc.oci8.OCIDBAccess.check_error(OCIDBAccess.java:1500) at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:310) at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:200) at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:251) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:224) at java.sql.DriverManager.getConnection(Compiled Code) at java.sql.DriverManager.getConnection(DriverManager.java:137) at JdbcCheckup.main(Compiled Code)
$
Could anyone please point my mistake?
Thank you