|
-
Jun 3rd, 2003, 05:23 AM
#1
Thread Starter
New Member
Connect to an opend excel file
Hi,
Can you help me in this problem as soon as posible?
In a method of java class, I connect every 2 seconds to an excel sheet to read some data using the following lines within try..catch block
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc: odbc:Excel_DSN");
st = con.createStatement();
but a memory usage increases with time
So I moved these 3 lines into a place to be excuted once, it works fine when the excel sheet is closed, but when I open it, an error appear:
"java.sql.SQLException: [Microsoft][ODBC Excel Driver] The Microsoft Jet database engine could not find the object 'table1'. Make sure the object exists and that you spell its name and the path name correctly."
this error caused by the line:
rs = st.executeQuery( "Select * from [table1]" );
which is excuted every 2 seconds.
I need the excel file to be opened all the time because it reads from DDE
So, my problem is: I would like to read from this excel file every while without problem and without memory increase or CPU increase..what should I do?
thanks
-
Jun 3rd, 2003, 06:08 AM
#2
Sounds like a file protection error. Excel holds a write lock on the file and the database driver attempts to open the file in read/write mode, which fails.
Nothing you can do about that unless you find a way to tell the driver that you don't want write access to the data source.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jun 3rd, 2003, 06:57 AM
#3
Thread Starter
New Member
yes I think it is file protection error, I tried to set the read Only property in the DSN to true but the result is the same
at the same time I have to use that Excel file either directly or indirectly because it is my original source of data
do u know how to set a readonly property in the connection string or in the java code that connects to the excel as a database
or what can I do?????
thanks
-
Jun 4th, 2003, 07:08 AM
#4
Sorry, I'm just learning JDBC myself, and I can't get my JSP page connect to a mysql database on a different server (says something about a premission problem, I don't know what permissions I need to give my page).
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jun 4th, 2003, 09:55 AM
#5
Thread Starter
New Member
I think u should connect to ur database using a specific username and password that are alredy exist as a user in ur database server
bye
-
Jun 5th, 2003, 04:45 AM
#6
I use correct username and password, but the Tomcat server doesn't even allow me to connect, not even if I give my webapp a java.security.AllPermission in the catalina.policy file...
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|