Hi,

I was a beginner in java.I was trying to connect to database(oracle) with the deatails

user:scott pass:tiger host string: PC0128166 with code as

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
     
connection =DriverManager.getConnection("jdbc:odbc:abhi","scott","tiger");

But i was getting the error as

Exception is ;java.sql.SQLException: [Microsoft][ODBC driver for Oracle][Oracle]ORA-12560: TNS:protocol adapter error

problem is the same error i was getting when i was logging into oracle from oracle console uname:scott
pass:tiger and host string as empty.
so i want to know how to connect to database using host string in jdbc connection

Recommended Answers

All 3 Replies

Use the Oracle JDBC Driver not the JDBC-ODBC Bridge.

Did u mean using jdbc 4th type driver.

If so means please help me by telling the

syntax of that driver

read the product documentation for the Oracle JDBC driver. It'll tell you how to connect.

And please don't do this from a JSP. JSP aren't meant for doing business logic, and should never contain Java code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.