Posted By:
Deve_Reddy
Posted On:
Wednesday, March 10, 2004 01:19 AM
HI All I have a conncetion class which is shown here,when i try to connect to informix,giving error like this.."read only mode not supported" any othed code snippet to connect... help will be appreciated.. regds here is the code:: <%@ page language="java" import="java.io.*,javax.rmi.*,javax.naming.*,javax.ejb.*,java.util.*,java.sql.*,javax.sql.*"%> <% Connection con=null; PreparedStatement pst=null; Statement stmt=null; ResultSet rs=null; try { Context ctx=new InitialContext(); DataSource ds=(DataSource)ctx.lookup("jdbc/myjndi"); con=ds.getConnection(); out
More>>
HI All
I have a conncetion class which is shown here,when i try to connect to informix,giving error like this.."read only mode not supported" any othed code snippet to connect...
help will be appreciated..
regds
here is the code::
<%@ page language="java" import="java.io.*,javax.rmi.*,javax.naming.*,javax.ejb.*,java.util.*,java.sql.*,javax.sql.*"%>
<%
Connection con=null;
PreparedStatement pst=null;
Statement stmt=null;
ResultSet rs=null;
try
{
Context ctx=new InitialContext();
DataSource ds=(DataSource)ctx.lookup("jdbc/myjndi");
con=ds.getConnection();
out.println("Informix Database Connection Sucess" + "
");
out.println(con.getAutoCommit());
con.setAutoCommit(false);
out.println(con.getAutoCommit());
stmt=con.createStatement();
try{
rs=stmt.executeQuery("select * from maxx_users");
while(rs.next())
{
out.println(rs.getString(1) + " " + rs.getString(2) + "
");
}
}
catch(SQLException s){
out.println(s.getMessage()+","+ s.getErrorCode());
}
}
catch(SQLException e)
{
out.println(e.getMessage()+","+ e.getErrorCode());
}
%>
<<Less