wood burning stoves 2.0*
The moose likes JDBC and the fly likes Underscore and Hyphens in DB Name on Shared Server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Underscore and Hyphens in DB Name on Shared Server" Watch "Underscore and Hyphens in DB Name on Shared Server" New topic
Author

Underscore and Hyphens in DB Name on Shared Server

Dolfandave Uyemura
Ranch Hand

Joined: Jun 11, 2002
Posts: 31
My shared server has a prefix to database names in the format of:
domainname_com_-_databasename
exactly in this format. When I create/use a .java file and compile it to a .class file, the test environment on my standalone computer at home is just the "databasename". Should I be using just this databasename or should I include the entire prefix including underscores and hyphen when I compile? The next step of course would be to upload it to the appropriate directory and attempt to run it. I am using JSP, Java, and the MySQL database that comes on the shared server.
ddave
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30146
    
150

Since the database name is different in your environments, you can store the database name in a property file. (a file with name/value pairs) Your program can read the database name in at runtime. That way, you can used the same .class file and just change the database name when you go to the shared server or standalone environment.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Dolfandave Uyemura
Ranch Hand

Joined: Jun 11, 2002
Posts: 31
Ok,
So what are the steps necessary to create and upload this file?
ddave
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30146
    
150

The file is just a plain text file:

You upload the file the same way you upload your .java or .class file. Just put it in the same directory.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Underscore and Hyphens in DB Name on Shared Server
 
Similar Threads
SQL Server connect works in IDE but not in exported JAR
UnsatisfiedLink error
UnsatisfiedLink error
Backing up database through java
UnsatisfiedLink Error