| View previous topic :: View next topic |
| Author |
Message |
prholland General User


Joined: 23 Oct 2005 Posts: 31 Location: Royston, Herts, UK
|
Posted: Sun Jan 07, 2007 3:33 pm Post subject: How to check if a table exists and replace if it does? |
|
|
How do you check if a table exists and replace if it does?
I've tried "DROP TABLE x IFD EXISTS":
rs=st.executeQuery("DROP TABLE " & MDB_TABLE & " IF EXISTS")
but I get error messages like:
Message: syntax error, unexpected DROP, expecting BETWEEN or SQL_TOKEN_IN or SQL_TOKEN_LIKE.
................Phil _________________ --
Philip R Holland
[OOo 1.1.5 + 2.3.1, WinXP Pro/Ubuntu 7.10]
Holland Numerics Ltd, Royston, Herts, UK |
|
| Back to top |
|
 |
prholland General User


Joined: 23 Oct 2005 Posts: 31 Location: Royston, Herts, UK
|
Posted: Thu Jan 11, 2007 5:32 am Post subject: How to check if a table exists and replace if it does? |
|
|
I think I've resolved my own problem. The table I was trying to delete was connected using sdbc:dbase:, which, unfortunately, can only be connected as Read Only, so this caused the error message.
.........Phil _________________ --
Philip R Holland
[OOo 1.1.5 + 2.3.1, WinXP Pro/Ubuntu 7.10]
Holland Numerics Ltd, Royston, Herts, UK |
|
| Back to top |
|
 |
Danad OOo Advocate

Joined: 22 Feb 2004 Posts: 293 Location: Brasil
|
Posted: Thu Jan 11, 2007 5:57 am Post subject: |
|
|
I guess you´ve to:
- get a container with getTables
- call method dropByIndex or dropByName
- append a new table
It seems there is not any API to replace a table.
HTH |
|
| Back to top |
|
 |
prholland General User


Joined: 23 Oct 2005 Posts: 31 Location: Royston, Herts, UK
|
Posted: Thu Jan 11, 2007 6:11 am Post subject: How to check if a table exists and replace if it does? |
|
|
When I converted the table the HSQLDB, the code I used worked fine, as the connection was now Read/Write. The performance of the data load, however, was not acceptable when adding 200K records, so I've reverted to just reading an existing CSV file instead.
.........Phil _________________ --
Philip R Holland
[OOo 1.1.5 + 2.3.1, WinXP Pro/Ubuntu 7.10]
Holland Numerics Ltd, Royston, Herts, UK |
|
| Back to top |
|
 |
Danad OOo Advocate

Joined: 22 Feb 2004 Posts: 293 Location: Brasil
|
|
| 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
|
Powered by phpBB © 2001, 2005 phpBB Group
|