Java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax err
I tried putting the square brackets and still get the same error. endasil suggested that the last value being inserted is not looking at the java code. I had earlier put +array. Now I replaced that with +a where a is a string representation of array elements. I still ahve a problem. How can I represent the array element in the query?
String insertCommand = "INSERT into MetricOutput([A1],[A],[DRR],[DeRR],[RE],[WDRR],[WDeRR],[WRE],[ARF],[SRF],[HRF],[WARF],[WSRF],[WHRF],[SDC],[WSDC],[MAR],[WMAR],[H1],[H11],[H2],[H21],[Cluster]) "+
"VALUES("+comMappedCount+","+stdCount+","+DRR+","+DeRR+","+RE+","+WDRR+","+WDeRR+","+WRE+","+ARF+","+SRF+","+HRF+","+WARF+","+WSRF+","+WHRF+","+SDC+","+WSDC+","+MAR+","+WMAR+","+H1+","+H11+","+H2+","+H21+",+a)";
It's quite hard to spot without code tags, but aren't you missing some quotes here:
+",+a)"; instead of +","+a+")";I also don't know the Access sql syntax at all, but I am wondering if you don't need to surround all those arguments with single quotes. To avoid these kind of syntax errors in sql: use PreparedStatement. For more on this: http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html
Similar Messages
-
Hi all,
I am able to INSERT and SELECT records from FoxPRo database successfully.
The driver is Sun JDBC-ODBC bridge
The DELETE statement throws no exception.
I've tried to execute PACK after the DELETE call and got following exception:
java.sql.SQLException: [Microsoft][ODBC Visual FoxPro Driver]File must be opened exclusively.So I tried USE MYTABLE EXCLUSIVE in a Statement before calling PACK and got the exception:
java.sql.SQLException: [Microsoft][ODBC Visual FoxPro Driver]Syntax error or access violationI've also tried inserting the USE MYTABLE EXCLUSIVE before calling DELETE but got the same exception above.
The ODBC DSN for MYTABLE is setup as:
- Free Tables (not database)
- Null (checked)
- Deleted (checked)
- Fetch data in background (checked)
I am not able to issue any of the following commands to FoxPro using java
OPEN - To open a table
CLOSE - To close a table
USE - To open a table for uer either in exclusive mode or shared mode
The exception being generated is :
java.sql.SQLException: [Microsoft][ODBC Visual FoxPro Driver]Syntax error or access violationThe help file of the Microsoft Visual Foxpro Driver states that the driver has support for the above commands.I a not able to get the way to issue the above commands to the driver using java.
In setting up the ODBC DSN I saw no "read only" setting.
In the Visual Foxpro table, I saw no READ ONLY settings.And also, there are no delete permission grants and there is no user database sesssion concept.
I've tried all of the above with DSN mapped to a database(NOT free tables) and setting AUTO-COMMIT OFF and AUTO-COMMIT ON.But in vain. The same exceptions as those stated above persisted.
Environment:
Microsoft Windows XP Professional
JDK version "1.4.2_09"
Microsoft Visual Foxpro 06.00.8167
Microsoft Visual Foxpro Driver 6.01.8629.01
Don't know what else to try.
Can anybody please help me.
Thanks in advance
Archanajava.sql.SQLException: [Microsoft][ODBC Visual FoxPro Driver]File must be opened exclusively.
In the Visual Foxpro table, I saw no READ ONLY settings.And also, there are
no delete permission grants and there is no user database sesssion concept.
The ODBC DSN for MYTABLE is setup as:
- Free Tables (not database)
- Null (checked)
- Deleted (checked)If you're using Visual Foxpro database(.DBC), you should see "Exclusive" option too. You can try check it, but I don't know whether your issue will disappear. -
Error:[Microsoft][ODBC Micrsoft Access Driver] Not a valid password
Can anyone help me with this problem:
I have a Microsoft Access database with database password assign to it.
the following JAVA statement works for some users but not others:
connection.openConnection(databaseurl,"","");
all users are using same java application and points to same MS Access
database.
If I remove the database password, the statement works for all users.
Can anyone explain it why the above statement checking for password for some
users but not others?
thanks
David LingI'm not sure which JDBC driver you are using.
An access database, by default, has a username and
password as "admin" and "" (ie, empty password).
Actually MS Access has two methods for security. You
are referring to one of them.
If the password of admin is changed, you have to
provide the name of the workgroup information file
also( where it is stored) for making a connection.
I am not sure about the ODBC bridge driver. What iam
using is Atinav's aveConnet JDBC driver. It has
provision for giving username and passwords through
Workgroup information file. In addition to it youcan
give the database password also.
Interesting to note. The bridge for MS Access does
not use that security method. And it will fail if you
set up security using the groups/users adminstration.
The only method it allows is via the "database
password" method.Thank you for your response, but what User ID should I use when I use database password?
openConnection(URL,"xxxx","database password")
thanks again
David Ling -
Java.sql.sqlException using remote interface
hi guys,
i have successfully deploying my first CMP Entity Bean on WebLogic server. while using
my client application i have created the bean with the following code:
Object obj = (MyHomeInterface) ctx.lookup("Invoice.MyHomeInterface");
MyHomeInterface home = (MyHomeInterface) PortableRemoteObject.narrow(obj, MyHomeInterface.class);
MyRemoteInterface remote = (MyRemoteInterface) PortableRemoteObject.narrow(home.create(7), MyRemoteInterface.class);
remote.setInv();
above code successfully creates the Entity Bean which is available on the database i am using
Access database for this example but when i call its remote method setInv() which creates a
record in database against a particual id it gives me following error.
java.sql.sqlException {Mocrosoft}ODBC Microsoft Access Driver optional feature not implemented.
<<no stack trace available>>
plz let me know where i am doing wrong.
thanks.
AbidMS Access driver is not network supported. Instead you can try some type-4 drivers available for Access.
Have a look at,http://industry.java.sun.com/products/jdbc/drivers and choose a driver. -
Error...java.sql.SQLException:Access denied for user
Hi,
I am getting the following error message while connecting with the MySQL .(O/S :Sun OS 5.6)
Error.....java.sql.SQLException: Invalid authorization specification: Access denied for user: 'some_user&password@localhost' (Using password: NO)
Note that i have given all permission to the user using,
GRANT ALL PRIVILEGES .......................
The code i have used to connect with the database is,
import java.io.*;
import java.sql.*;
class test
public static void main(String a[])
try
Connection con;
Statement stmt;
ResultSet rs;
Class.forName("org.gjt.mm.mysql.Driver");
con=DriverManager.getConnection(jdbc:mysql://localhost/db_name?user=some_user&password=some_pass");
stmt=con.createStatement();
//do something with resultset
catch(Exception e)
System.out.println("Exception in second try.."+e);
plese guide me on this problem to solve.
Thankz,
Bala.Hi friends...
I've read the last post...
The problem that I have is as follow....
1. I have installed on my machine MySQL 5.0 Server running
1.1 I have a database called "base1"
1.2 User "root", password "works"
1.3 I have the following sentence to connect it using JDBC
Connection con = DriverManager.getConnection("jdbc:mysql://localhost/base1", "root", "works");
More notes:
- I use the JDBC 5.0
- My Machine is a Windows XP SP2 Pentium 3.0 512Mb
and it connects����
but I have this environment to develop applications, now that I want to connect to Production Environment happens the following:
2 The Production database is mounted on a Linux Server with MySQL 3.2.
2.1 I change the sentences as follow:
Connection con = DriverManager.getConnection("jdbc:mysql://192.168.0.7/base1", "user", "password");
2.3 But a message appears when I run the Java Program:
java.sql.SQLException:Access denied for user: '[email protected]' (Using password: YES)
2.4 As you can see it changes the IP Address...
More notes:- I have the MySQL Query Browser and I got connection.
- The IP that display the Error Message is my Second IP configurated on my Network Properties.
- Server is a Pentium 4 3.0 GHz 2Gb Linux Red Hat 3.0
I leave this case for the spider... I hope that somebady has the solution.
What is the problem? Why the JDBC doesn't respect the IP that I wrote. -
Hi !!!
I was working ok, with hibernate and mysql but yesterday I try to install the new mysql version (4.1.10) and receive the following error when I try to connect
Initializing Hibernate
INFO - Hibernate 2.1.6
INFO - hibernate.properties not found
INFO - using CGLIB reflection optimizer
INFO - configuring from resource: /hibernate.cfg.xml
INFO - Configuration resource: /hibernate.cfg.xml
INFO - Mapping resource: com/tutorial/hibernate/core/News.hbm.xml
INFO - Mapping class: com.tutorial.hibernate.core.News -> news
INFO - Configured SessionFactory: null
INFO - processing one-to-many association mappings
INFO - processing one-to-one association property references
INFO - processing foreign key constraints
INFO - Using dialect: net.sf.hibernate.dialect.MySQLDialect
INFO - Maximim outer join fetch depth: 2
INFO - Use outer join fetching: true
INFO - Using Hibernate built-in connection pool (not for production use!)
INFO - Hibernate connection pool size: 20
INFO - using driver: org.gjt.mm.mysql.Driver at URL: jdbc:mysql://localhost/unnobanews
INFO - connection properties: {user=news, password=news}
INFO - Transaction strategy: net.sf.hibernate.transaction.JDBCTransactionFactory
INFO - No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
WARN - Could not obtain connection metadata
java.sql.SQLException: Communication failure during handshake. Is there a server running on localhost:3306?
at org.gjt.mm.mysql.MysqlIO.init(Unknown Source)
at org.gjt.mm.mysql.Connection.connectionInit(Unknown Source)
at org.gjt.mm.mysql.jdbc2.Connection.connectionInit(Unknown Source)
at org.gjt.mm.mysql.Driver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:140)
Somewhere I red that was necessary to update the jdbc driver, so I updated it from version nro 2 to version nro 3.1.7 but still the error
Phpmyadmin works ok and mysql control center can connect ok too.
But when I try a telnet localhost:3306 I receive and error of connection filed
Anyway the mysql status thowme correct information, that it working ok!
Any idea ?
King regards
NatyHibernate 2.1.6
loaded properties from resource hibernate.properties: {hibernate.connection.username=root, hibernate.connection.password="", hibernate.cglib.use_reflection_optimizer=true, hibernate.connection.pool_size=10, hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect, hibernate.connection.url=jdbc:mysql://manoj/manoj, hibernate.connection.driver_class=org.gjt.mm.mysql.Driver}
using CGLIB reflection optimizer
configuring from resource: /hibernate.cfg.xml
Configuration resource: /hibernate.cfg.xml
Mapping resource: com/mec/emp.hbm.xml
Mapping class: com.mec.Employee -> emp
Configured SessionFactory: null
processing one-to-many association mappings
processing one-to-one association property references
processing foreign key constraints
Using dialect: net.sf.hibernate.dialect.MySQLDialect
Maximim outer join fetch depth: 2
Use outer join fetching: true
Using Hibernate built-in connection pool (not for production use!)
Hibernate connection pool size: 10
using driver: org.gjt.mm.mysql.Driver at URL: jdbc:mysql://manoj/manoj
connection properties: {user=root, password=""}
No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
Could not obtain connection metadata
java.sql.SQLException: Server configuration denies access to data source
at org.gjt.mm.mysql.MysqlIO.init(MysqlIO.java:144)
at org.gjt.mm.mysql.Connection.<init>(Connection.java:230)
at org.gjt.mm.mysql.Driver.connect(Driver.java:126)
at java.sql.DriverManager.getConnection(DriverManager.java:525)
at java.sql.DriverManager.getConnection(DriverManager.java:140)
at net.sf.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:101)
at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:73)
at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1155)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:789)
at com.mec.CreateSession.getCurrentSession(CreateSession.java:35)
at com.mec.TestEmployee.createEmployee(TestEmployee.java:37)
at com.mec.TestEmployee.main(TestEmployee.java:24)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)
Use scrollable result sets: false
Use JDBC3 getGeneratedKeys(): false
Optimize cache for minimal puts: false
Query language substitutions: {}
cache provider: net.sf.hibernate.cache.EhCacheProvider
instantiating and configuring caches
building session factory
Not binding factory to JNDI, no JNDI name configured
SQL Error: 0, SQLState: 08001
Server configuration denies access to data source
Cannot open connection
java.sql.SQLException: Server configuration denies access to data source
at org.gjt.mm.mysql.MysqlIO.init(MysqlIO.java:144)
at org.gjt.mm.mysql.Connection.<init>(Connection.java:230)
at org.gjt.mm.mysql.Driver.connect(Driver.java:126)
at java.sql.DriverManager.getConnection(DriverManager.java:525)
at java.sql.DriverManager.getConnection(DriverManager.java:140)
at net.sf.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:101)
at net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:286)
at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3326)
at net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3286)
at net.sf.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:40)
at net.sf.hibernate.transaction.JDBCTransactionFactory.beginTransaction(JDBCTransactionFactory.java:19)
at net.sf.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:2231)
at com.mec.TestEmployee.createEmployee(TestEmployee.java:38)
at com.mec.TestEmployee.main(TestEmployee.java:24)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)
Process finished with exit code 0 -
Error java.sql.SQLException
My patch management update is set to fire off at 2:00am. In my loader-messages.log I have
[DEBUG] [7/28/10 2:09:38 AM] [] [ImportContent] [] [Done processing: abaafc6c0bb1427e2fdda82450ff5485] [] []
[DEBUG] [7/28/10 2:09:40 AM] [] [Loader.PatchSubscriptionService] [] [Error Delete signature with name C122AA6FC4B002B18DD52FE31E7DA934] [] []
[DEBUG] [7/28/10 2:09:40 AM] [] [Loader.PatchSubscriptionService] [] [org.hibernate.exception.ConstraintViolationExcepti on: could not delete: [[com.patchlink.sapphire.datamodel.PatchSignature#12 677]]
at org.hibernate.exception.SQLStateConverter.convert( SQLStateConverter.java:71)
at org.hibernate.exception.JDBCExceptionHelper.conver t(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.AbstractEntityPersi ster.delete(AbstractEntityPersister.java:2384)
at org.hibernate.persister.entity.AbstractEntityPersi ster.delete(AbstractEntityPersister.java:2516)
at org.hibernate.action.EntityDeleteAction.execute(En tityDeleteAction.java:73)
at org.hibernate.engine.ActionQueue.execute(ActionQue ue.java:248)
at org.hibernate.engine.ActionQueue.executeActions(Ac tionQueue.java:232)
at org.hibernate.engine.ActionQueue.executeActions(Ac tionQueue.java:144)
at org.hibernate.event.def.AbstractFlushingEventListe ner.performExecutions(AbstractFlushingEventListene r.java:297)
at org.hibernate.event.def.DefaultFlushEventListener. onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.j ava:988)
at org.hibernate.impl.SessionImpl.managedFlush(Sessio nImpl.java:337)
at org.hibernate.transaction.JDBCTransaction.commit(J DBCTransaction.java:106)
at com.novell.zenworks.lumension.PatchManager.deleteP atchSignatureByMD5(PatchManager.java:718)
at com.novell.zenworks.lumension.PatchSubscriptionSer vice.processAction(PatchSubscriptionService.java:3 86)
at com.novell.zenworks.loader.modules.queue.runner.Qu eueThreadWorker.processAction(QueueThreadWorker.ja va:208)
at com.novell.zenworks.loader.modules.queue.runner.Qu eueThreadWorker.run(QueueThreadWorker.java:139)
at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(ThreadPoolExecutor.java:651)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:676)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.sql.SQLException: [[Sybase]][[ODBC Driver]][[SQL Anywhere]]Primary key for row in table 'PATCHSIGNATURE' is referenced by foreign key 'FK38670AEAB227C794' in table 'BaseLineGroupPatchSignature'
at ianywhere.ml.jdbcodbc.IIPreparedStatement.executeU pdate(Native Method)
at ianywhere.ml.jdbcodbc.IPreparedStatement.executeUp date(IPreparedStatement.java:219)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement .executeUpdate(NewProxyPreparedStatement.java:105)
at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(N onBatchingBatcher.java:23)
at org.hibernate.persister.entity.AbstractEntityPersi ster.delete(AbstractEntityPersister.java:2363)
... 17 more
There are several more error messages but I suspect they all stem from this first one. Do I have to do DB stuff or if I turn the other way will it .....
Maybe I could press that magic button again? Anyone?
CheersGERWIL,
It appears that in the past few days you have not received a response to your
posting. That concerns us, and has triggered this automated reply.
Has your problem been resolved? If not, you might try one of the following options:
- Visit http://support.novell.com and search the knowledgebase and/or check all
the other self support options and support programs available.
- You could also try posting your message again. Make sure it is posted in the
correct newsgroup. (http://forums.novell.com)
Be sure to read the forum FAQ about what to expect in the way of responses:
http://forums.novell.com/faq.php
If this is a reply to a duplicate posting, please ignore and accept our apologies
and rest assured we will issue a stern reprimand to our posting bot.
Good luck!
Your Novell Product Support Forums Team
http://support.novell.com/forums/ -
Hi,
I am writing a simple program wihich will display the list of table for a given database. Currently I am using JDBC-ODBC bridge for accessing MS Acccess data base. When I call getTables method of DatabaseMetaData. Following Exception was thrown. Any clue what could be the reason for this?
Exception java.sql.SQLException: [Microsoft][ODBC Microsoft Access 97 Driver]Driver not capable
java.sql.SQLException: [Microsoft][ODBC Microsoft Access 97 Driver]Driver not capable
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6106)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6263)
at sun.jdbc.odbc.JdbcOdbc.SQLTables(JdbcOdbc.java:4917)
at sun.jdbc.odbc.JdbcOdbcDatabaseMetaData.getTables(JdbcOdbcDatabaseMetaData.java:2395)
at test.databaseMetaData.main(databaseMetaData.java:36)
This exception occured in the following block:
String[] strTables = {"TABLES"};
rs = dbmd.getTables( null, "DBIS", "A%", strTables);
Thanks in advance
Cheers,
KrishnaHi Krishna,
First, do you have a correct ODBC setup on the platform your working on -- data source, etc.
Second, please enclose the Java code for your connection, etc..
Good luck!
Francis -
i am trying to execute the following query using jdbc
String state = "select * from cs_test where Start_Time < DateAdd(\"s\",-19800,now()) AND End_Time >
DateAdd(\"s\",-19800,now())";
/java.sql.PreparedStatement querycs_test = c.prepareStatement(state);
java.sql.Statement querycs_test= c.createStatement();
java.sql.ResultSet rs = querycs_test.executeQuery(state);
when i run the same query at the prompt in MS Access it works fine.
The same line replaced with a simpler query works fine.
but when i run the above i get an error
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.Here's the value of your query before preparing it:
select * from cs_test where Start_Time < DateAdd("s",-19800,now()) AND End_Time > DateAdd("s",-19800,now())My SQL refererence doesn't have anything about functions called DateAdd or now. It might be Microsoft specific, in which case when your organization converts to another database your query is going to stop working. Don't use vender specific extensions.
Was your intention to call a Java method called DateAdd or now? Then your problem is a few missing quotes. Otherwise, I'm sorry I can't be of more help. -
Hello. I'm trying to do an INSERT into an MS Access 2002 database, and this is throwing:
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] '' is not a valid name. Make sure that it does not include invalid characters or punctuation and that it is not too long.
The INSERT is pretty straight forward:
INSERT INTO Nodes (ID, Name, IP, DateAdded) values ("m22", "Colt,Frankfurt,GR", "213.61.48.52", "2003-02-06")
ID is a TEXT field of length 3 and it is the key (table is currently empty)
Name is a TEXT field of length 50.
IP is a TEXT field of length 16.
DateAdded is TEXT field of length 10.
I tried putting dummy data into the table and doing a SELECT, and that worked without a problem.
Can anyone tell me what is or might be causing this? Thanks in advance!!!
- john ferguson, kansas cityOkay, I fixed this.
The fix was to change the double quotes (") to single quotes (') inside the VALUES part of the statement.
So it went from:
INSERT INTO Nodes (ID, Name, IP, DateAdded) values ("m22", "Colt,Frankfurt,GR", "213.61.48.52", "2003-02-06")
to:
INSERT INTO Nodes (ID, Name, IP, DateAdded) values ('m22', 'Colt,Frankfurt,GR', '213.61.48.52', '2003-02-06')
and now it works fine. -
Hello together!
I am trying to add a long value to an access db.
(I have a PreparedStatement.)
But I get the following error:
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]Optional feature not implemented
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLBindInParameterBigint(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setLong(Unknown Source)
at Import.writeLineToDb(Import.java:70)
at Import.main(Import.java:40)
when exucuting the followint line:
statement.setLong(2,new Long(data[1]).longValue());
How can I find out which feature is missing and install it?
Thanks.
MarkusCould it be that the driver is not installed for that?
I am connecting like that:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
connection = DriverManager.getConnection("jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ="+path, "", "");
Thanks for your help. -
Can someone please help me? I get the error java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
The offending section of code is:
int resultsTableID = 0;
query = "SELECT results_table_01 FROM dbo_results_table_01 WHERE image_1_id = '" + file1ID + "' AND image_2_id = '" + file2ID + "'";
System.out.println(query);
rs = s.executeQuery(query);
The select statement comes out:
SELECT results_table_01 FROM dbo_results_table_01 WHERE image_1_id = '115' AND image_2_id = '116'
There does not seem to be a problem with the parameter separations, so if anyone can spot what I have done wrong I would appreciate it.
ThanksI have just tried what you advised: Not using single quotes, and I got the same error.
The query now looks like:
query = "SELECT results_table_01 FROM dbo_results_table_01 WHERE image_1_id = " + file1ID + " AND image_2_id = " + file2ID;
Thanks for your help, but it did not work. -
Hi, I'm getting an error in the eManager server log when running a load test:
Error executing prepared statement: sun.jdbc.odbc.JdbcOdbcPreparedStatement@189ff39
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Invalid argument.
I found this on the MS site concerning the 2GB size limitation for MDB files:
http://support.microsoft.com/?id=835416
The RSWReport.mdb file is more than 2GB in size, so I'm assuming that this file is causing the problem.
Is there anyway to purge this file? Will compacting the file or splitting the file as MS recommends fix the problem?
JamesYou can always just create a new mdb file and run with that. I typically create a new MDB for each project I work on, or build of an app.
The windows ODBC controls will let you create a blank MDB file.
1. Start - Settings - Control Panel - Administrative Tools - Data Cources (ODBC)
2. Chose the reporter ODBC - click configure - create. I tend to name by date and project, etc.
3. In e-Load, chose Manage - Databases - New. In that window, chose 'Create e-Load tables in the database, give it a name, enter the DSN name, chose 'set as current e-Load database' and click ok.
You should be good to go with a clean MDB file. If I missed a step or the instructions aren't clear let me know.
SQL will give you better performance, but if its not an option managing the MDB files will help.
- BT -
I am having a problem inserting/updateing date field of MS Access database with JDBC. I have tried several solutions. Serveral Field formats in the db and several methods with java. I will post my most recent attempt. I can read from the database I just can't write the date to the db, though I can write to any other field with a different datatype.
Please don't bash me for using MS Access, it is my only option.
Error: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]Error in row
if (rs != null){
while ( rs.next() ) {
Date tDate;
//Timestamp tDate;
//String tDate;
tDate = rs.getDate("Week");
//tDate = rs.getTimestamp("Week");
//tDate = rs.getString("Week");
java.sql.Date sqlDate = new java.sql.Date( Date.getTime() );
//java.sql.Timestamp sqlDate = new java.sql.Timestamp( tDate.getTime()
System.out.println("Date: " + tDate );
//System.out.println("Date: " + sqlDate );
//System.out.println("Date: " + rs.getDate ("Date") );
// 2004-03-24 00:00:00.0 this is Timestamp output
Cpu.moveToInsertRow();
Cpu.updateDate("Date_Col",sqlDate );
//Cpu.updateDate("Date_Col",tDate );
//Cpu.updateTimestamp("Date_Col", sqlDate);
Cpu.insertRow();
Error: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]Error in row
Please help..........I can insert a new row and add all the fields (includeing date (as string)), but I have to use SQL statements. I cannot get the result set functions to work.
I can retieve a rs just fine and print all the contents of the rs.
My problem is with rs.updateRow();
my code is below,
public class Cpu_Load_Total_Cpu{
public static void main(String[] args){
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String filename = "C:/dev/SHC/Cpu_Java/CFS_Health.mdb";
String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=";
database+= filename.trim() + ";DriverID=22;READONLY=false}";
Connection con = DriverManager.getConnection( database ,"","");
Statement stmt = con.createStatement(
ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
ResultSet Cpu = stmt.executeQuery("SELECT * FROM Cpu");
if (Cpu != null){
while ( Cpu.next() ) {
int tUsr, tSys, tWio, tIdle, tTotal_Cpu;
tUsr = Cpu.getInt("Usr");
tSys = Cpu.getInt("Sys");
tWio = Cpu.getInt("Wio");
tIdle = 100 - (tSys + tUsr + tWio);
tTotal_Cpu = tSys + tUsr + tWio;
Cpu.updateLong(8, tTotal_Cpu);
//or Cpu.updateLong("Total_Cpu", tTotal_Cpu);
// I get the same error as the post above
// when I include the Cpu.updateRow(); call
Cpu.updateRow();
// when excluded everything else runs fine, but
// the db is not updated
// as stated, everything prints to the screen or pipe when
// updateRow is excluded
System.out.println("Usr: " + tUsr );
System.out.println("Sys: " + tSys );
System.out.println("Wio: " + tWio);
System.out.println("Total_Cpu: " + tTotal_Cpu);
con.commit();
stmt.close();
con.close();
catch (Exception e) {
System.out.println("Error: " + e);
} -
Error: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
I am getting above error in my sql to access database. The program works fine if I remove where clause. But I need where clause for my prgoram. Actually, I am trying to work on user management aspect and it won't allow me to do.
String query = "select * from user where username="+name; s.execute(query);Thanks for the reply. Do you mean
Can you please further explain. I have a value against which querry is run. Say that value is stored in
String value; (stores the user names as string)
and then i create a querry like
String query = "select * from user where name= 'value'";
s.execute(query);
in above query
user is table name
name is a field which stores usersname.
if I put 'value' it does not work but i put actual names 'xxx' it works. But I cannot put actual names here.
Maybe you are looking for
-
I consolidated a 940 process that was sendind flat file/edi/xml/sql server to run all from one orchestration and dynamic send ports (some are send to the file system and some to ftp). Before everything was working perfect, with the changes everything
-
Hi gurus In production in any industry there will be rework generated at any stage of production operation. For this i have tried with rework activity explained in SDN and SAP Help. I am not able to get a proper result result like 1) When tried with
-
This discussion is a follow up of my previous discussion that can be found at http://forums.adobe.com/message/6174242. I am starting a new discussion for clarity. The previous discussion addressed the question of whether Adobe Access DRM and its vari
-
Tlf use into flex library project make some errors
errors: Description Resource Path Location Type 1046: 找不到类型,或者它不是编译时常数: ContentElement. SparkWebCommonComponents Unknown Flex Problem Description Resource Path Location Type 1046: 找不到类型,或者它不是编译时常数: ElementFormat. SparkWebCommonComponents Unknown Fl
-
Airport Extreme as a router with an existing wireless DSL
can someone tell me how to set up my Airport Extreme to use as a wireless router with an existing wireless ATT DSL modem?