Skip to Content
0
Former Member
Jul 31, 2014 at 01:50 PM

Start Database command "AS" with number = exception

20 Views

Hello,

When I use the command START DATABASE in Java like this:

String query = "START DATABASE '" + databasePath + "' AS " + databaseName;

statement.execute(query);

But if the databaseName is a number then I get this error:

31-07-14 15:44:33 [ERROR] TechLogger - -> com.sybase.jdbc3.jdbc.SybSQLException: ASA Error -131: Syntax error near '3051' on line 1

at com.sybase.jdbc3.tds.Tds.a(Unknown Source)

at com.sybase.jdbc3.tds.Tds.nextResult(Unknown Source)

at com.sybase.jdbc3.jdbc.ResultGetter.nextResult(Unknown Source)

at com.sybase.jdbc3.jdbc.SybStatement.nextResult(Unknown Source)

at com.sybase.jdbc3.jdbc.SybStatement.nextResult(Unknown Source)

at com.sybase.jdbc3.jdbc.SybStatement.executeLoop(Unknown Source)

at com.sybase.jdbc3.jdbc.SybStatement.execute(Unknown Source)

at com.sybase.jdbc3.jdbc.SybStatement.execute(Unknown Source)

at eu.adm.solutions.topaccount2irisxtract.util.SqlUtils.startDatabase(SqlUtils.java:123)

at eu.adm.solutions.topaccount2irisxtract.util.SqlUtils.getCustomers(SqlUtils.java:95)

at eu.adm.solutions.topaccount2irisxtract.process.ProcessFiles.processFiles(ProcessFiles.java:38)

at eu.adm.solutions.topaccount2irisxtract.process.Task.run(Task.java:51)

at java.util.TimerThread.mainLoop(Unknown Source)

at java.util.TimerThread.run(Unknown Source)

This is a sample query: START DATABASE 'w:\TOP\DATA\3051\3051.DB' AS 3051

When I run this query inside the Interactive SQL it runs without a problem ...

I've also tried quotes and double quotes around the databaseName, no succes ...