Tutorials to .com

Tutorials to .com » Jsp » Database » Oracle8 a jdbc connection examples (local page can )!!!!

Oracle8 a jdbc connection examples (local page can )!!!!

Print View , by: iSee ,Total views: 10 ,Word Count: 241 ,Date: Sun, 19 Apr 2009 Time: 12:07 AM

try (
/ / Load an Oracle-driven
DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver ());
/ / Connect to the database using the OCI8
conn = DriverManager.getConnection ( "jdbc: oracle: oci8: @ DatabaseName" +, "user", "password");
) catch (SQLException e) (/ / capture SQL offenders
System.out.println ( "Ora8iConnect connecting capture oracle8 database");
while (e! = null)
(System.out.println ( "SQLState:" + e.getSQLState ());
System.out.println ( "Message:" + e.getMessage ());
System.out.println ( "Vendor:" + e.getErrorCode ());
e = e.getNextException ();
System.out.println ( "");
)
conn = null;
)

try (
Class.forName ( "oracle.jdbc.driver.OracleDriver"). NewInstance ();
/ / orcl is the SID of your database
String url = "jdbc: oracle: thin: @ localhost: 1521: orcl";
Connection conn = DriverManager.getConnection (url, "user", "password");
) catch (SQLException e) (/ / capture SQL offenders
System.out.println ( "Ora8iConnect connecting capture oracle8 database");
while (e! = null)
(System.out.println ( "SQLState:" + e.getSQLState ());
System.out.println ( "Message:" + e.getMessage ());
System.out.println ( "Vendor:" + e.getErrorCode ());
e = e.getNextException ();
System.out.println ( "");
)
conn = null;
)


Jsp And Database Articles


Can't Find What You're Looking For?


Rating: Not yet rated

Comments

No comments posted.