cancel
Showing results for 
Search instead for 
Did you mean: 

JDBC URL string

huber1
Participant
4,419

Hi All

By installing with an installer utility I made an error and got a JDBC database server connection with an URL like the following as a result:

URL: jdbc:sybase:Tds:10.0.1.2:2638/<database-file>

Now I am wondering where this database file is located in the (OS X) file system, I just can't find it nowhere, but obviously it must be somewhere (I also can connect to it). To what location is /<database-file> pointing? A temporary or cache folder?

My usual URLs look like this: jdbc:sybase:Tds:10.0.1.2:2638?ServiceName=<database-file>&CHARSET=utf8

As I would like to delete it, I have to know where it is. Anyone having an idea?

Accepted Solutions (0)

Answers (1)

Answers (1)

jeff_albion
Advisor
Advisor

To what location is /<database-file> pointing?

"ServiceName" is referring to the database's name ("alias") on the SQL Anywhere database server:

e.g.

Launch the database server: dbsrv12 -n MyServer /Applications/SQL Anywhere 12/database.db -n MyDatabase

Use the JDBC (for jConnect) URL: jdbc:sybase:Tds:10.0.1.2:2628?ServiceName=MyDatabase

Now I am wondering where this database file is located in the (OS X) file system... (I also can connect to it)

You can just query the database for this information if you can connect to it:

SELECT db_property('File');
huber1
Participant
0 Kudos

Jeff, thanks a lot. The SELECT db_property('File'); works for all database files except for my strange/broken database file which exists somewhere in the file system as ghost and where I funnily can connect to.

VolkerBarth
Contributor
0 Kudos

So what does it return then? NULL?

huber1
Participant
0 Kudos

Strangely, it returns one of the other database file names, not NULL. The given database file name is not possible, I checked the content with Sybase Central. If I new where the slash (/) after the port number points to I would find the database file. I only can think of it's in some temp or cache folder or similar, otherwise I would have found it. It's a repository database, so I do not want them to be just somewhere without my knowledge.

jeff_albion
Advisor
Advisor
0 Kudos

Do you know what the command-line for starting the database server is?

 SELECT PROPERTY('CommandLine');

As I mentioned, the ServiceName is just a database alias passed in as a command-line parameter after the database file.

(Aside: There is also the "special" utitity_db which has no physical database file representation (e.g. ServiceName=utility_db) - but the above SELECT will just return the empty string in that case.)

huber1
Participant
0 Kudos

I get following:

'-n SkyServer -x tcpip{dobroadcast=no;port=2638} -gd DBA -ti 0 -c 6144m -ca 0 -qw -o /Library/SQLAnywhere12/sybase_log.txt /Library/SQLAnywhere12/databases/Hades.db /Library/SQLAnywhere12/databases/Magazine.db /Library/SQLAnywhere12/databases/log_data.db /Library/SQLAnywhere12/databases/servoy_repository.db -hn 5 '

jeff_albion
Advisor
Advisor

Based on the command-line, all four of your databases are stored in /Library/SQLAnywhere12/databases/ on the OS X file system (and are named "Hades", "Magazine", "log_data", and "servoy_repository" for their "ServiceNames" respectively.)

huber1
Participant
0 Kudos

These are the db files I intentionally created and put there. But there is somewhere a ghost file which contains the Servoy (our IDE) repository, where I can connect to via the URL: jdbc:sybase:Tds:10.0.1.2:2638/servoy_repository and this is the database file I can't find, not even with the Unix find cmd, but it is somewhere and the only information I have is that / in the URL, but don't know where a / is pointing to!?

VolkerBarth
Contributor
0 Kudos

What happens when you stop the database engine and re-start it? - The "sybase_log.txt" console log should then contain information on which database file is started and made available with which database name. (At least that's the expected behaviour.)

Of course you might also check the existing console log for any related entries.

jeff_albion
Advisor
Advisor

I'm not sure I understand. There should be four (4) databases listed in /Library/SQLAnywhere12/databases/. I listed them in my previous response.

One of them is named /Library/SQLAnywhere12/databases/servoy_repository.db - this is the ServiceName "servoy_repository".

(Which is the same name as the file name, and is the default database name if you don't specify one with "-n" after the database filename, which is true by your command-line).

huber1
Participant
0 Kudos

@Volker: The sybase_log.txt file shows the four databases I start (defined in my SQLAnywher.config file). But it does not show the ghost database (called also servoy_repository) which exists somewhere in the file system as "duplicate", which means the name is the same but the content is not the same. The "real" database servoy_repository has the correct content, the ghost database is empty (that's why I know there are 2 databases with the same name, because I can connect to both of them with the URLs below).

That is why I would like to find the "ghost" database file. I can connect to both of them (as mentioned above). So I think only if someone can tell me where the slash (/) in the URL is pointing to I will be able to find it. Or, if someone could tell me what a slash in the URL means? In other words, what is the difference between these 2 URLs? And to what database file is the second one pointing?: URL: jdbc:sybase:Tds:localhost:2638?ServiceName=servoy_repository&CHARSET=utf8 URL: jdbc:sybase:Tds:localhost:2638/servoy_repository&CHARSET=utf8

@Jeff: I do not use the -n option, so yes, the db name corresponds to the serviceName (which is ok for me)

huber1
Participant
0 Kudos

@Volker: As the sybase_log.txt shows (only) the 4 databases mentioned as started, there is no reference to a second servoy_repository database file. Confusing why I get different results with the 2 URLs. If it's absolutly shure that only databases are started which are mentioned in sybase_log.txt (in my case), then that means there is no second servoy_repository database file. But then, why can I connect with the URL string containing the slash (/) and why do I get a different result?

VolkerBarth
Contributor
0 Kudos

Yes, under normal circumstances the log will also contain entries for databases that are not started during the server start but are started lateron, say, by using a START DATABASE statement or through a connection that starts its own database on the running engine.

However, your server seems to operate under somewhat "unnormal" circumstances...

jeff_albion
Advisor
Advisor

Confusing why I get different results with the 2 URLs

I think you're going to have to define 'different result' more carefully. What result? What operation are you trying, specifically?

I think we have firmly established there is only one database, named 'servoy_repository' on the database server, located in the location we're expecting on the file system.

As for the difference in URLs, there is a slight difference in the way the jConnect JDBC driver resolves the parameter. I believe the end-result is the same: select the database named /<service-name> or ServiceName=<service-name> on the SQL Anywhere server. However, the / style is documented for use with Sybase ASE databases - there are likely compatibility differences when using this mode with SQL Anywhere. The jConnect documentation recommends to use "ServiceName" parameter when connecting to SQL Anywhere databases (as does the SQL Anywhere documentation).

huber1
Participant
0 Kudos

You are right about defining different result more carefully. With the URL having the ServiceName parameter, I can connect to the database and I am able to checkout the repository content to a workspace, which is then used by Eclipse. With the URL using the /<service-name> parameter (which I got by installing a new Servoy Developer IDE version, I also can connect to the database (which up to now was proof for me there is one with the name servoy_repository), but I can't checkout anything. And that is what made me nervous, being able to connect to the database, in one case as usual, but in the other case not being able to checkout data (for example). But as you explain, the difference must be in the way that although I can connect with the /<service-name>, it's not the correct way of doing it and therefor I can't access the repository. Thanks a lot for helping, it is very appreciated!

jeff_albion
Advisor
Advisor

which I got by installing a new Servoy Developer IDE version... but I can't checkout anything

Have you tried asking for help about this issue in the Servoy forums? This sounds like a Servoy issue, not one with SQL Anywhere.

huber1
Participant
0 Kudos

Yes I asked, but not so much of a hint if there is really somewhere a (hidden) database file. I now have setup a complete new installation and so far it looks good. Thanks for all the help!