By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,797 Members | 1,336 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,797 IT Pros & Developers. It's quick & easy.

Database Connection

P: 34
I have a problem database connection. I try to connect to MS Acces via ODBC.
I made data source in ODBc but I didn't run it. JDBC-ODBC driver must be in my pc because I loaded JDk 1.4.2. I don't know what I will do.
Nov 30 '06 #1
Share this Question
Share on Google+
9 Replies


10K+
P: 13,264
I have a problem database connection. I try to connect to MS Acces via ODBC.
I made data source in ODBc but I didn't run it. JDBC-ODBC driver must be in my pc because I loaded JDk 1.4.2. I don't know what I will do.
Describe your problem. Are you getting an error message?
Nov 30 '06 #2

P: 34
This is my code:
<%
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newI nstance();
java.sql.Connection baglanti = java.sql.DriverManager.getConnection("jdbc:odbc:pe rsonel","asd","asd");
java.sql.Statement sorgulama = baglanti.createStatement();
java.sql.ResultSet sonucVeriler = sorgulama.executeQuery("SELECT * FROM Elemanlar");

}


catch(ClassNotFoundException cnfe)
{
System.err.println("Database Driver'a ulaşılamıyor");
System.err.println("Detay: "+cnfe);
System.exit(0);
}
%>

This is error:type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: General error
org.apache.jasper.runtime.PageContextImpl.doHandle PageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePa geException(PageContextImpl.java:758)
org.apache.jsp.renkli_005fgoster_jsp._jspService(r enkli_005fgoster_jsp.java:132)
org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)


root cause

java.sql.SQLException: General error
sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc .java:6987)
sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java :7115)
sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.j ava:3074)
sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOd bcConnection.java:323)
sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDrive r.java:174)
java.sql.DriverManager.getConnection(DriverManager .java:512)
java.sql.DriverManager.getConnection(DriverManager .java:171)
org.apache.jsp.renkli_005fgoster_jsp._jspService(r enkli_005fgoster_jsp.java:101)
org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
Nov 30 '06 #3

10K+
P: 13,264
This is my code:
<%
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newI nstance();
java.sql.Connection baglanti = java.sql.DriverManager.getConnection("jdbc:odbc:pe rsonel","asd","asd");
java.sql.Statement sorgulama = baglanti.createStatement();
java.sql.ResultSet sonucVeriler = sorgulama.executeQuery("SELECT * FROM Elemanlar");

}


catch(ClassNotFoundException cnfe)
{
System.err.println("Database Driver'a ulaşılamıyor");
System.err.println("Detay: "+cnfe);
System.exit(0);
}
%>

This is error:type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: General error
org.apache.jasper.runtime.PageContextImpl.doHandle PageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePa geException(PageContextImpl.java:758)
org.apache.jsp.renkli_005fgoster_jsp._jspService(r enkli_005fgoster_jsp.java:132)
org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)


root cause

java.sql.SQLException: General error
sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc .java:6987)
sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java :7115)
sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.j ava:3074)
sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOd bcConnection.java:323)
sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDrive r.java:174)
java.sql.DriverManager.getConnection(DriverManager .java:512)
java.sql.DriverManager.getConnection(DriverManager .java:171)
org.apache.jsp.renkli_005fgoster_jsp._jspService(r enkli_005fgoster_jsp.java:101)
org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
Did you try

using

Expand|Select|Wrap|Line Numbers
  1. String url = "jdbc:odbc:myDb";
  2. Connection con = DriverManager.getConnection(url);
Nov 30 '06 #4

P: 34
Hi,
I tried your respond but I don't solve my problem.
Nov 30 '06 #5

10K+
P: 13,264
Hi,
I tried your respond but I don't solve my problem.
Did you get the same error as before?
Nov 30 '06 #6

P: 34
Did you get the same error as before?
Error is same.
Dec 1 '06 #7

P: 1
The "java.sql.SQLException: General error" means that there is an error accesing the database, not in you java code. You must look for any log in the database or maybe in the ODBC source. Check that the ODBC source link correctly with the database file, or that the database is not corrupted. In SQLServer you can find the source of the error in logs file, but i am not sure MS Access has them. Good luck.

Andrew.
Dec 29 '06 #8

Shanaj
P: 51
This is my code:
<%
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newI nstance();
java.sql.Connection baglanti = java.sql.DriverManager.getConnection("jdbc:odbc:pe rsonel","asd","asd");
java.sql.Statement sorgulama = baglanti.createStatement();
java.sql.ResultSet sonucVeriler = sorgulama.executeQuery("SELECT * FROM Elemanlar");

}


catch(ClassNotFoundException cnfe)
{
System.err.println("Database Driver'a ulaşılamıyor");
System.err.println("Detay: "+cnfe);
System.exit(0);
}
%>

This is error:type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: General error
org.apache.jasper.runtime.PageContextImpl.doHandle PageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePa geException(PageContextImpl.java:758)
org.apache.jsp.renkli_005fgoster_jsp._jspService(r enkli_005fgoster_jsp.java:132)
org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)


root cause

java.sql.SQLException: General error
sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc .java:6987)
sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java :7115)
sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.j ava:3074)
sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOd bcConnection.java:323)
sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDrive r.java:174)
java.sql.DriverManager.getConnection(DriverManager .java:512)
java.sql.DriverManager.getConnection(DriverManager .java:171)
org.apache.jsp.renkli_005fgoster_jsp._jspService(r enkli_005fgoster_jsp.java:101)
org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)





hello


try this

create dsn by selecting "system dsn" tab
Jan 2 '07 #9

P: 2
hello


try this

create dsn by selecting "system dsn" tab

hey wat u wanna do is ..
i think u using msacces right if s
go to the control pannel select administrative tools- datasources (odbc) - select system dsn by using tab key.
then press add
select ms access driver press finish
give the data source name that u specified in ur program
and pres select to select the database .and select ur database and click ok and stop the server and restart the run
then it will work very fine.
bye
reply me if its notworking
prakash.nmsp@gmail.com
bye
Jan 3 '07 #10

Post your reply

Sign in to post your reply or Sign up for a free account.