The thing I hate about SQLServer is that it gives me too much headache whenever I use it with Java. Since I already had share of of those from my last company, I already had some precautions.
- Use jtds driver
- Enable TCP/IP on default port 1433
- For SQLServer 2000 be sure to atleast upgrade to SP4
- And many others
Last night I wanted to test the CRUD feature of netbeans 5.5. I needed to generate Entity Classes from the database using one of the wizards. However, although I was able to connect to the database it didn't list the list of tables. I tried to check my JDBC url. I had to set this through the connetion property at the runtime view BTW.
jdbc:jtds:sqlserver://127.0.0.1:1433/ - OK
net.sourceforge.jtds.jdbc.Driver - OK
It took me until today to figure out and remember that my friend Sam set my username as an alias of dbo. What is dbo BTW? Like I care...
Anyway, in the connection properties my schema was set to wpinventorydb which was the name of my database. After a few trial and error I noticed that when I try to create a table through the runtime view (which failed BTW) the error message would say something like:
Unable to execute command:
create table "wpinventorydb."tablename"
{
"id" TINYINT
}
Hmmm... "wpinventorydb."tablename".... That rings a bell. I remember when I created a database through the SQL Server Management Studio(I'm using SQLServer 2005) my tables were saved with a name prefixed by dbo. So I just changed the schema from the connection properties from wpinventorydb to dbo then I became happy.
I'm not sure of the reason why, but it did the job.