You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@jakarta.apache.org by "Heydari, Parviz" <he...@dnb.no> on 2000/09/06 11:14:32 UTC

database connection, JDBC:ODBC:...

Hi,

I cann't connect to the data base or it is some thing wrong...! An exception
accur in 
the below jsp file on line <% st = db.createStatement(); %> that says:
javax.servlet.ServletException: Compilation error occured: 
Found 1 errors in JSP file: 
C:\\Programfiler\\Allaire\\JRun\\servers\\default\\default-app\\HSSide21.jsp
:13: Error: The variable "db" may be accessed here before having been
definitely assigned a value.
I made the access database file (Tabell1.mdb), added in Controll Panel->ODBC
Data Source Admin.->User DSN and File DSN by name jsp!

Is some thing more I should do!?
Thanks for your support....

-Parviz



<% try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); } catch(Exception e)
{ %>
<p>Fuck off 1</p>
<% } %>

<% java.sql.Connection db; %>
<% java.sql.Statement st; %>
<% java.sql.ResultSet rs; %>

<% try { db = java.sql.DriverManager.getConnection( "jdbc:odbc:jsp",
"dbuser", "dbuser" ); } catch(Exception e) { %>
<p>Fuck off 2</p>
<% } %>

<% st = db.createStatement(); %>
<HTML>

<% rs = st.executeQuery( "select Navn from Tabell1 where Navn = 'Sko';" );
%>
<% while ( rs.next() ) { %>
<%= rs.getString("Navn") %>
<% } %>

</HTML>

<% rs.close();  %>
<% st.close();  %>
<% db.close();  %>

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

This email with attachments is solely for the use of the individual or
entity to whom it is addressed. Please also be aware that DnB cannot
accept any payment orders or other legally binding correspondence with
customers as a part of an email. 

This email message has been virus checked by the virus programs used
in the DnB Group.

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *