Results 1 to 3 of 3
Thread: database Connectivity
- 08-27-2010, 04:51 PM #1
Member
- Join Date
- Apr 2010
- Posts
- 7
- Rep Power
- 0
database Connectivity
hiii
please help me out i am not able to connect to Data Base: i get an Exception like:
ORA-12514:TNS:listner could not resolve SERVICE_NAME given in connect desriptor
DataSourceName: Oracle
Platform:Windows XP
my code:
public static void main(String[] args) {
String driver="sun.jdbc.odbc.JdbcOdbcDriver";
String cs="jdbc:odbc:Oracle";
String user = "scott";
String pwd = "tiger";
String sqlstmt="INSERT INTO STUDENT VALUES(2,'Steve',50)";
Connection con = null;
Statement st = null;
try
{
Class.forName(driver);
}
catch(Exception e)
{
System.out.println(e);
}
System.out.println("Driver loaded");
try
{
con=DriverManager.getConnection(cs,user,pwd);
System.out.println("Connected to the Oracle Database");
st = con.createStatement();//creates a Statement object for sending SQL statements to the database.
int updatecount=st.executeUpdate(sqlstmt);//return either the row count for INSERT, UPDATE or DELETE statements, or 0 for SQL statements that return nothing
System.out.println(updatecount+" row inserted");
}
catch(Exception e)
{
System.out.println(e);
}
try
{
st.close();
con.close();
}
catch(Exception e)
{
System.out.println(e);
}
}//main()
}//class()
- 08-29-2010, 01:27 AM #2
Senior Member
- Join Date
- Jun 2007
- Location
- Bali, Indonesia
- Posts
- 696
- Rep Power
- 6
Hi,
What version of Oracle database that you are using? And why are you using a JDBC ODBC bridge instead of Oracle JDBC driver?Website: Learn Java by Examples
- 08-29-2010, 04:56 AM #3
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Similar Threads
-
applet with database connectivity
By priyacvr in forum Java AppletsReplies: 13Last Post: 05-06-2010, 07:44 PM -
Database connectivity
By rajiparth in forum JDBCReplies: 1Last Post: 04-07-2009, 07:39 PM -
database connectivity
By rilwanfit in forum NetworkingReplies: 1Last Post: 03-13-2009, 07:54 PM -
database connectivity
By vani in forum EclipseReplies: 0Last Post: 11-21-2008, 10:03 AM -
java with database connectivity
By thamizhisai in forum New To JavaReplies: 2Last Post: 04-26-2008, 10:53 PM


LinkBack URL
About LinkBacks


Bookmarks