The code for connecting an informix database instance Using jsp is as follows:
- <% @ Page contenttype = "text/html; charset = gb2312" %>
- <% @ Page import = "java. SQL. *" %>
- <Html>
- <Body>
- <% Class. forname ("com. informix. jdbc. ifxdriver"). newinstance ();
- String url =
- "Jdbc: informix-sqli: // 123.45.67.89: 1533/testdb: informixserver = myserver;
- User = testuser; password = testpassword ";
- // Testdb is your database name
- Connection conn = drivermanager. getconnection (url );
- Statement stmt = conn. createstatement (resultset. type_scroll_sensitive, resultset. concur_updatable );
- String SQL = "select * from test ";
- Resultset rs1_stmt.exe cutequery (SQL );
- While (rs. next () {%>
- The content of your first field is: <% = rs. getstring (1) %>
- Your second field content is: <% = rs. getstring (2) %>
- <% }%>
- <% Out. print ("database operation successful, congratulations"); %>
- <% Rs. close ();
- Stmt. close ();
- Conn. close ();
- %>
- </Body>
- </Html>