Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #38408 > unrolled thread
| Started by | Eric Douglas <e.d.programmer@gmail.com> |
|---|---|
| First post | 2018-06-26 09:03 -0700 |
| Last post | 2018-07-03 07:13 -0700 |
| Articles | 5 on this page of 25 — 6 participants |
Back to article view | Back to comp.lang.java.programmer
Is there a SQL hashmap? Eric Douglas <e.d.programmer@gmail.com> - 2018-06-26 09:03 -0700
Re: Is there a SQL hashmap? Arne Vajhøj <arne@vajhoej.dk> - 2018-06-26 12:23 -0400
Re: Is there a SQL hashmap? Robert Klemme <shortcutter@googlemail.com> - 2018-06-26 22:36 +0200
Re: Is there a SQL hashmap? Eric Douglas <e.d.programmer@gmail.com> - 2018-06-26 14:02 -0700
Re: Is there a SQL hashmap? Arne Vajhøj <arne@vajhoej.dk> - 2018-06-27 20:22 -0400
Re: Is there a SQL hashmap? firstsql@gmail.com - 2018-06-27 20:53 -0700
Re: Is there a SQL hashmap? Eric Douglas <e.d.programmer@gmail.com> - 2018-06-28 05:03 -0700
Re: Is there a SQL hashmap? Eric Douglas <e.d.programmer@gmail.com> - 2018-06-28 06:49 -0700
Re: Is there a SQL hashmap? Eric Douglas <e.d.programmer@gmail.com> - 2018-06-28 07:38 -0700
Re: Is there a SQL hashmap? Andreas Leitgeb <avl@logic.at> - 2018-06-28 15:52 +0000
Re: Is there a SQL hashmap? Martin Gregorie <martin@mydomain.invalid> - 2018-06-28 19:47 +0000
Re: Is there a SQL hashmap? Arne Vajhøj <arne@vajhoej.dk> - 2018-06-28 18:34 -0400
Re: Is there a SQL hashmap? Martin Gregorie <martin@mydomain.invalid> - 2018-06-28 23:20 +0000
Re: Is there a SQL hashmap? Arne Vajhøj <arne@vajhoej.dk> - 2018-06-28 20:07 -0400
Re: Is there a SQL hashmap? Eric Douglas <e.d.programmer@gmail.com> - 2018-06-29 05:11 -0700
Re: Is there a SQL hashmap? Martin Gregorie <martin@mydomain.invalid> - 2018-06-29 12:30 +0000
Re: Is there a SQL hashmap? Eric Douglas <e.d.programmer@gmail.com> - 2018-06-29 06:11 -0700
Re: Is there a SQL hashmap? Martin Gregorie <martin@mydomain.invalid> - 2018-06-29 13:43 +0000
Re: Is there a SQL hashmap? Robert Klemme <shortcutter@googlemail.com> - 2018-06-29 23:20 +0200
Re: Is there a SQL hashmap? Martin Gregorie <martin@mydomain.invalid> - 2018-06-29 22:34 +0000
Re: Is there a SQL hashmap? Arne Vajhøj <arne@vajhoej.dk> - 2018-06-30 16:36 -0400
Re: Is there a SQL hashmap? Martin Gregorie <martin@mydomain.invalid> - 2018-06-30 23:00 +0000
Re: Is there a SQL hashmap? Robert Klemme <shortcutter@googlemail.com> - 2018-06-29 23:34 +0200
Re: Is there a SQL hashmap? Arne Vajhøj <arne@vajhoej.dk> - 2018-06-30 17:51 -0400
Re: Is there a SQL hashmap? Eric Douglas <e.d.programmer@gmail.com> - 2018-07-03 07:13 -0700
Page 2 of 2 — ← Prev page 1 [2]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2018-06-30 16:36 -0400 |
| Message-ID | <ph8pjp$1j7s$1@gioia.aioe.org> |
| In reply to | #38461 |
On 6/29/2018 6:34 PM, Martin Gregorie wrote: > On Fri, 29 Jun 2018 23:20:10 +0200, Robert Klemme wrote: >> On 29.06.2018 15:43, Martin Gregorie wrote: >>> As in 'Add a view to the existing database'. >> >> As far as I understood Eric he does not want to modify the existing >> database in _any_ way. If you can create a view there then you can also >> add a table with the mapping against which you can join. >> > I know, but I think its worthwhile letting him know what a view is, its > likely impact and how I understand it to work on at least one DB > (PosgreSQL). At least it gives him more information to work with. > > Although I haven't used SQLServer, I did do a fair bit of work > programming and doing DBA stuff with Sybase, though I don't recall using > views on it. SQL Server was forked from the Sybase RDBMS. Sybase supports views. Also back when Sybase and MS split ways 20-25 years. Arne
[toc] | [prev] | [next] | [standalone]
| From | Martin Gregorie <martin@mydomain.invalid> |
|---|---|
| Date | 2018-06-30 23:00 +0000 |
| Message-ID | <ph922i$275$1@news.albasani.net> |
| In reply to | #38462 |
On Sat, 30 Jun 2018 16:36:10 -0400, Arne Vajhøj wrote: > > Sybase supports views. > > Also back when Sybase and MS split ways 20-25 years. > I thought that was probably the case, so thanks for the confirmation. -- Martin | martin at Gregorie | gregorie dot org
[toc] | [prev] | [next] | [standalone]
| From | Robert Klemme <shortcutter@googlemail.com> |
|---|---|
| Date | 2018-06-29 23:34 +0200 |
| Message-ID | <fpnmv9Fpj3vU1@mid.individual.net> |
| In reply to | #38446 |
On 28.06.2018 16:38, Eric Douglas wrote: > On Thursday, June 28, 2018 at 9:49:47 AM UTC-4, Eric Douglas wrote: >>>> You can in MS SQLServer >>>> >>>> Just refer to the tables as somedatabasename.dbo.sometablename >>>> and it should work. >>>> >>>> Arne >>> >>> but I am using java.sql.DriverManager.getConnection() which >>> requires a connect string which includes the database name - ? >> >> I see, that works only on other level... Currently we're using >> connect string = jdbc:sqlserver://servername:port;databasename Then >> we can do select * from tablename >> >> The other option is to update every reference: connect string = >> jdbc:sqlserver://servername:port Then select * from >> databasename.dbo.tablename >> >> This second format is only required if you need to connect tables >> from multiple databases and looks uglier the more tables you join. >> To switch from one to the other gets really ugly if you're changing >> the connect string for a common connection method that already has >> a bunch of sql statements which aren't referencing the database >> name. > > I don't know if this third party software would have issue with > adding a database to the same instance. The database part is > optional in the connect string, but the second database we do have > running on that server is in a totally different instance, different > port, different credentials, one database running sql server 2012 one > running 2014. So JDBC can access both but as far as I know cannot > join both in the same select statement. Even if I can setup matching > credentials, surely only one port at a time. We have another server > running mysql, probably the best place to store the lookup values, > but would have to process in a separate JDBC instance after getting > the results. The way this is done in Oracle is to announce the remote database (b) in database (a). Then you can query (a) and pull in data from (b). Not sure though how SQL Server does it. https://docs.oracle.com/en/database/oracle/oracle-database/18/admin/distributed-database-management.html In PostgreSQL you can use a foreign data mapper for remote data and achieve the same - query database (a) and get also data from (b). I did a quick search but did not find whether SQL Server supports a similar concept. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2018-06-30 17:51 -0400 |
| Message-ID | <ph8u1r$1q5j$1@gioia.aioe.org> |
| In reply to | #38445 |
On 6/28/2018 9:49 AM, Eric Douglas wrote: > On Thursday, June 28, 2018 at 8:03:41 AM UTC-4, Eric Douglas wrote: >> On Wednesday, June 27, 2018 at 8:22:23 PM UTC-4, Arne Vajhøj wrote: >>>> I don't think the SQL can join tables from 2 different databases but would be nice if it can, needs researched. >>> >>> Generally you can't. >>> >>> Usually you can. >>> >>> You can in MS SQLServer >>> >>> Just refer to the tables as somedatabasename.dbo.sometablename and it >>> should work. >> >> but I am using java.sql.DriverManager.getConnection() which requires a connect string which includes the database name - ? > > I see, that works only on other level... > Currently we're using connect string = jdbc:sqlserver://servername:port;databasename > Then we can do select * from tablename > > The other option is to update every reference: > connect string = jdbc:sqlserver://servername:port > Then select * from databasename.dbo.tablename > > This second format is only required if you need to connect tables > from multiple databases and looks uglier the more tables you join. To switch > from one to the other gets really ugly if you're changing the connect > string for a common connection method that already has a bunch of sql > statements which aren't referencing the database name. My expectation was that you could jdbc:sqlserver://servername:port;dbnam_1 to mean that: tblnam is really dbnam.dbo.tblnam, but that you can still refer to dbnam_2.dbo.tblnam explicit aka tblnam1 JOIN dbnam_2.dbo.tblnam2 Arne
[toc] | [prev] | [next] | [standalone]
| From | Eric Douglas <e.d.programmer@gmail.com> |
|---|---|
| Date | 2018-07-03 07:13 -0700 |
| Message-ID | <f86507b7-ade9-468b-a574-622be5118a74@googlegroups.com> |
| In reply to | #38463 |
On Saturday, June 30, 2018 at 5:52:06 PM UTC-4, Arne Vajhøj wrote: > My expectation was that you could > > jdbc:sqlserver://servername:port;dbnam_1 > > to mean that: > > tblnam is really dbnam.dbo.tblnam, but that you can still > refer to dbnam_2.dbo.tblnam explicit aka > > tblnam1 JOIN dbnam_2.dbo.tblnam2 > > Arne Right, you can put a database name in the connect string. Specifying the database name in the select is optional if it's in the connect string. If you remove the database name from the connect string it must be in every sql statement. So I've found you can reference 2 databases from 2 different servers in a single JDBC connection, something they call linked servers. https://stackoverflow.com/questions/1144051/selecting-data-from-two-different-servers-in-sql-server I am running MS SQL Server Management Studio 2012 on Server 2012 R2, which is able to connect to multiple instances even though one is running SQL Server 2012 and one is running SQL Server 2014. When I connect to the one instance there are already 3 things showing under Server Objects, Linked Servers. I expand one of those, expand Catalogs, expand default, expand Tables, expand System Tables, then it gives me an error: "The OLE DB provider MSIDXS has not been registered. Microsoft SQL Server, Error: 7403". I looked this up and found Windows Server 2008, no easy fix for 2012.
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | comp.lang.java.programmer
csiph-web