NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
c_moeller
Joined: 01 Oct 2009 Posts: 2
|
Posted: Thu Oct 01, 2009 6:58 am Post subject: Error while trying to get data out of SQL-Server |
|
|
Hello everybody,
I developed a GUI using Java to enter some data into a SQL-Database using Netbeans 6.5. When opening the project with Netbeans 6.7.1, the connection will be established, however my SELECT-statements are not being executed, the SQL-Exception tells me there is a syntax-error near '?' - but there is no questionmark in the select-statement I create.
Reopening and running with Netbeans 6.5 everything works fine. What's the solution to this problem?
Thanks for every help - and please apologize my bad English...
Christian |
|
| Back to top |
|
 |
ChristianFilippi
Joined: 23 Sep 2009 Posts: 4 Location: Italy
|
Posted: Thu Oct 01, 2009 11:38 am Post subject: |
|
|
| I suggest to try to print out your query and check it carefully. |
|
| Back to top |
|
 |
c_moeller
Joined: 01 Oct 2009 Posts: 2
|
Posted: Thu Oct 01, 2009 11:53 am Post subject: Already done... |
|
|
This is the java-code:
rs = stmt.executeQuery(("SELECT Nr, Kürzel, Kfz1 from LehrerTable order by Nr"));
Running under Netbeans 6.5 everything is fine, running with Netbeans 6.7.1 I get this Exception:
java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]Falsche Syntax in der N?he von '?'.
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7114)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3110)
at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:338)
at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(JdbcOdbcStatement.java:253)
at zisch.Start.kollegenEinlesen(ZISCHView.java:2018)
at zisch.Start.doInBackground(ZISCHView.java:1582)
at zisch.Start.doInBackground(ZISCHView.java:1562)
at javax.swing.SwingWorker$1.call(SwingWorker.java:278)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at javax.swing.SwingWorker.run(SwingWorker.java:317)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
"Falsche Syntax in der N?he von '?'." means syntax-error near by '?'. But there is no '?' in my request.  |
|
| Back to top |
|
 |
Andy Knight Posted via mailing list.
|
Posted: Thu Oct 01, 2009 12:56 pm Post subject: Error while trying to get data out of SQL-Server |
|
|
| Letter |
|
| Back to top |
|
 |
ChristianFilippi
Joined: 23 Sep 2009 Posts: 4 Location: Italy
|
Posted: Thu Oct 01, 2009 12:59 pm Post subject: |
|
|
I'm not sure, but i think that is better to pay attention to case sensitive keywords
original:
| Quote: |
rs = stmt.executeQuery(("SELECT Nr, Kürzel, Kfz1 from LehrerTable order by Nr"));
|
try with uppercase keywords and without a couple of brackets
| Quote: |
rs = stmt.executeQuery("SELECT Nr, Kürzel, Kfz1 FROM LehrerTable ORDER BY Nr"); |
or try adding --> ' <-- before and after the field
| Quote: |
rs = stmt.executeQuery("SELECT Nr, Kürzel, Kfz1 FROM LehrerTable ORDER BY 'Nr'"); |
|
|
| Back to top |
|
 |
Andy Knight Posted via mailing list.
|
Posted: Fri Oct 02, 2009 7:36 am Post subject: Error while trying to get data out of SQL-Server |
|
|
In the Sources category of your Project's properties, change the
Encoding to ISO-8859-1
Andy Knight
Principal Engineer,
Sun Microsystems, Inc.
Java House, Guillemont Park, Minley Road,
Camberley, Surrey GU17 9QG United Kingdom
Home office: +44 1494 462438
Mobile: +44 7775 583415
Skype: aprknight
Email: address-removed
Blog: http://blogs.sun.com/andky
On 1 Oct 2009, at 12:53, c_moeller wrote:
| Quote: | This is the java-code:
rs = stmt.executeQuery(("SELECT Nr, K |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|
|